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.AuthorityRefList;
33 import org.collectionspace.services.contact.ContactsCommonList;
34 import org.collectionspace.services.organization.OrgauthoritiesCommonList;
35 import org.collectionspace.services.organization.OrganizationsCommonList;
37 import org.jboss.resteasy.client.ClientResponse;
38 import org.jboss.resteasy.client.ProxyFactory;
39 import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
40 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
41 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
42 import org.jboss.resteasy.spi.ResteasyProviderFactory;
45 * The Class OrgAuthorityClient.
47 public class OrgAuthorityClient extends AbstractServiceClientImpl {
50 * @see org.collectionspace.services.client.AbstractServiceClientImpl#getServicePathComponent()
53 public String getServicePathComponent() {
54 return "orgauthorities";
58 * Gets the item common part name.
60 * @return the item common part name
62 public String getItemCommonPartName() {
63 return getCommonPartName("organizations");
66 /** The Constant instance. */ //FIXME: This is wrong. There should NOT be a static instance of the OrgAuthorityClient class
67 // private static final OrgAuthorityClient instance = new OrgAuthorityClient();
69 /** The org authority proxy. */
70 private OrgAuthorityProxy orgAuthorityProxy;
73 * Instantiates a new org authority client.
75 public OrgAuthorityClient() {
76 ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
77 RegisterBuiltin.register(factory);
82 * @see org.collectionspace.services.client.CollectionSpaceClient#getProxy()
85 public CollectionSpaceProxy getProxy() {
86 return this.orgAuthorityProxy;
92 public void setProxy() {
94 orgAuthorityProxy = ProxyFactory.create(OrgAuthorityProxy.class,
95 getBaseURL(), getHttpClient());
97 orgAuthorityProxy = ProxyFactory.create(OrgAuthorityProxy.class,
103 * Gets the single instance of OrgAuthorityClient.
105 * @return single instance of OrgAuthorityClient //FIXME: This is wrong. There should NOT be a static instance of the client
107 // public static OrgAuthorityClient getInstance() {
114 * @return the client response
116 public ClientResponse<OrgauthoritiesCommonList> readList() {
117 return orgAuthorityProxy.readList();
123 * @param csid the csid
124 * @return the client response
126 public ClientResponse<MultipartInput> read(String csid) {
127 return orgAuthorityProxy.read(csid);
133 * @param name the name
134 * @return the client response
136 public ClientResponse<MultipartInput> readByName(String name) {
137 return orgAuthorityProxy.readByName(name);
143 * @param multipart the multipart
144 * @return the client response
146 public ClientResponse<Response> create(MultipartOutput multipart) {
147 return orgAuthorityProxy.create(multipart);
153 * @param csid the csid
154 * @param multipart the multipart
155 * @return the client response
157 public ClientResponse<MultipartInput> update(String csid, MultipartOutput multipart) {
158 return orgAuthorityProxy.update(csid, multipart);
165 * @param csid the csid
166 * @return the client response
168 public ClientResponse<Response> delete(String csid) {
169 return orgAuthorityProxy.delete(csid);
175 * @param vcsid the vcsid
176 * @return the client response
178 public ClientResponse<OrganizationsCommonList> readItemList(String vcsid) {
179 return orgAuthorityProxy.readItemList(vcsid);
183 * Read item list for named authority.
185 * @param specifier the specifier
186 * @return the client response
188 public ClientResponse<OrganizationsCommonList> readItemListForNamedAuthority(String specifier) {
189 return orgAuthorityProxy.readItemListForNamedAuthority(specifier);
193 * Gets the item authority refs.
195 * @param parentcsid the parentcsid
196 * @param csid the csid
197 * @return the item authority refs
199 public ClientResponse<AuthorityRefList> getItemAuthorityRefs(String parentcsid, String csid) {
200 return orgAuthorityProxy.getItemAuthorityRefs(parentcsid, csid);
206 * @param vcsid the vcsid
207 * @param csid the csid
208 * @return the client response
210 public ClientResponse<MultipartInput> readItem(String vcsid, String csid) {
211 return orgAuthorityProxy.readItem(vcsid, csid);
217 * @param vcsid the vcsid
218 * @param multipart the multipart
219 * @return the client response
221 public ClientResponse<Response> createItem(String vcsid, MultipartOutput multipart) {
222 return orgAuthorityProxy.createItem(vcsid, multipart);
228 * @param vcsid the vcsid
229 * @param csid the csid
230 * @param multipart the multipart
231 * @return the client response
233 public ClientResponse<MultipartInput> updateItem(String vcsid, String csid, MultipartOutput multipart) {
234 return orgAuthorityProxy.updateItem(vcsid, csid, multipart);
241 * @param vcsid the vcsid
242 * @param csid the csid
243 * @return the client response
245 public ClientResponse<Response> deleteItem(String vcsid, String csid) {
246 return orgAuthorityProxy.deleteItem(vcsid, csid);
250 * Creates the contact.
252 * @param parentcsid the parentcsid
253 * @param itemcsid the itemcsid
254 * @param multipart the multipart
255 * @return the client response
257 public ClientResponse<Response> createContact(String parentcsid,
258 String itemcsid, MultipartOutput multipart) {
259 return orgAuthorityProxy.createContact(parentcsid, itemcsid, multipart);
265 * @param parentcsid the parentcsid
266 * @param itemcsid the itemcsid
267 * @param csid the csid
268 * @return the client response
270 public ClientResponse<MultipartInput> readContact(String parentcsid,
271 String itemcsid, String csid) {
272 return orgAuthorityProxy.readContact(parentcsid, itemcsid, csid);
278 * @param parentcsid the parentcsid
279 * @param itemcsid the itemcsid
280 * @return the client response
282 public ClientResponse<ContactsCommonList> readContactList(String parentcsid,
284 return orgAuthorityProxy.readContactList(parentcsid, itemcsid);
290 * @param parentcsid the parentcsid
291 * @param itemcsid the itemcsid
292 * @param csid the csid
293 * @param multipart the multipart
294 * @return the client response
296 public ClientResponse<MultipartInput> updateContact(String parentcsid,
297 String itemcsid, String csid, MultipartOutput multipart) {
298 return orgAuthorityProxy.updateContact(parentcsid, itemcsid, csid, multipart);
304 * @param parentcsid the parentcsid
305 * @param itemcsid the itemcsid
306 * @param csid the csid
307 * @return the client response
309 public ClientResponse<Response> deleteContact(String parentcsid,
310 String itemcsid, String csid) {
311 return orgAuthorityProxy.deleteContact(parentcsid,