2 * PermissionRoleClient.java
4 * {Purpose of This Class}
6 * {Other Notes Relating to This Class (Optional)}
9 * $LastChangedRevision: $
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:
16 * http://www.collectionspace.org
17 * http://wiki.collectionspace.org
19 * Copyright (C) 2009 {Contributing Institution}
21 * Licensed under the Educational Community License (ECL), Version 2.0.
22 * You may not use this file except in compliance with this License.
24 * You may obtain a copy of the ECL 2.0 License at
25 * https://source.collectionspace.org/collection-space/LICENSE.txt
27 package org.collectionspace.services.client;
29 import javax.ws.rs.core.Response;
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.client.core.executors.ApacheHttpClientExecutor;
37 import org.jboss.resteasy.spi.ResteasyProviderFactory;
40 * A PermissionRoleClient.
42 * @version $Revision:$
44 public class PermissionRoleClient extends AbstractServiceClientImpl {
46 /** The permission role proxy. */
47 private PermissionRoleProxy permissionRoleProxy;
52 public String getServicePathComponent() {
53 return "authorization/permissions";
58 * Default constructor for PermissionRoleClient class.
61 public PermissionRoleClient() {
62 ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
63 RegisterBuiltin.register(factory);
68 * @see org.collectionspace.services.client.CollectionSpaceClient#getProxy()
71 public CollectionSpaceProxy getProxy() {
72 return this.permissionRoleProxy;
76 * allow to reset proxy as per security needs.
78 public void setProxy() {
80 permissionRoleProxy = ProxyFactory.create(PermissionRoleProxy.class,
81 getBaseURL(), new ApacheHttpClientExecutor(getHttpClient()));
83 permissionRoleProxy = ProxyFactory.create(PermissionRoleProxy.class,
91 * @param csid the csid
92 * @param prcsid relationship does not have an id, junk is fine
93 * @return the client response
96 public ClientResponse<PermissionRole> read(String csid, String prcsid) {
97 return permissionRoleProxy.read(csid, prcsid);
103 * @param csid the csid
104 * @param prcsid relationship does not have an id, junk is fine
105 * @return the client response
108 public ClientResponse<PermissionRole> read(String csid) {
109 return permissionRoleProxy.read(csid);
115 * @param csid the csid
116 * @param permRole the perm role
117 * @return the client response
120 public ClientResponse<Response> create(String csid, PermissionRole permRole) {
121 return permissionRoleProxy.create(csid, permRole);
126 * Delete given relationships between given permission and role(s)
128 * @param csid the csid
129 * @param relationships to delete
133 public ClientResponse<Response> delete(String csid, PermissionRole permRole) {
134 return permissionRoleProxy.delete(csid, "delete", permRole);
138 public ClientResponse<Response> delete(String csid) {
139 return permissionRoleProxy.delete(csid);