org.apache.turbine.util.security
Class GroupSet

java.lang.Object
  extended byorg.apache.turbine.util.security.SecuritySet
      extended byorg.apache.turbine.util.security.GroupSet
All Implemented Interfaces:
java.io.Serializable

public class GroupSet
extends SecuritySet

This class represents a set of Groups. It's useful for building administration UI. It enforces that only Group objects are allowed in the set and only relevant methods are available.

Version:
$Id: GroupSet.java 534527 2007-05-02 16:10:59Z tv $
Author:
John D. McNally, Brett McLaughlin, Marco Knüttel, Henning P. Schmiedehausen
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.turbine.util.security.SecuritySet
idMap, nameMap
 
Constructor Summary
GroupSet()
          Constructs an empty GroupSet
GroupSet(java.util.Collection groups)
          Constructs a new GroupSet with specified contents.
 
Method Summary
 boolean add(java.util.Collection groups)
          Adds the Groups in a Collection to this GroupSet.
 boolean add(Group group)
          Adds a Group to this GroupSet.
 boolean add(GroupSet groupSet)
          Adds the Groups in another GroupSet to this GroupSet.
 boolean contains(Group group)
          Checks whether this GroupSet contains a Group.
 Group getGroup(java.lang.String groupName)
          Deprecated. Use getGroupByName instead.
 Group getGroupById(int groupId)
          Returns a Group with the given id, if it is contained in this GroupSet.
 Group getGroupByName(java.lang.String groupName)
          Returns a Group with the given name, if it is contained in this GroupSet.
 Group[] getGroupsArray()
          Returns an Array of Groups in this GroupSet.
 boolean remove(Group group)
          Removes a Group from this GroupSet.
 java.lang.String toString()
          Print out a GroupSet as a String
 
Methods inherited from class org.apache.turbine.util.security.SecuritySet
clear, contains, containsId, containsName, elements, getIds, getNames, getSet, iterator, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GroupSet

public GroupSet()
Constructs an empty GroupSet


GroupSet

public GroupSet(java.util.Collection groups)
Constructs a new GroupSet with specified contents. If the given collection contains multiple objects that are identical WRT equals() method, some objects will be overwritten.

Parameters:
groups - A collection of groups to be contained in the set.
Method Detail

add

public boolean add(Group group)
Adds a Group to this GroupSet.

Parameters:
group - A Group.
Returns:
True if Group was added; false if GroupSet already contained the Group.

add

public boolean add(java.util.Collection groups)
Adds the Groups in a Collection to this GroupSet.

Parameters:
groups - A Collection of Groups.
Returns:
True if this GroupSet changed as a result; false if no change to this GroupSet occurred (this GroupSet already contained all members of the added GroupSet).

add

public boolean add(GroupSet groupSet)
Adds the Groups in another GroupSet to this GroupSet.

Parameters:
groupSet - A GroupSet.
Returns:
True if this GroupSet changed as a result; false if no change to this GroupSet occurred (this GroupSet already contained all members of the added GroupSet).

remove

public boolean remove(Group group)
Removes a Group from this GroupSet.

Parameters:
group - A Group.
Returns:
True if this GroupSet contained the Group before it was removed.

contains

public boolean contains(Group group)
Checks whether this GroupSet contains a Group.

Parameters:
group - A Group.
Returns:
True if this GroupSet contains the Group, false otherwise.

getGroup

public Group getGroup(java.lang.String groupName)
Deprecated. Use getGroupByName instead.

Returns a Group with the given name, if it is contained in this GroupSet.

Parameters:
groupName - Name of Group.
Returns:
Group if argument matched a Group in this GroupSet; null if no match.

getGroupByName

public Group getGroupByName(java.lang.String groupName)
Returns a Group with the given name, if it is contained in this GroupSet.

Parameters:
groupName - Name of Group.
Returns:
Group if argument matched a Group in this GroupSet; null if no match.

getGroupById

public Group getGroupById(int groupId)
Returns a Group with the given id, if it is contained in this GroupSet.

Parameters:
groupId - Id of the group
Returns:
Group if argument matched a Group in this GroupSet; null if no match.

getGroupsArray

public Group[] getGroupsArray()
Returns an Array of Groups in this GroupSet.

Returns:
An Array of Group objects.

toString

public java.lang.String toString()
Print out a GroupSet as a String

Overrides:
toString in class SecuritySet
Returns:
The string representation of this Set.


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.