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.common.vocabulary.AuthorityJAXBSchema;
45 import org.collectionspace.services.LocationJAXBSchema;
46 import org.collectionspace.services.common.AbstractMultiPartCollectionSpaceResourceImpl;
47 import org.collectionspace.services.common.ClientType;
48 import org.collectionspace.services.common.ServiceMain;
49 import org.collectionspace.services.common.authorityref.AuthorityRefDocList;
50 import org.collectionspace.services.common.authorityref.AuthorityRefList;
51 import org.collectionspace.services.common.context.MultipartServiceContext;
52 import org.collectionspace.services.common.context.MultipartServiceContextFactory;
53 import org.collectionspace.services.common.context.MultipartServiceContextImpl;
54 import org.collectionspace.services.common.context.ServiceBindingUtils;
55 import org.collectionspace.services.common.context.ServiceContext;
56 import org.collectionspace.services.common.document.BadRequestException;
57 import org.collectionspace.services.common.document.DocumentException;
58 import org.collectionspace.services.common.document.DocumentFilter;
59 import org.collectionspace.services.common.document.DocumentHandler;
60 import org.collectionspace.services.common.document.DocumentNotFoundException;
61 import org.collectionspace.services.common.document.DocumentWrapper;
62 import org.collectionspace.services.common.repository.RepositoryClient;
63 import org.collectionspace.services.common.security.UnauthorizedException;
64 import org.collectionspace.services.common.vocabulary.AuthorityResource;
65 import org.collectionspace.services.common.vocabulary.RefNameServiceUtils;
66 import org.collectionspace.services.common.vocabulary.RefNameUtils;
67 import org.collectionspace.services.common.query.IQueryManager;
68 import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
69 import org.collectionspace.services.location.nuxeo.LocationDocumentModelHandler;
70 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
71 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
72 import org.jboss.resteasy.util.HttpResponseCodes;
73 import org.nuxeo.ecm.core.api.DocumentModel;
74 import org.slf4j.Logger;
75 import org.slf4j.LoggerFactory;
78 * The Class LocationAuthorityResource.
80 @Path("/locationauthorities")
81 @Consumes("multipart/mixed")
82 @Produces("multipart/mixed")
83 public class LocationAuthorityResource
84 extends AuthorityResource<LocationauthoritiesCommon, LocationauthoritiesCommonList,
85 LocationsCommon, LocationDocumentModelHandler> {
87 private final static String locationAuthorityServiceName = "locationauthorities";
88 private final static String LOCATIONAUTHORITIES_COMMON = "locationauthorities_common";
90 private final static String locationServiceName = "locations";
91 private final static String LOCATIONS_COMMON = "locations_common";
94 final Logger logger = LoggerFactory.getLogger(LocationAuthorityResource.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 location authority resource.
102 public LocationAuthorityResource() {
103 super(LocationauthoritiesCommon.class, LocationAuthorityResource.class,
104 LOCATIONAUTHORITIES_COMMON, LOCATIONS_COMMON);
108 * @see org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl#getServiceName()
111 public String getServiceName() {
112 return locationAuthorityServiceName;
116 * Gets the item service name.
118 * @return the item service name
120 public String getItemServiceName() {
121 return locationServiceName;
125 public Class<LocationauthoritiesCommon> getCommonPartClass() {
126 return LocationauthoritiesCommon.class;