br.com.arsmachina.authentication.entity
Class PermissionGroup

java.lang.Object
  extended by br.com.arsmachina.authentication.entity.PermissionGroup
All Implemented Interfaces:
Serializable, Comparable<Permission>

public final class PermissionGroup
extends Object
implements Comparable<Permission>, Serializable

Class that represents a group of permissions.

Author:
Thiago H. de Paula Figueiredo
See Also:
Serialized Form

Field Summary
static String ALL_USERS_PERMISSION_GROUP_NAME
          Name of the permission group that contains all users.
static int MAXIMUM_NAME_LENGTH
          Maximum name length.
static int MINIMUM_NAME_LENGTH
          Minimum name length.
 
Constructor Summary
PermissionGroup()
          No-arg constructor.
PermissionGroup(String name)
          Constructor that receives a name.
 
Method Summary
 void add(Permission permission)
          Adds a permission to this group.
 int compareTo(Permission o)
           
 boolean equals(Object obj)
           
 Integer getId()
          Returns the value of the id property.
 String getName()
          Returns the value of the name property.
 List<Permission> getPermissions()
          Returns the value of the permissions property.
 int hashCode()
           
 void remove(Permission permission)
          Removes a permission from this group.
 void setId(Integer id)
          Changes the value of the id property.
 void setName(String name)
          Changes the value of the name property.
 void setPermissions(List<Permission> permissions)
          Deprecated. Use add(Permission) and remove(Permission) instead.
 String toString()
          Returns the name property.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MINIMUM_NAME_LENGTH

public static final int MINIMUM_NAME_LENGTH
Minimum name length.

See Also:
Constant Field Values

MAXIMUM_NAME_LENGTH

public static final int MAXIMUM_NAME_LENGTH
Maximum name length.

See Also:
Constant Field Values

ALL_USERS_PERMISSION_GROUP_NAME

public static final String ALL_USERS_PERMISSION_GROUP_NAME
Name of the permission group that contains all users.

See Also:
Constant Field Values
Constructor Detail

PermissionGroup

public PermissionGroup()
No-arg constructor.


PermissionGroup

public PermissionGroup(String name)
Constructor that receives a name.

Parameters:
name - a String. It cannot be null.
Throws:
IllegalArgumentException - if name is null.
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

compareTo

public int compareTo(Permission o)
Specified by:
compareTo in interface Comparable<Permission>
See Also:
Comparable.compareTo(java.lang.Object)

getId

public Integer getId()
Returns the value of the id property.

Returns:
a Integer.

setId

public void setId(Integer id)
Changes the value of the id property.

Parameters:
id - a Integer.

getName

@NotNull
@Length(min=2,
        max=50)
public String getName()
Returns the value of the name property.

Returns:
a String.

setName

public void setName(String name)
Changes the value of the name property.

Parameters:
name - a String.

getPermissions

@Size(min=1,
      max=100)
public List<Permission> getPermissions()
Returns the value of the permissions property.

Returns:
a List.

add

public void add(Permission permission)
Adds a permission to this group.

Parameters:
permission - a Permission.

remove

public void remove(Permission permission)
Removes a permission from this group.

Parameters:
permission - a Permission.

setPermissions

public void setPermissions(List<Permission> permissions)
Deprecated. Use add(Permission) and remove(Permission) instead.

Changes the value of the permissions property.

Parameters:
permissions - a List.

toString

public String toString()
Returns the name property.

Overrides:
toString in class Object
Returns:
a String.


Copyright © 2008-2009 Thiago H. de Paula Figueiredo. All Rights Reserved.