Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.turbine.util.security
Class GroupSet

    java.lang.Object
      org.apache.turbine.util.security.SecuritySet<Group>
          org.apache.turbine.util.security.GroupSet

All Implemented Interfaces:
  Serializable, Iterable<Group>

    public class GroupSet

extends SecuritySet<Group>

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 1073174 2011-02-21 22:18:45Z 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(Collection<Group> groups)` Constructs a new GroupSet with specified contents.

Method Summary
`boolean` | `add(Collection<Group> 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` | `getGroupById(int groupId)` Returns a Group with the given id, if it is contained in this GroupSet.
`Group` | `getGroupByName(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.
`String` | `toString()` Print out a GroupSet as a String

Methods inherited from class org.apache.turbine.util.security.SecuritySet
`clear, containsId, containsName, 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(Collection<Group> 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(Collection<Group> 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.

### getGroupByName

    public Group getGroupByName(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 String toString()

  Print out a GroupSet as a String

  Overrides:
    `toString` in class `SecuritySet<Group>`
  Returns:
    The string representation of this Set.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2011 The Apache Software Foundation. All Rights Reserved.