001package org.apache.fulcrum.security.model.turbine.entity.impl; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import java.util.HashSet; 023import java.util.Set; 024 025import org.apache.fulcrum.security.entity.impl.SecurityEntityImpl; 026import org.apache.fulcrum.security.model.turbine.entity.TurbineUserGroupRole; 027import org.apache.fulcrum.security.model.turbine.entity.TurbineUserGroupRoleEntity; 028 029/** 030 * Represents the "turbine" model where permissions are in a many to many 031 * relationship to roles, roles are related to groups are related to users, all 032 * in many to many relationships. 033 * 034 * @author <a href="mailto:epugh@upstate.com">Eric Pugh </a> 035 * @version $Id: TurbineGroup.java 223081 2004-10-07 15:11:58Z epugh $ 036 */ 037public abstract class AbstractTurbineSecurityEntityImpl extends SecurityEntityImpl implements TurbineUserGroupRoleEntity 038{ 039 /** 040 * 041 */ 042 private static final long serialVersionUID = 1L; 043 private Set<? extends TurbineUserGroupRole> userGroupRoleSet = new HashSet<TurbineUserGroupRole>(); 044 045 /** 046 * Get the User/Group/Role set associated with this entity 047 * 048 * @return a set of User/Group/Role relations 049 */ 050 @SuppressWarnings("unchecked") 051 public <T extends TurbineUserGroupRole> Set<T> getUserGroupRoleSet() 052 { 053 return (Set<T>) userGroupRoleSet; 054 } 055 056 /** 057 * Get the User/Group/Role set associated with this entity 058 * 059 * @param userGroupRoleSet 060 * a set of User/Group/Role relations 061 */ 062 public <T extends TurbineUserGroupRole> void setUserGroupRoleSet(Set<T> userGroupRoleSet) 063 { 064 this.userGroupRoleSet = userGroupRoleSet; 065 } 066 067 /** 068 * Add a User/Group/Role relation to this entity 069 * 070 * @param userGroupRole 071 * a User/Group/Role relation to add 072 */ 073 public void addUserGroupRole(TurbineUserGroupRole userGroupRole) 074 { 075 getUserGroupRoleSet().add(userGroupRole); 076 } 077 078 /** 079 * Remove a User/Group/Role relation from this entity 080 * 081 * @param userGroupRole 082 * a User/Group/Role relation to remove 083 */ 084 public void removeUserGroupRole(TurbineUserGroupRole userGroupRole) 085 { 086 getUserGroupRoleSet().remove(userGroupRole); 087 } 088}