]> git.aero2k.de Git - tmp/jakarta-migration.git/blob
6759755569ac53f708aabfcb07c19e9d62b59e34
[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 import org.apache.http.HttpStatus;
32 import org.collectionspace.services.authorization.PermissionRole;
33 import org.collectionspace.services.description.ServiceDescription;
34
35 // TODO: Auto-generated Javadoc
36 /**
37  * A RolePermissionClient.
38
39  * @version $Revision:$
40  */
41 public class RolePermissionClient extends AbstractServiceClientImpl<PermissionRole, PermissionRole, PermissionRole, RolePermissionProxy> {
42     
43         public RolePermissionClient() {
44                 super();
45         }
46
47     public RolePermissionClient(String clientPropertiesFilename) {
48                 super(clientPropertiesFilename);
49         }
50
51         @Override
52     public String getServiceName() { 
53         throw new UnsupportedOperationException(); //FIXME: REM - http://issues.collectionspace.org/browse/CSPACE-3498
54     }
55     
56     /* (non-Javadoc)
57      * @see 
58      */
59     @Override
60         public String getServicePathComponent() {
61         return "authorization/roles";
62     }
63     
64         @Override
65         public Class<RolePermissionProxy> getProxyClass() {
66                 return RolePermissionProxy.class;
67         }
68
69         /*
70          * CRUD+L Methods
71          */
72         
73     /**
74      * Read.
75      *
76      * @param csid the csid
77      * @return the client response
78      * @see
79      */
80     public Response read(String csid) {
81         return getProxy().read(csid);
82     }
83
84     /**
85      * Read.
86      *
87      * @param csid the csid
88      * @param prcsid the prcsid
89      * @return the client response
90      */
91     public Response read(String csid, String prcsid) {
92         return getProxy().read(csid, prcsid);
93     }
94
95     /**
96      * Creates the relationships.
97      *
98      * @param csid the csid
99      * @param permRole the perm role
100      * @return the client response
101      * @see
102      */
103     public Response create(String csid, PermissionRole permRole) {
104         return getProxy().create(csid, permRole);
105     }
106
107     /**
108      * delete given relationships between given role and permission(s).
109      *
110      * @param csid the csid
111      * @param permRole the perm role
112      * @return the client response
113      */
114     public Response delete(String csid, PermissionRole permRole) {
115         return getProxy().delete(csid, "delete", permRole);
116     }
117
118         @Override
119         public Response create(PermissionRole payload) {
120                 throw new UnsupportedOperationException(); //method not supported nor needed
121         }
122
123         @Override
124         public Response update(String csid,
125                         PermissionRole payload) {
126                 throw new UnsupportedOperationException(); //method not supported nor needed
127         }
128
129         @Override
130         public Response readList() {
131                 throw new UnsupportedOperationException(); //method not supported nor needed
132         }
133         
134         @Override
135         public ServiceDescription getServiceDescription() {
136                 ServiceDescription result = null;
137                 
138         Response res = getProxy().getServiceDescription();
139         if (res.getStatus() == HttpStatus.SC_OK) {
140                 result = (ServiceDescription) res.readEntity(ServiceDescription.class);
141         }
142         
143         return result;
144         }
145 }