]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
225bc959f7a8892f740b0534b7ba2d726c6d88be
[tmp/jakarta-migration.git] /
1 package org.collectionspace.services.client;
2
3 import javax.ws.rs.core.Response;
4
5 import org.collectionspace.services.organization.OrgauthoritiesCommonList;
6 import org.collectionspace.services.organization.OrganizationsCommonList;
7
8 import org.jboss.resteasy.client.ClientResponse;
9 import org.jboss.resteasy.client.ProxyFactory;
10 import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
11 import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
12 import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
13 import org.jboss.resteasy.spi.ResteasyProviderFactory;
14
15 /**
16  * A OrgAuthorityClient.
17
18  * @version $Revision:$
19  */
20 public class OrgAuthorityClient extends AbstractServiceClientImpl {
21
22     /* (non-Javadoc)
23      * @see org.collectionspace.services.client.AbstractServiceClientImpl#getServicePathComponent()
24      */
25     @Override
26     public String getServicePathComponent() {
27         return "orgauthorities";
28     }
29
30     public String getItemCommonPartName() {
31         return getCommonPartName("organizations");
32     }
33     /**
34      *
35      */
36     private static final OrgAuthorityClient instance = new OrgAuthorityClient();
37     /**
38      *
39      */
40     private OrgAuthorityProxy orgAuthorityProxy;
41
42     /**
43      *
44      * Default constructor for OrgAuthorityClient class.
45      *
46      */
47     public OrgAuthorityClient() {
48         ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
49         RegisterBuiltin.register(factory);
50         setProxy();
51     }
52
53     /**
54      * allow to reset proxy as per security needs
55      */
56     public void setProxy() {
57         if (useAuth()) {
58             orgAuthorityProxy = ProxyFactory.create(OrgAuthorityProxy.class,
59                     getBaseURL(), getHttpClient());
60         } else {
61             orgAuthorityProxy = ProxyFactory.create(OrgAuthorityProxy.class,
62                     getBaseURL());
63         }
64     }
65
66     /**
67      * FIXME Comment this
68      *
69      * @return
70      */
71     public static OrgAuthorityClient getInstance() {
72         return instance;
73     }
74
75     /**
76      * @return
77      * @see org.collectionspace.services.client.OrgAuthorityProxy#readList()
78      */
79     public ClientResponse<OrgauthoritiesCommonList> readList() {
80         return orgAuthorityProxy.readList();
81     }
82
83     /**
84      * @param csid
85      * @return
86      * @see org.collectionspace.services.client.OrgAuthorityProxy#read(java.lang.String)
87      */
88     public ClientResponse<MultipartInput> read(String csid) {
89         return orgAuthorityProxy.read(csid);
90     }
91
92     /**
93      * @param orgAuthority
94      * @return
95      * @see org.collectionspace.services.client.OrgAuthorityProxy#createOrgAuthority(org.collectionspace.hello.OrgAuthority)
96      */
97     public ClientResponse<Response> create(MultipartOutput multipart) {
98         return orgAuthorityProxy.create(multipart);
99     }
100
101     /**
102      * @param csid
103      * @param orgAuthority
104      * @return
105      * @see org.collectionspace.services.client.OrgAuthorityProxy#updateOrgAuthority(java.lang.Long, org.collectionspace.hello.OrgAuthority)
106      */
107     public ClientResponse<MultipartInput> update(String csid, MultipartOutput multipart) {
108         return orgAuthorityProxy.update(csid, multipart);
109
110     }
111
112     /**
113      * @param csid
114      * @return
115      * @see org.collectionspace.services.client.OrgAuthorityProxy#deleteOrgAuthority(java.lang.Long)
116      */
117     public ClientResponse<Response> delete(String csid) {
118         return orgAuthorityProxy.delete(csid);
119     }
120
121     /**
122      * @return
123      * @see org.collectionspace.services.client.OrgAuthorityProxy#readItemList()
124      */
125     public ClientResponse<OrganizationsCommonList> readItemList(String vcsid) {
126         return orgAuthorityProxy.readItemList(vcsid);
127     }
128
129     /**
130      * @param csid
131      * @return
132      * @see org.collectionspace.services.client.OrgAuthorityProxy#read(java.lang.String)
133      */
134     public ClientResponse<MultipartInput> readItem(String vcsid, String csid) {
135         return orgAuthorityProxy.readItem(vcsid, csid);
136     }
137
138     /**
139      * @param orgAuthority
140      * @return
141      * @see org.collectionspace.services.client.OrgAuthorityProxy#createOrgAuthority(org.collectionspace.hello.OrgAuthority)
142      */
143     public ClientResponse<Response> createItem(String vcsid, MultipartOutput multipart) {
144         return orgAuthorityProxy.createItem(vcsid, multipart);
145     }
146
147     /**
148      * @param csid
149      * @param orgAuthority
150      * @return
151      * @see org.collectionspace.services.client.OrgAuthorityProxy#updateOrgAuthority(java.lang.Long, org.collectionspace.hello.OrgAuthority)
152      */
153     public ClientResponse<MultipartInput> updateItem(String vcsid, String csid, MultipartOutput multipart) {
154         return orgAuthorityProxy.updateItem(vcsid, csid, multipart);
155
156     }
157
158     /**
159      * @param csid
160      * @return
161      * @see org.collectionspace.services.client.OrgAuthorityProxy#deleteOrgAuthority(java.lang.Long)
162      */
163     public ClientResponse<Response> deleteItem(String vcsid, String csid) {
164         return orgAuthorityProxy.deleteItem(vcsid, csid);
165     }
166 }