]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
7b3228ccdce28cddc5a49907595415130750527f
[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  *  $LastChangedRevision$
25  */
26 package org.collectionspace.services.collectionobject;
27
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;
38
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;
52
53
54 @Path(CollectionObjectClient.SERVICE_PATH_COMPONENT)
55 @Consumes("application/xml")
56 @Produces("application/xml")
57 public class CollectionObjectResource extends ResourceBase {
58     
59     final Logger logger = LoggerFactory.getLogger(CollectionObjectResource.class);
60
61     @Override
62     public String getVersionString() {
63         final String lastChangeRevision = "$LastChangedRevision$";
64         return lastChangeRevision;
65     }
66
67     @Override
68     public String getServiceName() {
69         return CollectionObjectClient.SERVICE_PATH_COMPONENT;
70     }
71     
72     @Override
73     public Class<CollectionobjectsCommon> getCommonPartClass() {
74         return CollectionobjectsCommon.class;
75     }
76
77     /**
78      * Roundtrip.
79      * 
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
83      * 
84      * @return the response
85      */
86     @GET
87     @Path("/{ms}/roundtrip")
88     @Produces("application/xml")
89     public Response roundtrip(
90                 @PathParam("ms") String ms) {
91         Response result = null;
92         
93         Profiler profiler = new Profiler("roundtrip():", 1);
94         profiler.start();
95                 result = Response.status(HttpResponseCodes.SC_OK).build();
96                 profiler.stop();
97                 
98                 return result;
99     }
100
101     /**
102      * This method is deprecated.  Use SearchCollectionObjects() method instead.
103      * Keywords search collection objects.
104      * @param ui 
105      * 
106      * @param keywords the keywords
107      * 
108      * @return the collectionobjects common list
109      */
110     /*
111     @GET
112     @Path("/search")
113     @Produces("application/xml")
114     @Deprecated
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);
119     }  
120      * 
121      */
122
123 }