]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
41291600f7ce25b48e3259c5feee6e8f712462aa
[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.TaxonomyJAXBSchema;
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.TaxonomyDocumentModelHandler;
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<TaxonomyauthoritiesCommon, TaxonomyauthoritiesCommonList, 
83                                                         TaxonomyCommon, TaxonomyDocumentModelHandler> {
84
85     private final static String taxonomyAuthorityServiceName = "taxonomyauthorities";
86         private final static String LOCATIONAUTHORITIES_COMMON = "taxonomyauthority_common";
87     
88     private final static String taxonomyServiceName = "taxonomy";
89         private final static String LOCATIONS_COMMON = "taxonomy_common";
90     
91     /** The logger. */
92     final Logger logger = LoggerFactory.getLogger(TaxonomyAuthorityResource.class);
93     //FIXME retrieve client type from configuration
94     /** The Constant CLIENT_TYPE. */
95     final static ClientType CLIENT_TYPE = ServiceMain.getInstance().getClientType();
96     
97     /**
98      * Instantiates a new taxonomy authority resource.
99      */
100     public TaxonomyAuthorityResource() {
101                 super(TaxonomyauthoritiesCommon.class, TaxonomyAuthorityResource.class,
102                                 LOCATIONAUTHORITIES_COMMON, LOCATIONS_COMMON);
103     }
104
105     /* (non-Javadoc)
106      * @see org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl#getServiceName()
107      */
108     @Override
109     public String getServiceName() {
110         return taxonomyAuthorityServiceName;
111     }
112
113     /**
114      * Gets the item service name.
115      * 
116      * @return the item service name
117      */
118     public String getItemServiceName() {
119         return taxonomyServiceName;
120     }
121
122     @Override
123     public Class<TaxonomyauthoritiesCommon> getCommonPartClass() {
124         return TaxonomyauthoritiesCommon.class;
125     }
126 }