]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
f83f37aa2594dee0f739c7b9f1101ec5d1420cd8
[tmp/jakarta-migration.git] /
1 /**     
2  * CollectionObjectClient.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 (C) 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.GET;
30 import javax.ws.rs.Produces;
31 import javax.ws.rs.QueryParam;
32 import javax.ws.rs.core.Context;
33 import javax.ws.rs.core.Response;
34 import javax.ws.rs.core.UriInfo;
35
36 import org.collectionspace.services.jaxb.AbstractCommonList;
37 import org.collectionspace.services.collectionobject.CollectionobjectsCommonList;
38 import org.collectionspace.services.common.authorityref.AuthorityRefList;
39 //import org.collectionspace.services.common.context.ServiceContext;
40 //import org.collectionspace.services.common.query.IQueryManager;
41 import org.jboss.resteasy.client.ProxyFactory;
42 import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
43 import org.jboss.resteasy.client.ClientResponse;
44 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
45 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
46 import org.jboss.resteasy.spi.ResteasyProviderFactory;
47
48 /**
49  * The Class CollectionObjectClient.
50  * FIXME: http://issues.collectionspace.org/browse/CSPACE-1684
51  */
52 public class CollectionObjectClient extends AbstractServiceClientImpl {
53
54     /** The collection object proxy. */
55     private CollectionObjectProxy collectionObjectProxy;
56     
57         /* (non-Javadoc)
58          * @see org.collectionspace.services.client.BaseServiceClient#getServicePathComponent()
59          */
60         @Override
61     public String getServicePathComponent() {
62                 return "collectionobjects";
63         }
64
65     /**
66      * Instantiates a new collection object client.
67      */
68     public CollectionObjectClient() {
69         ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
70         RegisterBuiltin.register(factory);
71         setProxy();
72     }
73     
74     @Override
75     public CollectionSpaceProxy getProxy() {
76         return this.collectionObjectProxy;
77     }
78
79     /**
80      * Sets the proxy.
81      */
82     public void setProxy() {
83         if(useAuth()){
84             collectionObjectProxy = ProxyFactory.create(CollectionObjectProxy.class,
85                     getBaseURL(), getHttpClient());
86         }else{
87             collectionObjectProxy = ProxyFactory.create(CollectionObjectProxy.class,
88                     getBaseURL());
89         }
90     }
91
92     /**
93      * Read list.
94      * 
95      * @see org.collectionspace.services.client.CollectionObjectProxy#readList()
96      * @return the client response< collectionobjects common list>
97      */
98     public ClientResponse<CollectionobjectsCommonList> readList() {
99         return collectionObjectProxy.readList();
100
101     }
102
103     @Override
104     public ClientResponse<AbstractCommonList> readList(String pageSize,
105                 String pageNumber) {
106         return collectionObjectProxy.readList(pageSize, pageNumber);
107
108     }
109     
110     /**
111      * Roundtrip.
112      * 
113      * This is an intentionally empty method that is used for performance test 
114      * to get a rough time estimate of the client to server response-request overhead.
115      * 
116      * @see org.collectionspace.services.client.CollectionObjectProxy#roundtrip()
117      * @return the client response< response>
118      */
119     public ClientResponse<Response> roundtrip() {
120         return collectionObjectProxy.roundtrip();
121     }
122     
123     /**
124      * Keyword search.
125      * 
126      * @param keywords the keywords
127      * 
128      * @see org.collectionspace.services.client.CollectionObjectProxy#keywordSearch()
129      * @return the client response< collectionobjects common list>
130      */
131     public ClientResponse<CollectionobjectsCommonList> keywordSearch(String keywords) {
132         return collectionObjectProxy.keywordSearch(keywords);
133
134     }
135     
136     /**
137      * Read.
138      * 
139      * @param csid the csid
140      * 
141      * @see org.collectionspace.services.client.CollectionObjectProxy#keywordSearch()
142      * @return the client response< multipart input>
143      */
144     public ClientResponse<MultipartInput> read(String csid) {
145         return collectionObjectProxy.read(csid);
146     }
147
148     /**
149      * @param csid
150      * @return
151      * @see org.collectionspace.services.client.CollectionObjectProxy#getAuthorityRefs(java.lang.String)
152      */
153     public ClientResponse<AuthorityRefList> getAuthorityRefs(String csid) {
154         return collectionObjectProxy.getAuthorityRefs(csid);
155     }
156
157
158     /**
159      * Creates the.
160      * 
161      * @param multipart the multipart
162      * 
163      * @see org.collectionspace.services.client.CollectionObjectProxy#create()
164      * @return the client response< response>
165      */
166     public ClientResponse<Response> create(MultipartOutput multipart) {
167         return collectionObjectProxy.create(multipart);
168     }
169
170     /**
171      * Update.
172      * 
173      * @param csid the csid
174      * @param multipart the multipart
175      * 
176      * @see org.collectionspace.services.client.CollectionObjectProxy#update()
177      * @return the client response< multipart input>
178      */
179     public ClientResponse<MultipartInput> update(String csid, MultipartOutput multipart) {
180         return collectionObjectProxy.update(csid, multipart);
181     }
182
183     /**
184      * Delete.
185      * 
186      * @param csid the csid
187      * 
188      * @see org.collectionspace.services.client.CollectionObjectProxy#delete()
189      * @return the client response< response>
190      */
191     public ClientResponse<Response> delete(String csid) {
192         return collectionObjectProxy.delete(csid);
193     }
194 }