net.javamud.data
Class Permission

java.lang.Object
  |
  +--net.javamud.data.Permission
All Implemented Interfaces:
Comparable, SISCapable

public class Permission
extends Object
implements Comparable, SISCapable

A Permission consists of a Right and a User.
Permissions are immutable and therefor thread safe.

Author:
Timothy Hinchcliffe
Created On:
15 June 2002

Field Summary
protected  Right right
          Right associated with this Permission
protected  UserIdentity user
          Identity of User associated with this Permission.
 
Constructor Summary
Permission(UserIdentity uid, Right setRight)
          Constructor for the Permission object
Permission(UserIdentity uid, String setRight)
          Constructor for the Permission object
 
Method Summary
 int compareTo(Object object)
          Orders by user, the right.
 boolean equals(Object o)
          Equality test.
 Collection getSISObjects()
          See SISCapable.getSISObjects().
 boolean implies(Permission perm)
          Does this imply the Permission perm
 boolean implies(UserIdentity uid, Right implied)
          Does this imply the Right implied ?
 boolean implies(UserIdentity uid, String implied)
          Does this imply the Right implied ?
 int impliesQuality(Permission perm)
          Returns a measure of quality of the implies match.
 int impliesQuality(UserIdentity uid, Right implied)
          Returns a measure of quality of the implies match.
 int impliesQuality(UserIdentity uid, String implied)
          Returns a measure of quality of the implies match.
 void updateSISObject(Object original, Object replacement)
          See SISCapable.updateSISObject(Object,Object).
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

right

protected Right right
Right associated with this Permission


user

protected UserIdentity user
Identity of User associated with this Permission.

Constructor Detail

Permission

public Permission(UserIdentity uid,
                  Right setRight)
Constructor for the Permission object

Parameters:
setRight - Right for Permission
uid - User for Permission

Permission

public Permission(UserIdentity uid,
                  String setRight)
Constructor for the Permission object

Parameters:
setRight - String representation of Right for Permission
uid - User for Permission
Method Detail

getSISObjects

public Collection getSISObjects()
See SISCapable.getSISObjects().

Specified by:
getSISObjects in interface SISCapable
Returns:
See SISCapable.getSISObjects().

compareTo

public int compareTo(Object object)
              throws ClassCastException
Orders by user, the right.

Specified by:
compareTo in interface Comparable
Parameters:
object - Permission to compare to.
Returns:
Description of the Return Value
Throws:
ClassCastException - Description of the Exception

equals

public boolean equals(Object o)
Equality test.

Overrides:
equals in class Object
Parameters:
o - Other permission
Returns:
User equals o.user and Right equals o.right

implies

public boolean implies(UserIdentity uid,
                       Right implied)
Does this imply the Right implied ?

Parameters:
uid - User id
implied - Right to test
Returns:
True if this implies the Right implied for User uid

implies

public boolean implies(UserIdentity uid,
                       String implied)
Does this imply the Right implied ?

Parameters:
uid - User id
implied - Right to test
Returns:
True if this implies the Right implied for User uid

implies

public boolean implies(Permission perm)
Does this imply the Permission perm

Parameters:
perm - The permission to test.
Returns:
True if this implies the Permission.

impliesQuality

public int impliesQuality(UserIdentity uid,
                          Right implied)
Returns a measure of quality of the implies match.

Parameters:
uid - User to match
implied - Right to match
Returns:
Match quality value
See Also:
Right.impliesQuality(Right)

impliesQuality

public int impliesQuality(UserIdentity uid,
                          String implied)
Returns a measure of quality of the implies match.

Parameters:
uid - User to match
implied - Right to match
Returns:
Match quality value
See Also:
Right.impliesQuality(Right)

impliesQuality

public int impliesQuality(Permission perm)
Returns a measure of quality of the implies match.

Parameters:
perm - Permision to match
Returns:
Match quality value
See Also:
Right.impliesQuality(Right)

updateSISObject

public void updateSISObject(Object original,
                            Object replacement)
See SISCapable.updateSISObject(Object,Object).

Specified by:
updateSISObject in interface SISCapable
Parameters:
original - See SISCapable.updateSISObject(Object,Object).
replacement - See SISCapable.updateSISObject(Object,Object).
See Also:
SISCapable.updateSISObject(Object,Object)