com.yosokumo.core
Class Role

java.lang.Object
  extended by com.yosokumo.core.Role

public class Role
extends java.lang.Object

A set of privileges granted to a particular user for a particular study. One of the privileges granted to a study creator is the authority to create new roles on the study for other enrolled users. In this way, the study creator can allow others to load data, get predictions, view study statistics, or even themselves grant privileges on the study to other users. Roles may be severely limited or provide full access and may be changed or revoked at any time.

When an enrolled user creates a study, he is authorized automatically to perform any action on that study. More precisely, when a study is created, the service simultaneously creates a role for the creator on the newly created study in which all privileges are set to true.

A single user may have a role on many studies; conversely, many users may have a role on a single study. The list of studies on which a particular user has a role is called the catalog for that user. The list of users that have a role on a particular study is called the roster for that study.

A Role has these attributes:


Nested Class Summary
static class Role.Privilege
          Indicates an operation which a given user is or is not allowed to perform on a given study.
 
Field Summary
private  java.util.BitSet privilegeSet
           
private  java.lang.String roleLocation
           
private  java.lang.String studyIdentifier
           
private  java.lang.String studyName
           
private  java.lang.String userIdentifier
           
private  java.lang.String userName
           
 
Constructor Summary
Role(java.lang.String userIdentifier, java.lang.String studyIdentifier)
          Initializes a newly created Role object with attributes specified by the input parameters.
 
Method Summary
 Role addAllPrivileges()
          Add all privileges.
 Role addPrivilege(Role.Privilege privilege)
          Add a privilege.
 boolean getPrivilege(Role.Privilege privilege)
          Get a specific privilege.
(package private)  java.lang.String getRoleLocation()
          Return the role location.
 java.lang.String getStudyIdentifier()
          Return the study identifier.
 java.lang.String getStudyName()
          Return the study name.
 java.lang.String getUserIdentifier()
          Return the user identifier.
 java.lang.String getUserName()
          Return the user name.
 Role removeAllPrivileges()
          Remove all privileges.
 Role removePrivilege(Role.Privilege privilege)
          Remove a privilege.
(package private)  Role setRoleLocation(java.lang.String loc)
          Set the role location.
 Role setStudyIdentifier(java.lang.String studyIdentifier)
          Set the study identifier.
 Role setStudyName(java.lang.String name)
          Set the study name.
 Role setUserIdentifier(java.lang.String userIdentifier)
          Set the user identifier.
 Role setUserName(java.lang.String name)
          Set the user name.
 java.lang.String toString()
          Return a string representation of this Role.
(package private)  java.lang.String toStringInternal(boolean showAll)
          Return a string representation of this Role.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

roleLocation

private java.lang.String roleLocation

userIdentifier

private java.lang.String userIdentifier

userName

private java.lang.String userName

studyIdentifier

private java.lang.String studyIdentifier

studyName

private java.lang.String studyName

privilegeSet

private java.util.BitSet privilegeSet
Constructor Detail

Role

public Role(java.lang.String userIdentifier,
            java.lang.String studyIdentifier)
Initializes a newly created Role object with attributes specified by the input parameters.

Parameters:
userIdentifier - the user who has the role.
studyIdentifier - the study on which the user has the role.
Method Detail

setRoleLocation

Role setRoleLocation(java.lang.String loc)
Set the role location.

Parameters:
loc - the location to assign to this role. May be null.
Returns:
this Role.

getRoleLocation

java.lang.String getRoleLocation()
Return the role location.

Returns:
the location of this role. May be null.

setUserIdentifier

public Role setUserIdentifier(java.lang.String userIdentifier)
Set the user identifier.

Parameters:
userIdentifier - the user identifier to assign to this role.
Returns:
this Role.

getUserIdentifier

public java.lang.String getUserIdentifier()
Return the user identifier.

Returns:
the user identifier of this role. May be null.

setUserName

public Role setUserName(java.lang.String name)
Set the user name.

Parameters:
name - the user name to assign to this role. May be null.
Returns:
this Role.

getUserName

public java.lang.String getUserName()
Return the user name.

Returns:
the name of the user of this role. May be null.

setStudyIdentifier

public Role setStudyIdentifier(java.lang.String studyIdentifier)
Set the study identifier.

Parameters:
studyIdentifier - the study identifier to assign to this role.
Returns:
this Role.

getStudyIdentifier

public java.lang.String getStudyIdentifier()
Return the study identifier.

Returns:
the study identifier of this role. May be null.

setStudyName

public Role setStudyName(java.lang.String name)
Set the study name.

Parameters:
name - the name to assign to the study of this role. May be null.
Returns:
this Role.

getStudyName

public java.lang.String getStudyName()
Return the study name.

Returns:
the name of the study of this role. May be null.

addPrivilege

public Role addPrivilege(Role.Privilege privilege)
Add a privilege. Grant a specific privilege.

Parameters:
privilege - is the privilege to grant.
Returns:
this role.

removePrivilege

public Role removePrivilege(Role.Privilege privilege)
Remove a privilege. A specific privilege is removed.

Parameters:
privilege - is the privilege to remove.
Returns:
this Role.

addAllPrivileges

public Role addAllPrivileges()
Add all privileges. All privileges are granted.

Returns:
this Role.

removeAllPrivileges

public Role removeAllPrivileges()
Remove all privileges.

Returns:
this Role.

getPrivilege

public boolean getPrivilege(Role.Privilege privilege)
Get a specific privilege.

Parameters:
privilege - is the privilege to check for.
Returns:
true if privilege is granted, false otherwise.

toString

public java.lang.String toString()
Return a string representation of this Role.

Overrides:
toString in class java.lang.Object
Returns:
the string representation of this Role.

toStringInternal

java.lang.String toStringInternal(boolean showAll)
Return a string representation of this Role.

Parameters:
showAll - specifies if internal data members should be shown.
Returns:
the string representation of this Role.