2 * LocationAuthorityClient.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.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;
39 import org.jboss.resteasy.client.ClientResponse;
40 import org.jboss.resteasy.client.ProxyFactory;
41 import org.jboss.resteasy.client.core.executors.ApacheHttpClientExecutor;
42 import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
43 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
44 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
45 import org.jboss.resteasy.spi.ResteasyProviderFactory;
48 * The Class LocationAuthorityClient.
50 public class LocationAuthorityClient extends AbstractServiceClientImpl {
53 * @see org.collectionspace.services.client.BaseServiceClient#getServicePathComponent()
56 public String getServicePathComponent() {
57 return "locationauthorities";
61 * Gets the item common part name.
63 * @return the item common part name
65 public String getItemCommonPartName() {
66 return getCommonPartName("locations");
69 /** The location authority proxy. */
70 // private static final LocationAuthorityClient instance = new LocationAuthorityClient();
75 private LocationAuthorityProxy locationAuthorityProxy;
78 * Instantiates a new location authority client.
80 public LocationAuthorityClient() {
81 ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
82 RegisterBuiltin.register(factory);
87 * @see org.collectionspace.services.client.CollectionSpaceClient#getProxy()
90 public CollectionSpaceProxy getProxy() {
91 return this.locationAuthorityProxy;
97 public void setProxy() {
99 locationAuthorityProxy = ProxyFactory.create(LocationAuthorityProxy.class,
100 getBaseURL(), new ApacheHttpClientExecutor(getHttpClient()));
102 locationAuthorityProxy = ProxyFactory.create(LocationAuthorityProxy.class,
110 * @return the client response
112 // public static LocationAuthorityClient getInstance() {
118 * @see org.collectionspace.services.client.LocationAuthorityProxy#readList()
120 public ClientResponse<LocationauthoritiesCommonList> readList() {
121 return locationAuthorityProxy.readList();
127 * @param csid the csid
128 * @return the client response
130 public ClientResponse<MultipartInput> read(String csid) {
131 return locationAuthorityProxy.read(csid);
137 * @param name the name
138 * @return the client response
140 public ClientResponse<MultipartInput> readByName(String name) {
141 return locationAuthorityProxy.readByName(name);
147 * @param multipart the multipart
148 * @return the client response
150 public ClientResponse<Response> create(MultipartOutput multipart) {
151 return locationAuthorityProxy.create(multipart);
157 * @param csid the csid
158 * @param multipart the multipart
159 * @return the client response
161 public ClientResponse<MultipartInput> update(String csid, MultipartOutput multipart) {
162 return locationAuthorityProxy.update(csid, multipart);
169 * @param csid the csid
170 * @return the client response
172 public ClientResponse<Response> delete(String csid) {
173 return locationAuthorityProxy.delete(csid);
177 * Read item list, filtering by partial term match, or keywords. Only one of
178 * partialTerm or keywords should be specified. If both are specified, keywords
181 * @param inAuthority the parent authority
182 * @param partialTerm A partial term on which to match,
183 * which will filter list results to return only matched resources.
184 * @param keywords A set of keywords on which to match,
185 * which will filter list results to return only matched resources.
186 * @return the client response
188 public ClientResponse<LocationsCommonList>
189 readItemList(String inAuthority, String partialTerm, String keywords) {
190 return locationAuthorityProxy.readItemList(inAuthority, partialTerm, keywords);
194 * Gets the referencing objects.
196 * @param parentcsid the parentcsid
197 * @param csid the csid
198 * @return the referencing objects
200 public ClientResponse<AuthorityRefDocList> getReferencingObjects(String parentcsid, String csid) {
201 return locationAuthorityProxy.getReferencingObjects(parentcsid, csid);
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
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
216 public ClientResponse<LocationsCommonList>
217 readItemListForNamedAuthority(String specifier, String partialTerm, String keywords) {
218 return locationAuthorityProxy.readItemListForNamedAuthority(specifier, partialTerm, keywords);
224 * @param vcsid the vcsid
225 * @param csid the csid
226 * @return the client response
228 public ClientResponse<MultipartInput> readItem(String vcsid, String csid) {
229 return locationAuthorityProxy.readItem(vcsid, csid);
235 * @param vcsid the vcsid
236 * @param multipart the multipart
237 * @return the client response
239 public ClientResponse<Response> createItem(String vcsid, MultipartOutput multipart) {
240 return locationAuthorityProxy.createItem(vcsid, multipart);
246 * @param vcsid the vcsid
247 * @param csid the csid
248 * @param multipart the multipart
249 * @return the client response
251 public ClientResponse<MultipartInput> updateItem(String vcsid, String csid, MultipartOutput multipart) {
252 return locationAuthorityProxy.updateItem(vcsid, csid, multipart);
259 * @param vcsid the vcsid
260 * @param csid the csid
261 * @return the client response
263 public ClientResponse<Response> deleteItem(String vcsid, String csid) {
264 return locationAuthorityProxy.deleteItem(vcsid, csid);
268 * Creates the contact.
270 * @param parentcsid the parentcsid
271 * @param itemcsid the itemcsid
272 * @param multipart the multipart
273 * @return the client response
275 public ClientResponse<Response> createContact(String parentcsid,
276 String itemcsid, MultipartOutput multipart) {
277 return locationAuthorityProxy.createContact(parentcsid, itemcsid, multipart);
283 * @param parentcsid the parentcsid
284 * @param itemcsid the itemcsid
285 * @param csid the csid
286 * @return the client response
288 public ClientResponse<MultipartInput> readContact(String parentcsid,
289 String itemcsid, String csid) {
290 return locationAuthorityProxy.readContact(parentcsid, itemcsid, csid);
296 * @param parentcsid the parentcsid
297 * @param itemcsid the itemcsid
298 * @return the client response
300 public ClientResponse<ContactsCommonList> readContactList(String parentcsid,
302 return locationAuthorityProxy.readContactList(parentcsid, itemcsid);
308 * @param parentcsid the parentcsid
309 * @param itemcsid the itemcsid
310 * @param csid the csid
311 * @param multipart the multipart
312 * @return the client response
314 public ClientResponse<MultipartInput> updateContact(String parentcsid,
315 String itemcsid, String csid, MultipartOutput multipart) {
316 return locationAuthorityProxy.updateContact(parentcsid, itemcsid, csid, multipart);
322 * @param parentcsid the parentcsid
323 * @param itemcsid the itemcsid
324 * @param csid the csid
325 * @return the client response
327 public ClientResponse<Response> deleteContact(String parentcsid,
328 String itemcsid, String csid) {
329 return locationAuthorityProxy.deleteContact(parentcsid,