]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
da40a4b856a204ad64c55b724281e3b4da990758
[tmp/jakarta-migration.git] /
1 /**     
2  * LocationAuthorityClient.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 © 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.PathParam;
30 import javax.ws.rs.core.Response;
31
32 //import org.collectionspace.services.common.authorityref.AuthorityRefList;
33 import org.collectionspace.services.common.authorityref.AuthorityRefDocList;
34 import org.collectionspace.services.contact.ContactsCommonList;
35 import org.collectionspace.services.location.LocationauthoritiesCommonList;
36 import org.collectionspace.services.location.LocationsCommonList;
37 import org.collectionspace.services.client.LocationAuthorityProxy;
38
39 import org.jboss.resteasy.client.ClientResponse;
40 import org.jboss.resteasy.client.ProxyFactory;
41 import org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor;
42 import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
43 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
44 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
45 import org.jboss.resteasy.spi.ResteasyProviderFactory;
46
47 /**
48  * The Class LocationAuthorityClient.
49  */
50 public class LocationAuthorityClient extends AbstractServiceClientImpl {
51
52     /* (non-Javadoc)
53      * @see org.collectionspace.services.client.BaseServiceClient#getServicePathComponent()
54      */
55     @Override
56     public String getServicePathComponent() {
57         return "locationauthorities";
58     }
59
60     /**
61      * Gets the item common part name.
62      *
63      * @return the item common part name
64      */
65     public String getItemCommonPartName() {
66         return getCommonPartName("locations");
67     }
68
69     /** The location authority proxy. */
70 //    private static final LocationAuthorityClient instance = new LocationAuthorityClient();
71     
72     /**
73      *
74      */
75     private LocationAuthorityProxy locationAuthorityProxy;
76
77     /**
78      * Instantiates a new location authority client.
79      */
80     public LocationAuthorityClient() {
81         ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
82         RegisterBuiltin.register(factory);
83         setProxy();
84     }
85
86     /* (non-Javadoc)
87      * @see org.collectionspace.services.client.CollectionSpaceClient#getProxy()
88      */
89     @Override
90     public CollectionSpaceProxy getProxy() {
91         return this.locationAuthorityProxy;
92     }    
93
94     /**
95      * Sets the proxy.
96      */
97     public void setProxy() {
98         if (useAuth()) {
99             locationAuthorityProxy = ProxyFactory.create(LocationAuthorityProxy.class,
100                     getBaseURL(), new ApacheHttpClientExecutor(getHttpClient()));
101         } else {
102             locationAuthorityProxy = ProxyFactory.create(LocationAuthorityProxy.class,
103                     getBaseURL());
104         }
105     }
106
107     /**
108      * Read list.
109      *
110      * @return the client response
111      */
112 //    public static LocationAuthorityClient getInstance() {
113 //        return instance;
114 //    }
115
116     /**
117      * @return list
118      * @see org.collectionspace.services.client.LocationAuthorityProxy#readList()
119      */
120     public ClientResponse<LocationauthoritiesCommonList> readList() {
121         return locationAuthorityProxy.readList();
122     }
123
124     /**
125      * Read.
126      *
127      * @param csid the csid
128      * @return the client response
129      */
130     public ClientResponse<MultipartInput> read(String csid) {
131         return locationAuthorityProxy.read(csid);
132     }
133
134     /**
135      * Read by name.
136      *
137      * @param name the name
138      * @return the client response
139      */
140     public ClientResponse<MultipartInput> readByName(String name) {
141         return locationAuthorityProxy.readByName(name);
142     }
143
144     /**
145      * Creates the.
146      *
147      * @param multipart the multipart
148      * @return the client response
149      */
150     public ClientResponse<Response> create(MultipartOutput multipart) {
151         return locationAuthorityProxy.create(multipart);
152     }
153
154     /**
155      * Update.
156      *
157      * @param csid the csid
158      * @param multipart the multipart
159      * @return the client response
160      */
161     public ClientResponse<MultipartInput> update(String csid, MultipartOutput multipart) {
162         return locationAuthorityProxy.update(csid, multipart);
163
164     }
165
166     /**
167      * Delete.
168      *
169      * @param csid the csid
170      * @return the client response
171      */
172     public ClientResponse<Response> delete(String csid) {
173         return locationAuthorityProxy.delete(csid);
174     }
175
176     /**
177      * Read item list, filtering by partial term match, or keywords. Only one of
178      * partialTerm or keywords should be specified. If both are specified, keywords
179      * will be ignored.
180      *
181      * @param inAuthority the parent authority
182      * @param partialTerm A partial term on which to match,
183      *     which will filter list results to return only matched resources.
184      * @param keywords A set of keywords on which to match,
185      *     which will filter list results to return only matched resources.
186      * @return the client response
187      */
188     public ClientResponse<LocationsCommonList> 
189                 readItemList(String inAuthority, String partialTerm, String keywords) {
190         return locationAuthorityProxy.readItemList(inAuthority, partialTerm, keywords);
191     }
192
193     /**
194      * Gets the referencing objects.
195      *
196      * @param parentcsid the parentcsid
197      * @param csid the csid
198      * @return the referencing objects
199      */
200     public ClientResponse<AuthorityRefDocList> getReferencingObjects(String parentcsid, String csid) {
201         return locationAuthorityProxy.getReferencingObjects(parentcsid, csid);
202     }
203
204     /**
205      * Read item list for named vocabulary, filtering by partial term match, or keywords. Only one of
206      * partialTerm or keywords should be specified. If both are specified, keywords
207      * will be ignored.
208      *
209      * @param specifier the specifier
210      * @param partialTerm A partial term on which to match,
211      *     which will filter list results to return only matched resources.
212      * @param keywords A set of keywords on which to match,
213      *     which will filter list results to return only matched resources.
214      * @return the client response
215      */
216     public ClientResponse<LocationsCommonList> 
217                 readItemListForNamedAuthority(String specifier, String partialTerm, String keywords) {
218         return locationAuthorityProxy.readItemListForNamedAuthority(specifier, partialTerm, keywords);
219     }
220
221     /**
222      * Read item.
223      *
224      * @param vcsid the vcsid
225      * @param csid the csid
226      * @return the client response
227      */
228     public ClientResponse<MultipartInput> readItem(String vcsid, String csid) {
229         return locationAuthorityProxy.readItem(vcsid, csid);
230     }
231
232     /**
233      * Creates the item.
234      *
235      * @param vcsid the vcsid
236      * @param multipart the multipart
237      * @return the client response
238      */
239     public ClientResponse<Response> createItem(String vcsid, MultipartOutput multipart) {
240         return locationAuthorityProxy.createItem(vcsid, multipart);
241     }
242
243     /**
244      * Update item.
245      *
246      * @param vcsid the vcsid
247      * @param csid the csid
248      * @param multipart the multipart
249      * @return the client response
250      */
251     public ClientResponse<MultipartInput> updateItem(String vcsid, String csid, MultipartOutput multipart) {
252         return locationAuthorityProxy.updateItem(vcsid, csid, multipart);
253
254     }
255
256     /**
257      * Delete item.
258      *
259      * @param vcsid the vcsid
260      * @param csid the csid
261      * @return the client response
262      */
263     public ClientResponse<Response> deleteItem(String vcsid, String csid) {
264         return locationAuthorityProxy.deleteItem(vcsid, csid);
265     }
266
267     /**
268      * Creates the contact.
269      *
270      * @param parentcsid the parentcsid
271      * @param itemcsid the itemcsid
272      * @param multipart the multipart
273      * @return the client response
274      */
275     public ClientResponse<Response> createContact(String parentcsid,
276             String itemcsid, MultipartOutput multipart) {
277         return locationAuthorityProxy.createContact(parentcsid, itemcsid, multipart);
278     }
279
280     /**
281      * Read contact.
282      *
283      * @param parentcsid the parentcsid
284      * @param itemcsid the itemcsid
285      * @param csid the csid
286      * @return the client response
287      */
288     public ClientResponse<MultipartInput> readContact(String parentcsid,
289             String itemcsid, String csid) {
290         return locationAuthorityProxy.readContact(parentcsid, itemcsid, csid);
291     }
292
293     /**
294      * Read contact list.
295      *
296      * @param parentcsid the parentcsid
297      * @param itemcsid the itemcsid
298      * @return the client response
299      */
300     public ClientResponse<ContactsCommonList> readContactList(String parentcsid,
301             String itemcsid) {
302         return locationAuthorityProxy.readContactList(parentcsid, itemcsid);
303     }
304
305     /**
306      * Update contact.
307      *
308      * @param parentcsid the parentcsid
309      * @param itemcsid the itemcsid
310      * @param csid the csid
311      * @param multipart the multipart
312      * @return the client response
313      */
314     public ClientResponse<MultipartInput> updateContact(String parentcsid,
315             String itemcsid, String csid, MultipartOutput multipart) {
316         return locationAuthorityProxy.updateContact(parentcsid, itemcsid, csid, multipart);
317     }
318
319     /**
320      * Delete contact.
321      *
322      * @param parentcsid the parentcsid
323      * @param itemcsid the itemcsid
324      * @param csid the csid
325      * @return the client response
326      */
327     public ClientResponse<Response> deleteContact(String parentcsid,
328         String itemcsid, String csid) {
329         return locationAuthorityProxy.deleteContact(parentcsid,
330             itemcsid, csid);
331     }
332
333 }