]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
2dd0227ee1f8a3ad0ee5702d69388f38ca3715ee
[tmp/jakarta-migration.git] /
1 /**
2  *  This document is a part of the source code and related artifacts
3  *  for CollectionSpace, an open source collections management system
4  *  for museums and related institutions:
5
6  *  http://www.collectionspace.org
7  *  http://wiki.collectionspace.org
8
9  *  Copyright 2009 University of California at Berkeley
10
11  *  Licensed under the Educational Community License (ECL), Version 2.0.
12  *  You may not use this file except in compliance with this License.
13
14  *  You may obtain a copy of the ECL 2.0 License at
15
16  *  https://source.collectionspace.org/collection-space/LICENSE.txt
17
18  *  Unless required by applicable law or agreed to in writing, software
19  *  distributed under the License is distributed on an "AS IS" BASIS,
20  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  *  See the License for the specific language governing permissions and
22  *  limitations under the License.
23  */
24 package org.collectionspace.services.taxonomy;
25
26 import java.util.List;
27
28 import javax.ws.rs.Consumes;
29 import javax.ws.rs.DELETE;
30 import javax.ws.rs.GET;
31 import javax.ws.rs.POST;
32 import javax.ws.rs.PUT;
33 import javax.ws.rs.Path;
34 import javax.ws.rs.PathParam;
35 import javax.ws.rs.Produces;
36 import javax.ws.rs.QueryParam;
37 import javax.ws.rs.WebApplicationException;
38 import javax.ws.rs.core.Context;
39 import javax.ws.rs.core.MultivaluedMap;
40 import javax.ws.rs.core.Response;
41 import javax.ws.rs.core.UriBuilder;
42 import javax.ws.rs.core.UriInfo;
43
44 import org.collectionspace.services.client.TaxonomyAuthorityClient;
45 import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema;
46 import org.collectionspace.services.TaxonJAXBSchema;
47 import org.collectionspace.services.common.AbstractMultiPartCollectionSpaceResourceImpl;
48 import org.collectionspace.services.common.ClientType;
49 import org.collectionspace.services.common.ServiceMain;
50 import org.collectionspace.services.common.authorityref.AuthorityRefDocList;
51 import org.collectionspace.services.common.authorityref.AuthorityRefList;
52 import org.collectionspace.services.common.context.MultipartServiceContext;
53 import org.collectionspace.services.common.context.MultipartServiceContextFactory;
54 import org.collectionspace.services.common.context.MultipartServiceContextImpl;
55 import org.collectionspace.services.common.context.ServiceBindingUtils;
56 import org.collectionspace.services.common.context.ServiceContext;
57 import org.collectionspace.services.common.document.BadRequestException;
58 import org.collectionspace.services.common.document.DocumentException;
59 import org.collectionspace.services.common.document.DocumentFilter;
60 import org.collectionspace.services.common.document.DocumentHandler;
61 import org.collectionspace.services.common.document.DocumentNotFoundException;
62 import org.collectionspace.services.common.document.DocumentWrapper;
63 import org.collectionspace.services.common.repository.RepositoryClient;
64 import org.collectionspace.services.common.security.UnauthorizedException;
65 import org.collectionspace.services.common.vocabulary.AuthorityResource;
66 import org.collectionspace.services.common.vocabulary.RefNameServiceUtils;
67 import org.collectionspace.services.common.vocabulary.RefNameUtils;
68 import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
69 import org.collectionspace.services.taxonomy.nuxeo.TaxonDocumentModelHandler;
70 import org.jboss.resteasy.util.HttpResponseCodes;
71 import org.nuxeo.ecm.core.api.DocumentModel;
72 import org.slf4j.Logger;
73 import org.slf4j.LoggerFactory;
74
75 /**
76  * The Class TaxonomyAuthorityResource.
77  */
78 @Path(TaxonomyAuthorityClient.SERVICE_PATH)
79 @Consumes("application/xml")
80 @Produces("application/xml")
81 public class TaxonomyAuthorityResource
82         extends AuthorityResource<TaxonomyauthorityCommon, TaxonomyauthorityCommonList, TaxonCommon, TaxonDocumentModelHandler> {
83
84     private final static String taxonomyAuthorityServiceName = "taxonomyauthorities";
85     private final static String TAXONOMYAUTHORITY_COMMON = "taxonomyauthority_common";
86     private final static String taxonomyItemServiceName = "taxon";
87     private final static String TAXONOMYITEM_COMMON = "taxon_common";
88     /** The logger. */
89     final Logger logger = LoggerFactory.getLogger(TaxonomyAuthorityResource.class);
90     //FIXME retrieve client type from configuration
91     /** The Constant CLIENT_TYPE. */
92     final static ClientType CLIENT_TYPE = ServiceMain.getInstance().getClientType();
93
94     /**
95      * Instantiates a new taxonomy authority resource.
96      */
97     public TaxonomyAuthorityResource() {
98         super(TaxonomyauthorityCommon.class, TaxonomyAuthorityResource.class,
99                 TAXONOMYAUTHORITY_COMMON, TAXONOMYITEM_COMMON);
100     }
101
102     /* (non-Javadoc)
103      * @see org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl#getServiceName()
104      */
105     @Override
106     public String getServiceName() {
107         return taxonomyAuthorityServiceName;
108     }
109
110     /**
111      * Gets the item service name.
112      * 
113      * @return the item service name
114      */
115     @Override
116     public String getItemServiceName() {
117         return taxonomyItemServiceName;
118     }
119
120     @Override
121     public Class<TaxonomyauthorityCommon> getCommonPartClass() {
122         return TaxonomyauthorityCommon.class;
123     }
124 }