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 * $LastChangedRevision$
26 package org.collectionspace.services.collectionobject;
28 import org.collectionspace.services.client.CollectionObjectClient;
29 import org.collectionspace.services.client.IQueryManager;
30 import org.collectionspace.services.client.Profiler;
31 import org.collectionspace.services.common.ResourceBase;
32 import org.collectionspace.services.jaxb.AbstractCommonList;
33 import org.collectionspace.services.relation.RelationsCommonList;
34 import org.collectionspace.services.relation.RelationshipType;
35 import org.jboss.resteasy.util.HttpResponseCodes;
36 import org.slf4j.Logger;
37 import org.slf4j.LoggerFactory;
39 import javax.ws.rs.Consumes;
40 import javax.ws.rs.GET;
41 import javax.ws.rs.Path;
42 import javax.ws.rs.PathParam;
43 import javax.ws.rs.Produces;
44 import javax.ws.rs.QueryParam;
45 import javax.ws.rs.WebApplicationException;
46 import javax.ws.rs.core.Context;
47 import javax.ws.rs.core.MultivaluedMap;
48 import javax.ws.rs.core.Response;
49 import javax.ws.rs.core.UriInfo;
50 import java.util.ArrayList;
51 import java.util.List;
54 @Path(CollectionObjectClient.SERVICE_PATH_COMPONENT)
55 @Consumes("application/xml")
56 @Produces("application/xml")
57 public class CollectionObjectResource extends ResourceBase {
59 final Logger logger = LoggerFactory.getLogger(CollectionObjectResource.class);
62 public String getVersionString() {
63 final String lastChangeRevision = "$LastChangedRevision$";
64 return lastChangeRevision;
68 public String getServiceName() {
69 return CollectionObjectClient.SERVICE_PATH_COMPONENT;
73 public Class<CollectionobjectsCommon> getCommonPartClass() {
74 return CollectionobjectsCommon.class;
80 * This is an intentionally empty method used for getting a rough time estimate
81 * of the overhead required for a client->server request/response cycle.
82 * @param ms - milliseconds to delay
84 * @return the response
87 @Path("/{ms}/roundtrip")
88 @Produces("application/xml")
89 public Response roundtrip(
90 @PathParam("ms") String ms) {
91 Response result = null;
93 Profiler profiler = new Profiler("roundtrip():", 1);
95 result = Response.status(HttpResponseCodes.SC_OK).build();
102 * This method is deprecated. Use SearchCollectionObjects() method instead.
103 * Keywords search collection objects.
106 * @param keywords the keywords
108 * @return the collectionobjects common list
113 @Produces("application/xml")
115 public AbstractCommonList keywordsSearchCollectionObjects(@Context UriInfo ui,
116 @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS) String keywords) {
117 MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
118 return search(queryParams, keywords);