Class Group

java.lang.Object
com.kheops.jmap.server.security.Group
All Implemented Interfaces:
com.k2.security.acl.Group, Serializable, Comparable<Group>, Principal
Direct Known Subclasses:
AclGroup

public class Group extends Object implements com.k2.security.acl.Group, Serializable, Comparable<Group>
This class encapsulates the concept of group of users. It implements Group and Comparable
See Also:
  • Constructor Details

    • Group

      public Group(String name)
      Constructs a new instance of Group having the specified name
  • Method Details

    • getName

      public String getName()
      Gets the name of the group
      Specified by:
      getName in interface Principal
      Returns:
      name
    • toString

      public String toString()
      Overrides the toString method
      Specified by:
      toString in interface Principal
      Overrides:
      toString in class Object
      Returns:
      a String containing the name
    • addMember

      public boolean addMember(Principal principal)
      Adds the specified member to the group.
      Specified by:
      addMember in interface com.k2.security.acl.Group
      Parameters:
      principal - the user to add to this group.
      Returns:
      true if the member was successfully added, false if the principal was already a member.
    • removeMember

      public boolean removeMember(Principal user)
      Removes the specified member from the group.
      Specified by:
      removeMember in interface com.k2.security.acl.Group
      Parameters:
      user - the principal to remove from this group.
      Returns:
      true if the principal was removed, or false if the principal was not a member.
    • isMember

      public boolean isMember(Principal member)
      Returns true if the passed principal is a member of the group. This method does a recursive search, so if a principal belongs to a group which is a member of this group, true is returned.
      Specified by:
      isMember in interface com.k2.security.acl.Group
      Parameters:
      member - the principal whose membership is to be checked.
      Returns:
      true if the principal is a member of this group, false otherwise.
    • members

      public Enumeration<User> members()
      Returns an enumeration of the members in the group. The returned objects can be instances of either Principal or Group (which is a subclass of Principal).
      Specified by:
      members in interface com.k2.security.acl.Group
      Returns:
      an enumeration of the group members.
    • getMembers

      public User[] getMembers()
      Gets the members of the group
      Returns:
      User array containing all the users of the group
    • getGroupInfo

      public GroupInfo getGroupInfo()
      Returns a UserInfo instance for ths group. Only username will be initialized in returned instance.
      Returns:
      a new UserInfo instance for this group
    • hashCode

      public int hashCode()
      Gets the hashCode of the name of the group plus a prefix indicating that it's a group (needed to differentiate it from a user with the same name)
      Specified by:
      hashCode in interface Principal
      Overrides:
      hashCode in class Object
      Returns:
      the hash code value
    • equals

      public boolean equals(Object o)
      Checks if an object instance is equal to the current group. The object must be an instance of Group and have an equivalent name in order to be considered equal
      Specified by:
      equals in interface Principal
      Overrides:
      equals in class Object
      Parameters:
      o - the object instance
      Returns:
      true if the object is equal, false otherwise
    • compareTo

      public int compareTo(Group group)
      Compares this object with the specified group for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

      It overrides the compareTo from the Comparable interface If the object is null, the method returns -1

      Specified by:
      compareTo in interface Comparable<Group>
      Parameters:
      group - the group to ne compared with.
      Returns:
      the corresponding integer value
      See Also:
    • validateObjectImpl

      public void validateObjectImpl()