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