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.location;
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.LocationAuthorityClient;
45 import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema;
46 import org.collectionspace.services.LocationJAXBSchema;
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.common.query.IQueryManager;
69 import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
70 import org.collectionspace.services.location.nuxeo.LocationDocumentModelHandler;
71 import org.jboss.resteasy.util.HttpResponseCodes;
72 import org.nuxeo.ecm.core.api.DocumentModel;
73 import org.slf4j.Logger;
74 import org.slf4j.LoggerFactory;
77 * The Class LocationAuthorityResource.
79 @Path(LocationAuthorityClient.SERVICE_PATH)
80 @Consumes("application/xml")
81 @Produces("application/xml")
82 public class LocationAuthorityResource
83 extends AuthorityResource<LocationauthoritiesCommon, LocationauthoritiesCommonList,
84 LocationsCommon, LocationDocumentModelHandler> {
86 private final static String locationAuthorityServiceName = "locationauthorities";
87 private final static String LOCATIONAUTHORITIES_COMMON = "locationauthorities_common";
89 private final static String locationServiceName = "locations";
90 private final static String LOCATIONS_COMMON = "locations_common";
93 final Logger logger = LoggerFactory.getLogger(LocationAuthorityResource.class);
94 //FIXME retrieve client type from configuration
95 /** The Constant CLIENT_TYPE. */
96 final static ClientType CLIENT_TYPE = ServiceMain.getInstance().getClientType();
99 * Instantiates a new location authority resource.
101 public LocationAuthorityResource() {
102 super(LocationauthoritiesCommon.class, LocationAuthorityResource.class,
103 LOCATIONAUTHORITIES_COMMON, LOCATIONS_COMMON);
107 * @see org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl#getServiceName()
110 public String getServiceName() {
111 return locationAuthorityServiceName;
115 * Gets the item service name.
117 * @return the item service name
119 public String getItemServiceName() {
120 return locationServiceName;
124 public Class<LocationauthoritiesCommon> getCommonPartClass() {
125 return LocationauthoritiesCommon.class;