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