]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
228f34e79b182c52b96f820b05c112536ba03a39
[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.common.ResourceBase;
31 import org.collectionspace.services.common.profile.Profiler;
32 import org.collectionspace.services.jaxb.AbstractCommonList;
33 import org.collectionspace.services.relation.RelationResource;
34 import org.collectionspace.services.relation.RelationsCommonList;
35 import org.collectionspace.services.relation.RelationshipType;
36 import org.jboss.resteasy.util.HttpResponseCodes;
37 import org.slf4j.Logger;
38 import org.slf4j.LoggerFactory;
39
40 import javax.ws.rs.Consumes;
41 import javax.ws.rs.GET;
42 import javax.ws.rs.Path;
43 import javax.ws.rs.PathParam;
44 import javax.ws.rs.Produces;
45 import javax.ws.rs.QueryParam;
46 import javax.ws.rs.WebApplicationException;
47 import javax.ws.rs.core.Context;
48 import javax.ws.rs.core.MultivaluedMap;
49 import javax.ws.rs.core.Response;
50 import javax.ws.rs.core.UriInfo;
51 import java.util.ArrayList;
52 import java.util.List;
53
54
55 @Path(CollectionObjectClient.SERVICE_PATH_COMPONENT)
56 @Consumes("application/xml")
57 @Produces("application/xml")
58 public class CollectionObjectResource extends ResourceBase {
59     
60     final Logger logger = LoggerFactory.getLogger(CollectionObjectResource.class);
61
62     @Override
63     public String getVersionString() {
64         final String lastChangeRevision = "$LastChangedRevision$";
65         return lastChangeRevision;
66     }
67
68     @Override
69     public String getServiceName() {
70         return CollectionObjectClient.SERVICE_PATH_COMPONENT;
71     }
72     
73     @Override
74     public Class<CollectionobjectsCommon> getCommonPartClass() {
75         return CollectionobjectsCommon.class;
76     }
77
78     /**
79      * Roundtrip.
80      * 
81      * This is an intentionally empty method used for getting a rough time estimate
82      * of the overhead required for a client->server request/response cycle.
83      * @param ms - milliseconds to delay
84      * 
85      * @return the response
86      */
87     @GET
88     @Path("/{ms}/roundtrip")
89     @Produces("application/xml")
90     public Response roundtrip(
91                 @PathParam("ms") String ms) {
92         Response result = null;
93         
94         Profiler profiler = new Profiler("roundtrip():", 1);
95         profiler.start();
96                 result = Response.status(HttpResponseCodes.SC_OK).build();
97                 profiler.stop();
98                 
99                 return result;
100     }
101
102     /**
103      * This method is deprecated.  Use SearchCollectionObjects() method instead.
104      * Keywords search collection objects.
105      * @param ui 
106      * 
107      * @param keywords the keywords
108      * 
109      * @return the collectionobjects common list
110      */
111     /*
112     @GET
113     @Path("/search")
114     @Produces("application/xml")
115     @Deprecated
116     public AbstractCommonList keywordsSearchCollectionObjects(@Context UriInfo ui,
117             @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS) String keywords) {
118         MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
119         return search(queryParams, keywords);
120     }  
121      * 
122      */
123
124 }