|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.locomotive.loco.perm.PermissionSet
Provides a data structure to store a set of permissions. A PermissionSet contains a bitfield in which each bit is associated with a permission. The PermissionSet is said to contain a permission if the corresponding bit is set in its bitfield.
Constructor Summary | |
PermissionSet()
Creates an empty permission set. |
|
PermissionSet(boolean[] values)
Creates a permission set initialized to the bitfield contained in the array of booleans. |
|
PermissionSet(int userid)
Creates an empty permission set with the specified userid |
|
PermissionSet(java.util.Vector ints)
Creates a permission set initialized to the bitfield contained in the Vector of Integers. |
Method Summary | |
PermissionSet |
and(PermissionSet pSet)
'Ands' this PermissionSet with another PermissionSet. |
PermissionSet |
clear()
Clears all permissions in the permission set. |
java.lang.Object |
clone()
Makes a clone of this PermissionSet. |
static boolean |
exists(java.lang.String permName)
Deprecated. in favor of Permission.exists() |
static Permission |
get(java.lang.String permName)
Deprecated. in favor of Permission.get() |
SortableTable |
getPermTable()
returns a SortableTable of all the permissions and whether or not this permission set has them set. |
java.util.Vector |
getSetPerms()
Returns an enumeration of all set permission names. |
int |
getUserid()
gets the userid for this permission set |
static void |
initialize(java.sql.Connection conn)
Deprecated. in favor of Permission.initializeCache(); |
protected boolean |
isSet(int position)
a handy little method for package internal use in UserPerm |
boolean |
isSet(Permission perm)
Checks if a permission is set in the permission set. |
boolean |
isSet(java.lang.String permName)
Checks if a permission is set in the permission set. |
boolean |
isSubsetOf(PermissionSet pSet)
Sees if this PermissionSet is a subset of another PermissionSet. |
static java.util.Vector |
names()
Deprecated. in favor of Permission.getPermissions() |
PermissionSet |
or(PermissionSet pSet)
'Ors' this PermissionSet with another PermissionSet. |
PermissionSet |
set(Permission perm)
Sets a permission in the permission set. |
PermissionSet |
set(java.lang.String permName)
Sets a permission in the permission set. |
PermissionSet |
setAll()
Sets all permissions in the permission set. |
void |
setBitfield(boolean[] values)
takes an array of booleans and sets them as our new bitfield. |
PermissionSet |
setBitfield(java.util.Vector ints)
Takes a Vector of Integers (in the format created by the toInts<\code> method), and sets it as our new bitfield. |
PermissionSet |
setOnOrOff(Permission perm,
boolean on_or_off)
Sets a permission in the permission set. |
PermissionSet |
setOnOrOff(java.lang.String permName,
boolean on_or_off)
Sets a permission in the permission set. |
void |
setUserid(int userid)
sets the userid for this permission set |
int |
size()
returns the size of the permission set |
boolean[] |
toArray()
Transforms the Bitfield into an array of booleans. |
java.util.Vector |
toInts()
Transforms the BitSet's bitfield into a Vector of Integers. |
java.lang.String |
toString()
Returns the the userid + BitSet's toString(). |
PermissionSet |
unset(Permission perm)
Unsets a permission in the permission set. |
PermissionSet |
unset(java.lang.String permName)
Unsets a permission in the permission set. |
PermissionSet |
xor(PermissionSet pSet)
'Xors' the PermissionSet with another PermissionSet. |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Constructor Detail |
public PermissionSet()
public PermissionSet(int userid)
public PermissionSet(java.util.Vector ints)
ints
- Vector of Integers representing a permissions bitfieldpublic PermissionSet(boolean[] values)
ints
- Vector of Integers representing a permissions bitfieldMethod Detail |
public static void initialize(java.sql.Connection conn) throws java.sql.SQLException
conn
- Connection object to the databasepublic static Permission get(java.lang.String permName)
permName
- String name of the permission to be retrievedpublic static java.util.Vector names()
public static boolean exists(java.lang.String permName)
permName
- String name of the permissiontrue
if the permission exists in the databasepublic void setUserid(int userid)
public int getUserid()
public PermissionSet setOnOrOff(java.lang.String permName, boolean on_or_off)
permName
- name of the permission to seton_or_off
- whether to set the permission to on or off.public PermissionSet setOnOrOff(Permission perm, boolean on_or_off)
perm
- the permission to seton_or_off
- whether to set the permission to on or off.public PermissionSet set(java.lang.String permName)
permName
- name of the permission to setpublic PermissionSet set(Permission perm)
perm
- the permission to setpublic PermissionSet setAll()
public PermissionSet unset(java.lang.String permName)
permName
- name of the permission to clearpublic PermissionSet unset(Permission perm)
perm
- the permission to clearpublic PermissionSet clear()
public boolean isSet(java.lang.String permName)
permName
- name of the permission in questiontrue
if the permission is setpublic boolean isSet(Permission perm)
perm
- the permission in questiontrue
if the permission is setprotected boolean isSet(int position)
public java.util.Vector getSetPerms()
public SortableTable getPermTable()
0 perm_id (int) 1 perm_name (String) 2 is_set (boolean)This table is sorted by Permission name.
public PermissionSet and(PermissionSet pSet)
pSet
- PermissionSet with which to be 'And'edpublic PermissionSet or(PermissionSet pSet)
pSet
- PermissionSet with which to be 'Or'edpublic PermissionSet xor(PermissionSet pSet)
pSet
- PermissionSet with which to be 'Xor'edpublic int size()
public boolean isSubsetOf(PermissionSet pSet)
pSet
- PermissionSet being tested withtrue
if this PermissionSet is a subset of the
parameter PermissionSetpublic java.util.Vector toInts()
public PermissionSet setBitfield(java.util.Vector ints)
toInts<\code> method), and sets it as our new bitfield.
- Parameters:
ints
- Vector of Integers representing the PermissionsSet bitfield
public boolean[] toArray()
toInts()
public void setBitfield(boolean[] values)
values
- the array of boolean values to use as the bitfieldpublic java.lang.String toString()
public java.lang.Object clone()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |