org.pentaho.platform.engine.security.userroledao
Class PentahoRole

java.lang.Object
  extended by org.pentaho.platform.engine.security.userroledao.PentahoRole
All Implemented Interfaces:
Serializable, IPentahoRole

public class PentahoRole
extends Object
implements IPentahoRole

A role in the Pentaho platform. Contains a set of users to which the role is assigned. A role is also known as an authority.

Note that users are not considered during equals comparisons and hashCode calculations. This is because instances are sometimes stored in Java collections. The users set is mutable and we don't want two roles that have the same name but different users in the same set.

Author:
mlowery
See Also:
PentahoUser, Serialized Form

Constructor Summary
PentahoRole(IPentahoRole roleToCopy)
          Copy constructor
PentahoRole(String name)
           
PentahoRole(String name, String description)
           
 
Method Summary
 boolean addUser(IPentahoUser user)
           
 void clearUsers()
           
 boolean equals(Object obj)
           
 String getDescription()
           
 String getName()
           
 Set<IPentahoUser> getUsers()
           
 int hashCode()
           
 boolean removeUser(IPentahoUser user)
           
 void setDescription(String description)
           
 void setUsers(Set<IPentahoUser> users)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PentahoRole

public PentahoRole(String name)

PentahoRole

public PentahoRole(String name,
                   String description)

PentahoRole

public PentahoRole(IPentahoRole roleToCopy)
Copy constructor

Method Detail

getName

public String getName()
Specified by:
getName in interface IPentahoRole

getDescription

public String getDescription()
Specified by:
getDescription in interface IPentahoRole

setDescription

public void setDescription(String description)
Specified by:
setDescription in interface IPentahoRole

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

setUsers

public void setUsers(Set<IPentahoUser> users)
Specified by:
setUsers in interface IPentahoRole

getUsers

public Set<IPentahoUser> getUsers()
Specified by:
getUsers in interface IPentahoRole

addUser

public boolean addUser(IPentahoUser user)
Specified by:
addUser in interface IPentahoRole
Returns:
Same meaning as Set.add return value.

removeUser

public boolean removeUser(IPentahoUser user)
Specified by:
removeUser in interface IPentahoRole
Returns:
Same meaning as Set.remove return value.

clearUsers

public void clearUsers()
Specified by:
clearUsers in interface IPentahoRole