]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
d7ac2b52525f495151cfe3c4d7823cf1d2b366ac
[tmp/jakarta-migration.git] /
1 /**     
2  * OrgAuthorityClient.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.AuthorityRefDocList;
33 import org.collectionspace.services.common.authorityref.AuthorityRefList;
34 import org.collectionspace.services.contact.ContactsCommonList;
35 import org.collectionspace.services.organization.OrgauthoritiesCommonList;
36 import org.collectionspace.services.organization.OrganizationsCommonList;
37
38 import org.jboss.resteasy.client.ClientResponse;
39 import org.jboss.resteasy.client.ProxyFactory;
40 import org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor;
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 OrgAuthorityClient.
48  */
49 public class OrgAuthorityClient extends AbstractServiceClientImpl {
50
51     /* (non-Javadoc)
52      * @see org.collectionspace.services.client.AbstractServiceClientImpl#getServicePathComponent()
53      */
54     @Override
55     public String getServicePathComponent() {
56         return "orgauthorities";
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("organizations");
66     }
67     
68     /** The Constant instance. */  //FIXME: This is wrong.  There should NOT be a static instance of the OrgAuthorityClient class
69 //    private static final OrgAuthorityClient instance = new OrgAuthorityClient();
70     
71     /** The org authority proxy. */
72     private OrgAuthorityProxy orgAuthorityProxy;
73
74     /**
75      * Instantiates a new org authority client.
76      */
77     public OrgAuthorityClient() {
78         ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
79         RegisterBuiltin.register(factory);
80         setProxy();
81     }
82
83     /* (non-Javadoc)
84      * @see org.collectionspace.services.client.CollectionSpaceClient#getProxy()
85      */
86     @Override
87     public CollectionSpaceProxy getProxy() {
88         return this.orgAuthorityProxy;
89     }    
90
91     /**
92      * Sets the proxy.
93      */
94     public void setProxy() {
95         if (useAuth()) {
96             orgAuthorityProxy = ProxyFactory.create(OrgAuthorityProxy.class,
97                     getBaseURL(), new ApacheHttpClientExecutor(getHttpClient()));
98         } else {
99             orgAuthorityProxy = ProxyFactory.create(OrgAuthorityProxy.class,
100                     getBaseURL());
101         }
102     }
103
104     /**
105      * Gets the single instance of OrgAuthorityClient.
106      *
107      * @return single instance of OrgAuthorityClient //FIXME: This is wrong.  There should NOT be a static instance of the client
108      */
109 //    public static OrgAuthorityClient getInstance() {
110 //        return instance;
111 //    }
112
113     /**
114      * Read list.
115      *
116      * @return the client response
117      */
118     public ClientResponse<OrgauthoritiesCommonList> readList() {
119         return orgAuthorityProxy.readList();
120     }
121
122     /**
123      * Read.
124      *
125      * @param csid the csid
126      * @return the client response
127      */
128     public ClientResponse<MultipartInput> read(String csid) {
129         return orgAuthorityProxy.read(csid);
130     }
131
132     /**
133      * Read by name.
134      *
135      * @param name the name
136      * @return the client response
137      */
138     public ClientResponse<MultipartInput> readByName(String name) {
139         return orgAuthorityProxy.readByName(name);
140     }
141
142     /**
143      * Creates the.
144      *
145      * @param multipart the multipart
146      * @return the client response
147      */
148     public ClientResponse<Response> create(MultipartOutput multipart) {
149         return orgAuthorityProxy.create(multipart);
150     }
151
152     /**
153      * Update.
154      *
155      * @param csid the csid
156      * @param multipart the multipart
157      * @return the client response
158      */
159     public ClientResponse<MultipartInput> update(String csid, MultipartOutput multipart) {
160         return orgAuthorityProxy.update(csid, multipart);
161
162     }
163
164     /**
165      * Delete.
166      *
167      * @param csid the csid
168      * @return the client response
169      */
170     @Override
171     public ClientResponse<Response> delete(String csid) {
172         return orgAuthorityProxy.delete(csid);
173     }
174
175     /**
176      * Read item list, filtering by partial term match, or keywords. Only one of
177      * partialTerm or keywords should be specified. If both are specified, keywords
178      * will be ignored.
179      *
180      * @param inAuthority the parent authority
181      * @param partialTerm A partial term on which to match,
182      *     which will filter list results to return only matched resources.
183      * @param keywords A set of keywords on which to match,
184      *     which will filter list results to return only matched resources.
185      * @return the client response
186      */
187     public ClientResponse<OrganizationsCommonList> 
188                 readItemList(String inAuthority, String partialTerm, String keywords) {
189         return orgAuthorityProxy.readItemList(inAuthority, partialTerm, keywords);
190     }
191     
192     /**
193      * Gets the referencing objects.
194      *
195      * @param parentcsid the parentcsid
196      * @param csid the csid
197      * @return the referencing objects
198      */
199     public ClientResponse<AuthorityRefDocList> getReferencingObjects(String parentcsid, String csid) {
200         return orgAuthorityProxy.getReferencingObjects(parentcsid, csid);
201     }
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<OrganizationsCommonList> 
217                 readItemListForNamedAuthority(String specifier, String partialTerm, String keywords) {
218         return orgAuthorityProxy.readItemListForNamedAuthority(specifier, partialTerm, keywords);
219     }
220
221     /**
222      * Gets the item authority refs.
223      *
224      * @param parentcsid the parentcsid
225      * @param csid the csid
226      * @return the item authority refs
227      */
228     public ClientResponse<AuthorityRefList> getItemAuthorityRefs(String parentcsid, String csid) {
229         return orgAuthorityProxy.getItemAuthorityRefs(parentcsid, csid);
230     }
231
232     /**
233      * Read item.
234      *
235      * @param vcsid the vcsid
236      * @param csid the csid
237      * @return the client response
238      */
239     public ClientResponse<MultipartInput> readItem(String vcsid, String csid) {
240         return orgAuthorityProxy.readItem(vcsid, csid);
241     }
242
243     /**
244      * Read named item.
245      *
246      * @param vcsid the vcsid
247      * @param shortId the shortIdentifier
248      * @return the client response
249      */
250     public ClientResponse<MultipartInput> readNamedItem(String vcsid, String shortId) {
251         return orgAuthorityProxy.readNamedItem(vcsid, shortId);
252     }
253
254     /**
255      * Read item in Named Authority.
256      *
257      * @param authShortId the shortIdentifier for the Authority
258      * @param csid the csid
259      * @return the client response
260      */
261     public ClientResponse<MultipartInput> readItemInNamedAuthority(String authShortId, String csid) {
262         return orgAuthorityProxy.readItemInNamedAuthority(authShortId, csid);
263     }
264
265     /**
266      * Read named item in Named Authority.
267      *
268      * @param authShortId the shortIdentifier for the Authority
269      * @param itemShortId the shortIdentifier for the item
270      * @return the client response
271      */
272     public ClientResponse<MultipartInput> readNamedItemInNamedAuthority(String authShortId, String itemShortId) {
273         return orgAuthorityProxy.readNamedItemInNamedAuthority(authShortId, itemShortId);
274     }
275
276     /**
277      * Creates the item.
278      *
279      * @param vcsid the vcsid
280      * @param multipart the multipart
281      * @return the client response
282      */
283     public ClientResponse<Response> createItem(String vcsid, MultipartOutput multipart) {
284         return orgAuthorityProxy.createItem(vcsid, multipart);
285     }
286
287     /**
288      * Update item.
289      *
290      * @param vcsid the vcsid
291      * @param csid the csid
292      * @param multipart the multipart
293      * @return the client response
294      */
295     public ClientResponse<MultipartInput> updateItem(String vcsid, String csid, MultipartOutput multipart) {
296         return orgAuthorityProxy.updateItem(vcsid, csid, multipart);
297
298     }
299
300     /**
301      * Delete item.
302      *
303      * @param vcsid the vcsid
304      * @param csid the csid
305      * @return the client response
306      */
307     public ClientResponse<Response> deleteItem(String vcsid, String csid) {
308         return orgAuthorityProxy.deleteItem(vcsid, csid);
309     }
310
311     /***************************************************************************
312      * 
313      * Contact sub-resource interfaces
314      * 
315      ***************************************************************************/
316     
317     /**
318      * Creates the contact.
319      *
320      * @param parentcsid the parentcsid
321      * @param itemcsid the itemcsid
322      * @param multipart the multipart
323      * @return the client response
324      */
325     public ClientResponse<Response> createContact(String parentcsid,
326             String itemcsid, MultipartOutput multipart) {
327         return orgAuthorityProxy.createContact(parentcsid, itemcsid, multipart);
328     }
329
330     /**
331      * Creates the contact.
332      *
333      * @param parentcsid
334      * @param itemspecifier (shortIdentifier)
335      * @param multipart
336      * @return the client response
337      */
338     public ClientResponse<Response> createContactForNamedItem(
339                 String parentcsid,
340                 String itemspecifier,
341                 MultipartOutput multipart) {
342         return orgAuthorityProxy.createContactForNamedItem(parentcsid, itemspecifier, multipart);
343     }
344     /**
345      * Creates the contact.
346      *
347      * @param parentspecifier (shortIdentifier)
348      * @param itemcsid
349      * @param multipart
350      * @return the client response
351      */
352     public ClientResponse<Response> createContactForItemInNamedAuthority(
353                 String parentspecifier,
354                 String itemcsid,
355                 MultipartOutput multipart) {
356         return orgAuthorityProxy.createContactForItemInNamedAuthority(parentspecifier, itemcsid, multipart);
357     }
358     /**
359      * Creates the contact.
360      *
361      * @param parentspecifier (shortIdentifier)
362      * @param itemspecifier (shortIdentifier)
363      * @param multipart
364      * @return the client response
365      */
366     public ClientResponse<Response> createContactForNamedItemInNamedAuthority(
367                 String parentspecifier,
368                 String itemspecifier,
369                 MultipartOutput multipart) {
370         return orgAuthorityProxy.createContactForNamedItemInNamedAuthority(parentspecifier, itemspecifier, multipart);
371     }
372     
373     /**
374      * Read contact.
375      *
376      * @param parentcsid the parentcsid
377      * @param itemcsid the itemcsid
378      * @param csid the csid
379      * @return the client response
380      */
381     public ClientResponse<MultipartInput> readContact(String parentcsid,
382             String itemcsid, String csid) {
383         return orgAuthorityProxy.readContact(parentcsid, itemcsid, csid);
384     }
385     
386     /**
387      * Read contact.
388      *
389      * @param parentcsid
390      * @param itemspecifier (shortIdentifier)
391      * @param csid
392      * @return the client response
393      */
394     public ClientResponse<MultipartInput> readContactForNamedItem(
395                 String parentcsid,
396                 String itemspecifier,
397                 String csid){
398         return orgAuthorityProxy.readContactForNamedItem(parentcsid, itemspecifier, csid);
399     }
400
401     /**
402      * Read contact.
403      *
404      * @param parentspecifier (shortIdentifier)
405      * @param itemcsid
406      * @param csid
407      * @return the client response
408      */
409     public ClientResponse<MultipartInput> readContactInNamedAuthority(
410                 String parentspecifier,
411                 String itemcsid,
412                 String csid){
413         return orgAuthorityProxy.readContactInNamedAuthority(parentspecifier, itemcsid, csid);
414     }
415
416     /**
417      * Read contact.
418      *
419      * @param parentspecifier (shortIdentifier)
420      * @param itemspecifier (shortIdentifier)
421      * @param csid
422      * @return the client response
423      */
424     public ClientResponse<MultipartInput> readContactForNamedItemInNamedAuthority(
425                 String parentspecifier,
426                 String itemspecifier,
427                 String csid){
428         return orgAuthorityProxy.readContactForNamedItemInNamedAuthority(parentspecifier, itemspecifier, csid);
429     }
430             
431
432     /**
433      * Read contact list.
434      *
435      * @param parentcsid the parentcsid
436      * @param itemcsid the itemcsid
437      * @return the client response
438      */
439     public ClientResponse<ContactsCommonList> readContactList(String parentcsid,
440             String itemcsid) {
441         return orgAuthorityProxy.readContactList(parentcsid, itemcsid);
442     }
443     
444     /**
445      * Read contact list.
446      *
447      * @param parentcsid
448      * @param itemspecifier (shortIdentifier)
449      * @return the client response
450      */
451     public ClientResponse<ContactsCommonList> readContactListForNamedItem(
452                 String parentcsid,
453                 String itemspecifier){
454         return orgAuthorityProxy.readContactList(parentcsid, itemspecifier);
455     }
456
457     /**
458      * Read contact list.
459      *
460      * @param parentspecifier (shortIdentifier)
461      * @param itemcsid
462      * @return the client response
463      */
464     public ClientResponse<ContactsCommonList> readContactListForItemInNamedAuthority(
465                 String parentspecifier,
466                 String itemcsid){
467         return orgAuthorityProxy.readContactList(parentspecifier, itemcsid);
468     }
469
470     /**
471      * Read contact list.
472      *
473      * @param parentspecifier (shortIdentifier)
474      * @param itemspecifier (shortIdentifier)
475      * @return the client response
476      */
477     public ClientResponse<ContactsCommonList> readContactListForNamedItemInNamedAuthority(
478                 String parentspecifier,
479                 String itemspecifier){
480         return orgAuthorityProxy.readContactList(parentspecifier, itemspecifier);
481     }
482             
483
484     /**
485      * Update contact.
486      *
487      * @param parentcsid the parentcsid
488      * @param itemcsid the itemcsid
489      * @param csid the csid
490      * @param multipart the multipart
491      * @return the client response
492      */
493     public ClientResponse<MultipartInput> updateContact(String parentcsid,
494             String itemcsid, String csid, MultipartOutput multipart) {
495         return orgAuthorityProxy.updateContact(parentcsid, itemcsid, csid, multipart);
496     }
497     
498     /**
499      * Update contact.
500      *
501      * @param parentcsid the parentcsid
502      * @param itemspecifier (shortIdentifier)
503      * @param csid the csid
504      * @param multipart the multipart
505      * @return the client response
506      */
507     public ClientResponse<MultipartInput> updateContactForNamedItem(
508                 String parentcsid,
509                 String itemspecifier,
510                 String csid,
511                 MultipartOutput multipart) {
512         return orgAuthorityProxy.updateContactForNamedItem(parentcsid, itemspecifier, csid, multipart);
513     }
514
515     /**
516      * Update contact.
517      *
518      * @param parentspecifier (shortIdentifier)
519      * @param itemcsid the itemcsid
520      * @param csid the csid
521      * @param multipart the multipart
522      * @return the client response
523      */
524     public ClientResponse<MultipartInput> updateContactInNamedAuthority(
525                 String parentspecifier,
526                 String itemcsid,
527                 String csid,
528                 MultipartOutput multipart) {
529         return orgAuthorityProxy.updateContactInNamedAuthority(parentspecifier, itemcsid, csid, multipart);
530     }
531
532     /**
533      * Update contact.
534      *
535      * @param parentspecifier (shortIdentifier)
536      * @param itemspecifier (shortIdentifier)
537      * @param csid the csid
538      * @param multipart the multipart
539      * @return the client response
540      */
541     public ClientResponse<MultipartInput> updateContactForNamedItemInNamedAuthority(
542                 String parentspecifier,
543                 String itemspecifier,
544                 String csid,
545                 MultipartOutput multipart) {
546         return orgAuthorityProxy.updateContactForNamedItemInNamedAuthority(parentspecifier, itemspecifier, csid, multipart);
547     }
548
549
550     /**
551      * Delete contact.
552      *
553      * @param parentcsid the parentcsid
554      * @param itemcsid the itemcsid
555      * @param csid the csid
556      * @return the client response
557      */
558     public ClientResponse<Response> deleteContact(String parentcsid,
559         String itemcsid, String csid) {
560         return orgAuthorityProxy.deleteContact(parentcsid,
561             itemcsid, csid);
562     }
563     
564     /**
565      * Delete contact.
566      *
567      * @param parentcsid the parentcsid
568      * @param itemspecifier (shortIdentifier)
569      * @param csid the csid
570      * @return the client response
571      */
572     public ClientResponse<Response> deleteContactForNamedItem(
573                 String parentcsid,
574                 String itemspecifier,
575                 String csid) {
576         return orgAuthorityProxy.deleteContactForNamedItem(parentcsid,
577                         itemspecifier, csid);
578     }
579
580     /**
581      * Delete contact.
582      *
583      * @param parentspecifier (shortIdentifier)
584      * @param itemcsid the itemcsid
585      * @param csid the csid
586      * @return the client response
587      */
588     public ClientResponse<Response> deleteContactInNamedAuthority(
589                 String parentspecifier,
590                 String itemcsid,
591                 String csid) {
592         return orgAuthorityProxy.deleteContactInNamedAuthority(parentspecifier,
593                         itemcsid, csid);
594     }
595
596     /**
597      * Delete contact.
598      *
599      * @param parentspecifier (shortIdentifier)
600      * @param itemspecifier (shortIdentifier)
601      * @param csid the csid
602      * @return the client response
603      */
604     public ClientResponse<Response> deleteContactForNamedItemInNamedAuthority(
605                 String parentspecifier,
606                 String itemspecifier,
607                 String csid) {
608         return orgAuthorityProxy.deleteContactForNamedItemInNamedAuthority(parentspecifier,
609                         itemspecifier, csid);
610     }
611
612 }