2 * OrgAuthorityClient.java
4 * {Purpose of This Class}
6 * {Other Notes Relating to This Class (Optional)}
9 * $LastChangedRevision: $
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:
16 * http://www.collectionspace.org
17 * http://wiki.collectionspace.org
19 * Copyright © 2009 {Contributing Institution}
21 * Licensed under the Educational Community License (ECL), Version 2.0.
22 * You may not use this file except in compliance with this License.
24 * You may obtain a copy of the ECL 2.0 License at
25 * https://source.collectionspace.org/collection-space/LICENSE.txt
27 package org.collectionspace.services.client;
29 //import javax.ws.rs.PathParam;
30 import javax.ws.rs.core.Response;
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;
38 import org.jboss.resteasy.client.ClientResponse;
39 import org.jboss.resteasy.client.ProxyFactory;
40 import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
41 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
42 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
43 import org.jboss.resteasy.spi.ResteasyProviderFactory;
46 * The Class OrgAuthorityClient.
48 public class OrgAuthorityClient extends AbstractServiceClientImpl {
51 * @see org.collectionspace.services.client.AbstractServiceClientImpl#getServicePathComponent()
54 public String getServicePathComponent() {
55 return "orgauthorities";
59 * Gets the item common part name.
61 * @return the item common part name
63 public String getItemCommonPartName() {
64 return getCommonPartName("organizations");
67 /** The Constant instance. */ //FIXME: This is wrong. There should NOT be a static instance of the OrgAuthorityClient class
68 // private static final OrgAuthorityClient instance = new OrgAuthorityClient();
70 /** The org authority proxy. */
71 private OrgAuthorityProxy orgAuthorityProxy;
74 * Instantiates a new org authority client.
76 public OrgAuthorityClient() {
77 ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
78 RegisterBuiltin.register(factory);
83 * @see org.collectionspace.services.client.CollectionSpaceClient#getProxy()
86 public CollectionSpaceProxy getProxy() {
87 return this.orgAuthorityProxy;
93 public void setProxy() {
95 orgAuthorityProxy = ProxyFactory.create(OrgAuthorityProxy.class,
96 getBaseURL(), getHttpClient());
98 orgAuthorityProxy = ProxyFactory.create(OrgAuthorityProxy.class,
104 * Gets the single instance of OrgAuthorityClient.
106 * @return single instance of OrgAuthorityClient //FIXME: This is wrong. There should NOT be a static instance of the client
108 // public static OrgAuthorityClient getInstance() {
115 * @return the client response
117 public ClientResponse<OrgauthoritiesCommonList> readList() {
118 return orgAuthorityProxy.readList();
124 * @param csid the csid
125 * @return the client response
127 public ClientResponse<MultipartInput> read(String csid) {
128 return orgAuthorityProxy.read(csid);
134 * @param name the name
135 * @return the client response
137 public ClientResponse<MultipartInput> readByName(String name) {
138 return orgAuthorityProxy.readByName(name);
144 * @param multipart the multipart
145 * @return the client response
147 public ClientResponse<Response> create(MultipartOutput multipart) {
148 return orgAuthorityProxy.create(multipart);
154 * @param csid the csid
155 * @param multipart the multipart
156 * @return the client response
158 public ClientResponse<MultipartInput> update(String csid, MultipartOutput multipart) {
159 return orgAuthorityProxy.update(csid, multipart);
166 * @param csid the csid
167 * @return the client response
170 public ClientResponse<Response> delete(String csid) {
171 return orgAuthorityProxy.delete(csid);
177 * @param vcsid the vcsid
178 * @return the client response
180 public ClientResponse<OrganizationsCommonList> readItemList(String vcsid) {
181 return orgAuthorityProxy.readItemList(vcsid);
185 * Gets the referencing objects.
187 * @param parentcsid the parentcsid
188 * @param csid the csid
189 * @return the referencing objects
191 public ClientResponse<AuthorityRefDocList> getReferencingObjects(String parentcsid, String csid) {
192 return orgAuthorityProxy.getReferencingObjects(parentcsid, csid);
197 * Read item list for named authority.
199 * @param specifier the specifier
200 * @return the client response
202 public ClientResponse<OrganizationsCommonList> readItemListForNamedAuthority(String specifier) {
203 return orgAuthorityProxy.readItemListForNamedAuthority(specifier);
207 * Gets the item authority refs.
209 * @param parentcsid the parentcsid
210 * @param csid the csid
211 * @return the item authority refs
213 public ClientResponse<AuthorityRefList> getItemAuthorityRefs(String parentcsid, String csid) {
214 return orgAuthorityProxy.getItemAuthorityRefs(parentcsid, csid);
220 * @param vcsid the vcsid
221 * @param csid the csid
222 * @return the client response
224 public ClientResponse<MultipartInput> readItem(String vcsid, String csid) {
225 return orgAuthorityProxy.readItem(vcsid, csid);
231 * @param vcsid the vcsid
232 * @param shortId the shortIdentifier
233 * @return the client response
235 public ClientResponse<MultipartInput> readNamedItem(String vcsid, String shortId) {
236 return orgAuthorityProxy.readNamedItem(vcsid, shortId);
240 * Read item in Named Authority.
242 * @param authShortId the shortIdentifier for the Authority
243 * @param csid the csid
244 * @return the client response
246 public ClientResponse<MultipartInput> readItemInNamedAuthority(String authShortId, String csid) {
247 return orgAuthorityProxy.readItemInNamedAuthority(authShortId, csid);
251 * Read named item in Named Authority.
253 * @param authShortId the shortIdentifier for the Authority
254 * @param itemShortId the shortIdentifier for the item
255 * @return the client response
257 public ClientResponse<MultipartInput> readNamedItemInNamedAuthority(String authShortId, String itemShortId) {
258 return orgAuthorityProxy.readNamedItem(authShortId, itemShortId);
264 * @param vcsid the vcsid
265 * @param multipart the multipart
266 * @return the client response
268 public ClientResponse<Response> createItem(String vcsid, MultipartOutput multipart) {
269 return orgAuthorityProxy.createItem(vcsid, multipart);
275 * @param vcsid the vcsid
276 * @param csid the csid
277 * @param multipart the multipart
278 * @return the client response
280 public ClientResponse<MultipartInput> updateItem(String vcsid, String csid, MultipartOutput multipart) {
281 return orgAuthorityProxy.updateItem(vcsid, csid, multipart);
288 * @param vcsid the vcsid
289 * @param csid the csid
290 * @return the client response
292 public ClientResponse<Response> deleteItem(String vcsid, String csid) {
293 return orgAuthorityProxy.deleteItem(vcsid, csid);
297 * Creates the contact.
299 * @param parentcsid the parentcsid
300 * @param itemcsid the itemcsid
301 * @param multipart the multipart
302 * @return the client response
304 public ClientResponse<Response> createContact(String parentcsid,
305 String itemcsid, MultipartOutput multipart) {
306 return orgAuthorityProxy.createContact(parentcsid, itemcsid, multipart);
312 * @param parentcsid the parentcsid
313 * @param itemcsid the itemcsid
314 * @param csid the csid
315 * @return the client response
317 public ClientResponse<MultipartInput> readContact(String parentcsid,
318 String itemcsid, String csid) {
319 return orgAuthorityProxy.readContact(parentcsid, itemcsid, csid);
325 * @param parentcsid the parentcsid
326 * @param itemcsid the itemcsid
327 * @return the client response
329 public ClientResponse<ContactsCommonList> readContactList(String parentcsid,
331 return orgAuthorityProxy.readContactList(parentcsid, itemcsid);
337 * @param parentcsid the parentcsid
338 * @param itemcsid the itemcsid
339 * @param csid the csid
340 * @param multipart the multipart
341 * @return the client response
343 public ClientResponse<MultipartInput> updateContact(String parentcsid,
344 String itemcsid, String csid, MultipartOutput multipart) {
345 return orgAuthorityProxy.updateContact(parentcsid, itemcsid, csid, multipart);
351 * @param parentcsid the parentcsid
352 * @param itemcsid the itemcsid
353 * @param csid the csid
354 * @return the client response
356 public ClientResponse<Response> deleteContact(String parentcsid,
357 String itemcsid, String csid) {
358 return orgAuthorityProxy.deleteContact(parentcsid,