edu.internet2.middleware.grouper.privs
Class Privilege

java.lang.Object
  extended by edu.internet2.middleware.grouper.privs.Privilege
All Implemented Interfaces:
Serializable

public class Privilege
extends Object
implements Serializable

Privilege schema specification. Access the constants for Groups from AccessPrivilege and Stems from NamingPrivilege.

Version:
$Id: Privilege.java,v 1.9 2009-09-21 06:14:26 mchyzer Exp $
Author:
blair christensen.
See Also:
Serialized Form

Field Summary
static long serialVersionUID
          constant
 
Method Summary
static Set<Privilege> convertFieldsToPrivileges(Collection<Field> fields)
          convert a list to a privilege for any type of privilege
static Set<Privilege> convertNamesToPrivileges(Collection<String> privilegeNames)
          convert a list of privilege names or field names to a privilege for any type of privilege
static Collection<Field> convertPrivilegesToFields(Collection<Privilege> privileges)
          convert a collection of privileges to a collection of fields
 boolean equals(Object obj)
          string equals
static Set<Privilege> getAccessPrivs()
           
static Set<Privilege> getAttributeDefPrivs()
          get attribute def privs
 Field getField()
          return the list name
 Collection<Privilege> getImpliedPrivileges()
          get the privilege that this privilege implied (including this privilege for instance if the privilege is UPDATE, then return UPDATE and ADMIN
 Collection<Privilege> getInheritedPrivileges()
          get the inherited privileges for this privilege (including this privilege for instance if the privilege is UPDATE, then return UPDATE and ADMIN
static Privilege getInstance(String name)
           
static Privilege getInstance(String name, boolean exceptionIfNotFound)
           
static Set<Privilege> getInstances(String namesCommaSeparated)
           
 String getListName()
          return the list name
 String getName()
           
static Set<Privilege> getNamingPrivs()
          get stem (naming) privs
 int hashCode()
          generate hash code
 boolean isAccess()
          see if privilege involves group
static boolean isAccess(Privilege p)
           
 boolean isAttributeDef()
          see if privilege involves attribute def
static boolean isAttributeDef(Privilege p)
           
 boolean isNaming()
          see if privilege involves stem
static boolean isNaming(Privilege p)
           
static Privilege listToPriv(String list, boolean exceptionOnNotFound)
          convert a list to a privilege for any type of privilege
static String stringValue(Set<Privilege> privileges)
          convert privileges to string comma separated
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
constant

See Also:
Constant Field Values
Method Detail

isAccess

public boolean isAccess()
see if privilege involves group

Returns:
if involves groups

isNaming

public boolean isNaming()
see if privilege involves stem

Returns:
if involves stems

isAttributeDef

public boolean isAttributeDef()
see if privilege involves attribute def

Returns:
if involves attribute def

listToPriv

public static Privilege listToPriv(String list,
                                   boolean exceptionOnNotFound)
convert a list to a privilege for any type of privilege

Parameters:
list -
Returns:
the privilege

convertFieldsToPrivileges

public static Set<Privilege> convertFieldsToPrivileges(Collection<Field> fields)
convert a list to a privilege for any type of privilege

Parameters:
fields -
Returns:
the privilege

convertNamesToPrivileges

public static Set<Privilege> convertNamesToPrivileges(Collection<String> privilegeNames)
convert a list of privilege names or field names to a privilege for any type of privilege

Parameters:
privilegeNames -
Returns:
the privilege

convertPrivilegesToFields

public static Collection<Field> convertPrivilegesToFields(Collection<Privilege> privileges)
convert a collection of privileges to a collection of fields

Parameters:
privileges -
Returns:
the fields

hashCode

public int hashCode()
generate hash code

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
string equals

Overrides:
equals in class Object
Returns:
if equal

getInheritedPrivileges

public Collection<Privilege> getInheritedPrivileges()
get the inherited privileges for this privilege (including this privilege for instance if the privilege is UPDATE, then return UPDATE and ADMIN

Returns:
the inherited privileges

getImpliedPrivileges

public Collection<Privilege> getImpliedPrivileges()
get the privilege that this privilege implied (including this privilege for instance if the privilege is UPDATE, then return UPDATE and ADMIN

Returns:
the inherited privileges

getListName

public String getListName()
return the list name

Returns:
the list name

getField

public Field getField()
               throws SchemaException
return the list name

Returns:
the list name
Throws:
SchemaException

getAccessPrivs

public static Set<Privilege> getAccessPrivs()
Returns:
access (group) privs

getInstances

public static Set<Privilege> getInstances(String namesCommaSeparated)
Parameters:
namesCommaSeparated -
Returns:
the privileges

stringValue

public static String stringValue(Set<Privilege> privileges)
convert privileges to string comma separated

Parameters:
privileges -
Returns:
the privileges

getInstance

public static Privilege getInstance(String name)
Parameters:
name -
Returns:
priv

getInstance

public static Privilege getInstance(String name,
                                    boolean exceptionIfNotFound)
Parameters:
name -
exceptionIfNotFound -
Returns:
priv

getNamingPrivs

public static Set<Privilege> getNamingPrivs()
get stem (naming) privs

Returns:
set

getAttributeDefPrivs

public static Set<Privilege> getAttributeDefPrivs()
get attribute def privs

Returns:
attr def privs

isAccess

public static boolean isAccess(Privilege p)
Parameters:
p -
Returns:
if access

isNaming

public static boolean isNaming(Privilege p)
Parameters:
p -
Returns:
if naming (stem)

isAttributeDef

public static boolean isAttributeDef(Privilege p)
Parameters:
p -
Returns:
if attribute def

getName

public String getName()
Returns:
name

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()