]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
1f1e02019f9e174d0a7f64da96e224d2fe0b1080
[tmp/jakarta-migration.git] /
1 /**     
2  * CollectionObjectClient.java
3  *
4  * {Purpose of This Class}
5  *
6  * {Other Notes Relating to This Class (Optional)}
7  *
8  * $LastChangedBy: $
9  * $LastChangedRevision: $
10  * $LastChangedDate: $
11  *
12  * This document is a part of the source code and related artifacts
13  * for CollectionSpace, an open source collections management system
14  * for museums and related institutions:
15  *
16  * http://www.collectionspace.org
17  * http://wiki.collectionspace.org
18  *
19  * Copyright (C) 2009 {Contributing Institution}
20  *
21  * Licensed under the Educational Community License (ECL), Version 2.0.
22  * You may not use this file except in compliance with this License.
23  *
24  * You may obtain a copy of the ECL 2.0 License at
25  * https://source.collectionspace.org/collection-space/LICENSE.txt
26  */
27 package org.collectionspace.services.client;
28
29 import javax.ws.rs.GET;
30 import javax.ws.rs.Produces;
31 import javax.ws.rs.QueryParam;
32 import javax.ws.rs.core.Context;
33 import javax.ws.rs.core.Response;
34 import javax.ws.rs.core.UriInfo;
35
36
37 import org.collectionspace.services.collectionobject.CollectionobjectsCommonList;
38 import org.collectionspace.services.common.authorityref.AuthorityRefList;
39 import org.collectionspace.services.common.context.ServiceContext;
40 import org.collectionspace.services.common.query.IQueryManager;
41 import org.jboss.resteasy.client.ProxyFactory;
42 import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
43 import org.jboss.resteasy.client.ClientResponse;
44 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
45 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
46 import org.jboss.resteasy.spi.ResteasyProviderFactory;
47
48 /**
49  * The Class CollectionObjectClient.
50  */
51 public class CollectionObjectClient extends AbstractServiceClientImpl {
52
53     /** The collection object proxy. */
54     private CollectionObjectProxy collectionObjectProxy;
55     
56         /* (non-Javadoc)
57          * @see org.collectionspace.services.client.BaseServiceClient#getServicePathComponent()
58          */
59         public String getServicePathComponent() {
60                 return "collectionobjects";
61         }
62
63     /**
64      * Instantiates a new collection object client.
65      */
66     public CollectionObjectClient() {
67         ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
68         RegisterBuiltin.register(factory);
69         setProxy();
70     }
71
72     /**
73      * Sets the proxy.
74      */
75     public void setProxy() {
76         if(useAuth()){
77             collectionObjectProxy = ProxyFactory.create(CollectionObjectProxy.class,
78                     getBaseURL(), getHttpClient());
79         }else{
80             collectionObjectProxy = ProxyFactory.create(CollectionObjectProxy.class,
81                     getBaseURL());
82         }
83     }
84
85     /**
86      * Read list.
87      * 
88      * @see org.collectionspace.services.client.CollectionObjectProxy#readList()
89      * @return the client response< collectionobjects common list>
90      */
91     public ClientResponse<CollectionobjectsCommonList> readList() {
92         return collectionObjectProxy.readList();
93
94     }
95     
96     /**
97      * Roundtrip.
98      * 
99      * This is an intentionally empty method that is used for performance test 
100      * to get a rough time estimate of the client to server response-request overhead.
101      * 
102      * @see org.collectionspace.services.client.CollectionObjectProxy#roundtrip()
103      * @return the client response< response>
104      */
105     public ClientResponse<Response> roundtrip() {
106         return collectionObjectProxy.roundtrip();
107     }
108     
109     /**
110      * Keyword search.
111      * 
112      * @param keywords the keywords
113      * 
114      * @see org.collectionspace.services.client.CollectionObjectProxy#keywordSearch()
115      * @return the client response< collectionobjects common list>
116      */
117     public ClientResponse<CollectionobjectsCommonList> keywordSearch(String keywords) {
118         return collectionObjectProxy.keywordSearch(keywords);
119
120     }
121     
122     /**
123      * Read.
124      * 
125      * @param csid the csid
126      * 
127      * @see org.collectionspace.services.client.CollectionObjectProxy#keywordSearch()
128      * @return the client response< multipart input>
129      */
130     public ClientResponse<MultipartInput> read(String csid) {
131         return collectionObjectProxy.read(csid);
132     }
133
134     /**
135      * @param csid
136      * @return
137      * @see org.collectionspace.services.client.CollectionObjectProxy#getAuthorityRefs(java.lang.String)
138      */
139     public ClientResponse<AuthorityRefList> getAuthorityRefs(String csid) {
140         return collectionObjectProxy.getAuthorityRefs(csid);
141     }
142
143
144     /**
145      * Creates the.
146      * 
147      * @param multipart the multipart
148      * 
149      * @see org.collectionspace.services.client.CollectionObjectProxy#create()
150      * @return the client response< response>
151      */
152     public ClientResponse<Response> create(MultipartOutput multipart) {
153         return collectionObjectProxy.create(multipart);
154     }
155
156     /**
157      * Update.
158      * 
159      * @param csid the csid
160      * @param multipart the multipart
161      * 
162      * @see org.collectionspace.services.client.CollectionObjectProxy#update()
163      * @return the client response< multipart input>
164      */
165     public ClientResponse<MultipartInput> update(String csid, MultipartOutput multipart) {
166         return collectionObjectProxy.update(csid, multipart);
167     }
168
169     /**
170      * Delete.
171      * 
172      * @param csid the csid
173      * 
174      * @see org.collectionspace.services.client.CollectionObjectProxy#delete()
175      * @return the client response< response>
176      */
177     public ClientResponse<Response> delete(String csid) {
178         return collectionObjectProxy.delete(csid);
179     }
180 }