2 * This document is a part of the source code and related artifacts
3 * for CollectionSpace, an open source collections management system
4 * for museums and related institutions:
6 * http://www.collectionspace.org
7 * http://wiki.collectionspace.org
9 * Copyright 2009 University of California at Berkeley
11 * Licensed under the Educational Community License (ECL), Version 2.0.
12 * You may not use this file except in compliance with this License.
14 * You may obtain a copy of the ECL 2.0 License at
16 * https://source.collectionspace.org/collection-space/LICENSE.txt
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
24 package org.collectionspace.services.client;
26 import java.util.ArrayList;
27 import java.util.Collection;
28 import java.util.List;
29 import org.collectionspace.services.authorization.PermissionRole;
30 import org.collectionspace.services.authorization.PermissionValue;
31 import org.collectionspace.services.authorization.RoleValue;
32 import org.slf4j.Logger;
33 import org.slf4j.LoggerFactory;
39 public class PermissionRoleFactory {
41 static private final Logger logger = LoggerFactory.getLogger(PermissionRoleFactory.class);
44 * create permRolerole instance with permission as object and role as subject
46 * @param rvs roleValues
51 public static PermissionRole createPermissionRoleInstance(PermissionValue pv,
56 PermissionRole permRole = new PermissionRole();
57 //service consume is not required to provide subject as it is determined
59 // permRole.setSubject(SubjectType.ROLE);
61 ArrayList<PermissionValue> pvs = new ArrayList<PermissionValue>();
63 permRole.setPermission(pvs);
66 permRole.setRole(rvs);
74 * create permRolerole instance with role as object and permission as subject
76 * @param pvs permValues
81 public static PermissionRole createPermissionRoleInstance(RoleValue rv,
82 List<PermissionValue> pvs,
86 PermissionRole permRole = new PermissionRole();
87 //service consume is not required to provide subject as it is determined
89 // permRole.setSubject(SubjectType.ROLE);
91 ArrayList<RoleValue> rvs = new ArrayList<RoleValue>();
93 permRole.setRole(rvs);
96 permRole.setPermission(pvs);