1 package org.apache.fulcrum.security.model.turbine.entity.impl;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import java.util.HashSet;
23 import java.util.Set;
24
25 import org.apache.fulcrum.security.entity.impl.SecurityEntityImpl;
26 import org.apache.fulcrum.security.model.turbine.entity.TurbineUserGroupRole;
27 import org.apache.fulcrum.security.model.turbine.entity.TurbineUserGroupRoleEntity;
28
29 /**
30 * Represents the "turbine" model where permissions are in a many to many
31 * relationship to roles, roles are related to groups are related to users, all
32 * in many to many relationships.
33 *
34 * @author <a href="mailto:epugh@upstate.com">Eric Pugh </a>
35 * @version $Id: TurbineGroup.java 223081 2004-10-07 15:11:58Z epugh $
36 */
37 public abstract class AbstractTurbineSecurityEntityImpl extends SecurityEntityImpl implements TurbineUserGroupRoleEntity
38 {
39 /**
40 *
41 */
42 private static final long serialVersionUID = 1L;
43 private Set<? extends TurbineUserGroupRole> userGroupRoleSet = new HashSet<TurbineUserGroupRole>();
44
45 /**
46 * Get the User/Group/Role set associated with this entity
47 *
48 * @return a set of User/Group/Role relations
49 */
50 @SuppressWarnings("unchecked")
51 public <T extends TurbineUserGroupRole> Set<T> getUserGroupRoleSet()
52 {
53 return (Set<T>) userGroupRoleSet;
54 }
55
56 /**
57 * Get the User/Group/Role set associated with this entity
58 *
59 * @param userGroupRoleSet
60 * a set of User/Group/Role relations
61 */
62 public <T extends TurbineUserGroupRole> void setUserGroupRoleSet(Set<T> userGroupRoleSet)
63 {
64 this.userGroupRoleSet = userGroupRoleSet;
65 }
66
67 /**
68 * Add a User/Group/Role relation to this entity
69 *
70 * @param userGroupRole
71 * a User/Group/Role relation to add
72 */
73 public void addUserGroupRole(TurbineUserGroupRole userGroupRole)
74 {
75 getUserGroupRoleSet().add(userGroupRole);
76 }
77
78 /**
79 * Remove a User/Group/Role relation from this entity
80 *
81 * @param userGroupRole
82 * a User/Group/Role relation to remove
83 */
84 public void removeUserGroupRole(TurbineUserGroupRole userGroupRole)
85 {
86 getUserGroupRoleSet().remove(userGroupRole);
87 }
88 }