]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
95b2195a12629e35a826a193a80cbd93ac144f09
[tmp/jakarta-migration.git] /
1 package org.collectionspace.services.client;
2
3 import javax.ws.rs.PathParam;
4 import javax.ws.rs.core.Response;
5
6 import org.collectionspace.services.common.authorityref.AuthorityRefList;
7 import org.collectionspace.services.contact.ContactsCommonList;
8 import org.collectionspace.services.organization.OrgauthoritiesCommonList;
9 import org.collectionspace.services.organization.OrganizationsCommonList;
10
11 import org.jboss.resteasy.client.ClientResponse;
12 import org.jboss.resteasy.client.ProxyFactory;
13 import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
14 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
15 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
16 import org.jboss.resteasy.spi.ResteasyProviderFactory;
17
18 /**
19  * A OrgAuthorityClient.
20
21  * @version $Revision:$
22  */
23 public class OrgAuthorityClient extends AbstractServiceClientImpl {
24
25     /* (non-Javadoc)
26      * @see org.collectionspace.services.client.AbstractServiceClientImpl#getServicePathComponent()
27      */
28     @Override
29     public String getServicePathComponent() {
30         return "orgauthorities";
31     }
32
33     public String getItemCommonPartName() {
34         return getCommonPartName("organizations");
35     }
36     /**
37      *
38      */
39     private static final OrgAuthorityClient instance = new OrgAuthorityClient();
40     /**
41      *
42      */
43     private OrgAuthorityProxy orgAuthorityProxy;
44
45     /**
46      *
47      * Default constructor for OrgAuthorityClient class.
48      *
49      */
50     public OrgAuthorityClient() {
51         ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
52         RegisterBuiltin.register(factory);
53         setProxy();
54     }
55
56     @Override
57     public CollectionSpaceProxy getProxy() {
58         return this.orgAuthorityProxy;
59     }    
60
61     /**
62      * allow to reset proxy as per security needs
63      */
64     public void setProxy() {
65         if (useAuth()) {
66             orgAuthorityProxy = ProxyFactory.create(OrgAuthorityProxy.class,
67                     getBaseURL(), getHttpClient());
68         } else {
69             orgAuthorityProxy = ProxyFactory.create(OrgAuthorityProxy.class,
70                     getBaseURL());
71         }
72     }
73
74     /**
75      * FIXME Comment this
76      *
77      * @return
78      */
79     public static OrgAuthorityClient getInstance() {
80         return instance;
81     }
82
83     /**
84      * @return
85      * @see org.collectionspace.services.client.OrgAuthorityProxy#readList()
86      */
87     public ClientResponse<OrgauthoritiesCommonList> readList() {
88         return orgAuthorityProxy.readList();
89     }
90
91     /**
92      * @param csid
93      * @return
94      * @see org.collectionspace.services.client.OrgAuthorityProxy#read(java.lang.String)
95      */
96     public ClientResponse<MultipartInput> read(String csid) {
97         return orgAuthorityProxy.read(csid);
98     }
99
100     /**
101      * @param name
102      * @return
103      * @see org.collectionspace.services.client.OrgAuthorityProxy#readByName(java.lang.String)
104      */
105     public ClientResponse<MultipartInput> readByName(String name) {
106         return orgAuthorityProxy.readByName(name);
107     }
108
109     /**
110      * @param orgAuthority
111      * @return
112      * @see org.collectionspace.services.client.OrgAuthorityProxy#createOrgAuthority(org.collectionspace.hello.OrgAuthority)
113      */
114     public ClientResponse<Response> create(MultipartOutput multipart) {
115         return orgAuthorityProxy.create(multipart);
116     }
117
118     /**
119      * @param csid
120      * @param orgAuthority
121      * @return
122      * @see org.collectionspace.services.client.OrgAuthorityProxy#updateOrgAuthority(java.lang.Long, org.collectionspace.hello.OrgAuthority)
123      */
124     public ClientResponse<MultipartInput> update(String csid, MultipartOutput multipart) {
125         return orgAuthorityProxy.update(csid, multipart);
126
127     }
128
129     /**
130      * @param csid
131      * @return
132      * @see org.collectionspace.services.client.OrgAuthorityProxy#deleteOrgAuthority(java.lang.Long)
133      */
134     public ClientResponse<Response> delete(String csid) {
135         return orgAuthorityProxy.delete(csid);
136     }
137
138     /**
139      * @return
140      * @see org.collectionspace.services.client.OrgAuthorityProxy#readItemList()
141      */
142     public ClientResponse<OrganizationsCommonList> readItemList(String vcsid) {
143         return orgAuthorityProxy.readItemList(vcsid);
144     }
145
146     /**
147      * @return
148      * @see org.collectionspace.services.client.OrgAuthorityProxy#readItemListForNamedAuthority()
149      */
150     public ClientResponse<OrganizationsCommonList> readItemListForNamedAuthority(String specifier) {
151         return orgAuthorityProxy.readItemListForNamedAuthority(specifier);
152     }
153
154     public ClientResponse<AuthorityRefList> getItemAuthorityRefs(String parentcsid, String csid) {
155         return orgAuthorityProxy.getItemAuthorityRefs(parentcsid, csid);
156     }
157
158     /**
159      * @param csid
160      * @return
161      * @see org.collectionspace.services.client.OrgAuthorityProxy#read(java.lang.String)
162      */
163     public ClientResponse<MultipartInput> readItem(String vcsid, String csid) {
164         return orgAuthorityProxy.readItem(vcsid, csid);
165     }
166
167     /**
168      * @param orgAuthority
169      * @return
170      * @see org.collectionspace.services.client.OrgAuthorityProxy#createOrgAuthority(org.collectionspace.hello.OrgAuthority)
171      */
172     public ClientResponse<Response> createItem(String vcsid, MultipartOutput multipart) {
173         return orgAuthorityProxy.createItem(vcsid, multipart);
174     }
175
176     /**
177      * @param csid
178      * @param orgAuthority
179      * @return
180      * @see org.collectionspace.services.client.OrgAuthorityProxy#updateOrgAuthority(java.lang.Long, org.collectionspace.hello.OrgAuthority)
181      */
182     public ClientResponse<MultipartInput> updateItem(String vcsid, String csid, MultipartOutput multipart) {
183         return orgAuthorityProxy.updateItem(vcsid, csid, multipart);
184
185     }
186
187     /**
188      * @param csid
189      * @return
190      * @see org.collectionspace.services.client.OrgAuthorityProxy#deleteOrgAuthority(java.lang.Long)
191      */
192     public ClientResponse<Response> deleteItem(String vcsid, String csid) {
193         return orgAuthorityProxy.deleteItem(vcsid, csid);
194     }
195
196     public ClientResponse<Response> createContact(String parentcsid,
197             String itemcsid, MultipartOutput multipart) {
198         return orgAuthorityProxy.createContact(parentcsid, itemcsid, multipart);
199     }
200
201     public ClientResponse<MultipartInput> readContact(String parentcsid,
202             String itemcsid, String csid) {
203         return orgAuthorityProxy.readContact(parentcsid, itemcsid, csid);
204     }
205
206     public ClientResponse<ContactsCommonList> readContactList(String parentcsid,
207             String itemcsid) {
208         return orgAuthorityProxy.readContactList(parentcsid, itemcsid);
209     }
210
211     public ClientResponse<MultipartInput> updateContact(String parentcsid,
212             String itemcsid, String csid, MultipartOutput multipart) {
213         return orgAuthorityProxy.updateContact(parentcsid, itemcsid, csid, multipart);
214     }
215
216     public ClientResponse<Response> deleteContact(String parentcsid,
217         String itemcsid, String csid) {
218         return orgAuthorityProxy.deleteContact(parentcsid,
219             itemcsid, csid);
220     }
221
222 }