org.mmbase.security
Class Rank

java.lang.Object
  extended byorg.mmbase.security.Rank
All Implemented Interfaces:
Comparable, Serializable

public final class Rank
extends Object
implements Comparable, Serializable

This class defines Rank objects which are used in security implementation. Ranks can be associated with users. Every Rank has an unique integer 'height' (so every rank is higher or lower than any other rank) and a String which can be used to identify it. Possible Ranks are maintained by static methods in this class. Generally the 'anonymous', 'basic user' and 'adminstrator' ranks should always be available, and only be delete with good reason.

Version:
$Id: Rank.java,v 1.16 2005/04/25 14:25:18 michiel Exp $
Author:
Eduard Witteveen, Pierre van Rooden, Michiel Meeuwissen
See Also:
Serialized Form

Field Summary
static Rank ADMIN
          Identifier for admin rank
static int ADMIN_INT
          int value for the anonymous Rank
static Rank ANONYMOUS
          Identifier for anonymous rank
static int ANONYMOUS_INT
          int value for the anonymous Rank
static Rank BASICUSER
          Identifier for basic user rank
static int BASICUSER_INT
          int value for the basic user Rank
 
Constructor Summary
protected Rank(int rank, String description)
          constructor
 
Method Summary
 int compareTo(Object o)
           
static Rank createRank(int rank, String rankDesc)
          Creates and adds a new Rank for the security system.
static Rank deleteRank(String rankDesc)
          Removes a rank from the security system.
 boolean equals(Object o)
           
 int getInt()
          This method gives back the internal int value of the rank which can be used in switch statements
static Rank getRank(String rankDesc)
           
static SortedSet getRanks()
          Returns all ranks currently known by the security implemetation.
 int hashCode()
           
protected static Rank registerRank(Rank rank)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ANONYMOUS_INT

public static final int ANONYMOUS_INT
int value for the anonymous Rank

See Also:
Constant Field Values

BASICUSER_INT

public static final int BASICUSER_INT
int value for the basic user Rank

See Also:
Constant Field Values

ADMIN_INT

public static final int ADMIN_INT
int value for the anonymous Rank

See Also:
Constant Field Values

ANONYMOUS

public static final Rank ANONYMOUS
Identifier for anonymous rank


BASICUSER

public static final Rank BASICUSER
Identifier for basic user rank


ADMIN

public static final Rank ADMIN
Identifier for admin rank

Constructor Detail

Rank

protected Rank(int rank,
               String description)
constructor

Method Detail

getInt

public int getInt()
This method gives back the internal int value of the rank which can be used in switch statements

Returns:
the internal int value

toString

public String toString()
Returns:
a string containing the description of the rank

getRank

public static Rank getRank(String rankDesc)

registerRank

protected static Rank registerRank(Rank rank)
Since:
MMBase-1.6.4

createRank

public static Rank createRank(int rank,
                              String rankDesc)
Creates and adds a new Rank for the security system.

Since:
MMBase-1.6.4

deleteRank

public static Rank deleteRank(String rankDesc)
Removes a rank from the security system.

Since:
MMBase-1.6.4

getRanks

public static SortedSet getRanks()
Returns all ranks currently known by the security implemetation. Default and to start with there are three ranks available: 'anonymous', 'basic user' and 'administrator'. You probably should never remove them.

Since:
MMBase-1.6.4

equals

public boolean equals(Object o)
Since:
MMBase-1.6.4

hashCode

public int hashCode()
See Also:
Object.hashCode()

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable
Since:
MMBase-1.6.4


MMBase build 1.8.1.20060716