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:
6 * http://www.collectionspace.org
7 * http://wiki.collectionspace.org
9 * Copyright 2009 University of California at Berkeley
11 * Licensed under the Educational Community License (ECL), Version 2.0.
12 * You may not use this file except in compliance with this License.
14 * You may obtain a copy of the ECL 2.0 License at
16 * https://source.collectionspace.org/collection-space/LICENSE.txt
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.
24 package org.collectionspace.services.taxonomy;
26 import java.util.List;
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;
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;
76 * The Class TaxonomyAuthorityResource.
78 @Path(TaxonomyAuthorityClient.SERVICE_PATH)
79 @Consumes("application/xml")
80 @Produces("application/xml")
81 public class TaxonomyAuthorityResource
82 extends AuthorityResource<TaxonomyauthorityCommon, TaxonomyauthorityCommonList,
83 TaxonCommon, TaxonomyDocumentModelHandler> {
85 private final static String taxonomyAuthorityServiceName = "taxonomyauthorities";
86 private final static String TAXONOMYAUTHORITY_COMMON = "taxonomyauthority_common";
88 // FIXME: May be desirable to change this to the plural form 'taxa',
89 // both here and in related config.
90 private final static String taxonomyItemServiceName = "taxon";
91 private final static String TAXON_COMMON = "taxon_common";
94 final Logger logger = LoggerFactory.getLogger(TaxonomyAuthorityResource.class);
95 //FIXME retrieve client type from configuration
96 /** The Constant CLIENT_TYPE. */
97 final static ClientType CLIENT_TYPE = ServiceMain.getInstance().getClientType();
100 * Instantiates a new taxonomy authority resource.
102 public TaxonomyAuthorityResource() {
103 super(TaxonomyauthorityCommon.class, TaxonomyAuthorityResource.class,
104 TAXONOMYAUTHORITY_COMMON, TAXON_COMMON);
108 * @see org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl#getServiceName()
111 public String getServiceName() {
112 return taxonomyAuthorityServiceName;
116 * Gets the item service name.
118 * @return the item service name
120 public String getItemServiceName() {
121 return taxononomyItemServiceName;
125 public Class<TaxonomyauthorityCommon> getCommonPartClass() {
126 return TaxonomyauthorityCommon.class;