]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
1406a7ee50e4a5ee5d9a2e0b2ff5dce6ab48e14d
[tmp/jakarta-migration.git] /
1 /**     
2  * PermissionRoleClient.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.core.Response;
30
31
32 import org.collectionspace.services.authorization.PermissionRole;
33 import org.jboss.resteasy.client.ProxyFactory;
34 import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
35 import org.jboss.resteasy.client.ClientResponse;
36 import org.jboss.resteasy.spi.ResteasyProviderFactory;
37
38 /**
39  * A PermissionRoleClient.
40
41  * @version $Revision:$
42  */
43 public class PermissionRoleClient extends AbstractServiceClientImpl {
44
45     /**
46      *
47      */
48     private PermissionRoleProxy permissionRoleProxy;
49
50     /* (non-Javadoc)
51      * @see 
52      */
53     public String getServicePathComponent() {
54         return "authorization/permissions";
55     }
56
57     /**
58      *
59      * Default constructor for PermissionRoleClient class.
60      *
61      */
62     public PermissionRoleClient() {
63         ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
64         RegisterBuiltin.register(factory);
65         setProxy();
66     }
67
68     @Override
69     public CollectionSpaceProxy getProxy() {
70         return this.permissionRoleProxy;
71     }    
72
73     /**
74      * allow to reset proxy as per security needs
75      */
76     public void setProxy() {
77         if (useAuth()) {
78             permissionRoleProxy = ProxyFactory.create(PermissionRoleProxy.class,
79                     getBaseURL(), getHttpClient());
80         } else {
81             permissionRoleProxy = ProxyFactory.create(PermissionRoleProxy.class,
82                     getBaseURL());
83         }
84     }
85
86
87     /**
88      * @param csid
89      * @param prcsid relationship does not have an id, junk is fine
90      * @return
91      * @see 
92      */
93     public ClientResponse<PermissionRole> read(String csid, String prcsid) {
94         return permissionRoleProxy.read(csid, prcsid);
95     }
96
97     /**
98      * @param permRole
99      * @return
100      * @see 
101      */
102     public ClientResponse<Response> create(String csid, PermissionRole permRole) {
103         return permissionRoleProxy.create(csid, permRole);
104     }
105
106
107     /**
108      * @param csid
109      * @param prcsid relationship does not have an id, junk is fine
110      * @return
111      * @see 
112      */
113     public ClientResponse<Response> delete(String csid, String prcsid) {
114         return permissionRoleProxy.delete(csid, prcsid);
115     }
116 }