org.openrdf.sesame.sailimpl.omm.security
Class RoleImpl

java.lang.Object
  extended byorg.openrdf.sesame.sailimpl.omm.security.RoleImpl
All Implemented Interfaces:
Role

public class RoleImpl
extends Object
implements Role

RoleImpl.java

Title: Knowledge Control System

Company: OntoText Lab. Sirma AI.

Version:
1.0 Implementation of the Role Interface
Author:
borislav popov

Constructor Summary
RoleImpl()
          Create a Role with the first free id.
RoleImpl(int id, String name, String description)
          Create a Role given an id, a name and a description.
 
Method Summary
 void addRule(Rule rule)
          Add a new security rule for the Role
 String getDescription()
          Gets the role description
 int getId()
          Retireve the Id of that role
 String getName()
          Retireve the Name of that role
 Set getParentRoles()
          Retrieve a list of roleIDs of the parent roles.
 Set getRules(boolean direct)
          Retrive a list of rules in the Role.
static Set getRules(Set roles, boolean direct)
          Retrieve the set of rules defined for the given set of roles.
 String getUri()
           
 void removeRule(Rule rule)
          Remove a security Rule from the role
 void setDescription(String descr)
          Sets role description
 void setId(int id)
          Sets roles id.
 void setName(String roleName)
          Change the role Name
 void setParentRoles(Set parents)
           
 void setUri(String uri)
           
 ArrayList toSql()
          Creates update queries over the roles, roles_hierarchy and roles_rules tables.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RoleImpl

public RoleImpl(int id,
                String name,
                String description)
         throws NullParameterException
Create a Role given an id, a name and a description.

Parameters:
id - the role id to be set
Throws:
NullParameterException - whenever a the id is null

RoleImpl

public RoleImpl()
Create a Role with the first free id.

Method Detail

setDescription

public void setDescription(String descr)
Description copied from interface: Role
Sets role description

Specified by:
setDescription in interface Role
Parameters:
descr - the description of the role

getDescription

public String getDescription()
Description copied from interface: Role
Gets the role description

Specified by:
getDescription in interface Role
Returns:
the role description

addRule

public void addRule(Rule rule)
             throws NullParameterException
Description copied from interface: Role
Add a new security rule for the Role

Specified by:
addRule in interface Role
Parameters:
rule - the interface to a new rule
Throws:
NullParameterException - whenever the parameter is null

removeRule

public void removeRule(Rule rule)
                throws NullParameterException
Description copied from interface: Role
Remove a security Rule from the role

Specified by:
removeRule in interface Role
Parameters:
rule - rule to remove
Throws:
NullParameterException - whenever the parameter is null

getRules

public Set getRules(boolean direct)
Description copied from interface: Role
Retrive a list of rules in the Role. The items in the list are Rule intrfaces. See the Rights class for all supported access Rights

Specified by:
getRules in interface Role
Parameters:
direct - depending on this the result will contain either the own rules of this role, either all inherited rules.
Returns:
set of, either the own rules of this role, either all inherited rules, depending on the parameter.

getParentRoles

public Set getParentRoles()
Description copied from interface: Role
Retrieve a list of roleIDs of the parent roles.

Specified by:
getParentRoles in interface Role
Returns:
set of roleIDs

setParentRoles

public void setParentRoles(Set parents)
                    throws NullParameterException
Specified by:
setParentRoles in interface Role
Parameters:
parents - set of the ids of the roles to be inherited
Throws:
NullParameterException - whenever the parameter is null

getId

public int getId()
Description copied from interface: Role
Retireve the Id of that role

Specified by:
getId in interface Role
Returns:
the role's Id

setId

public void setId(int id)
Description copied from interface: Role
Sets roles id.

Specified by:
setId in interface Role
Parameters:
id - the id to be set

getName

public String getName()
Description copied from interface: Role
Retireve the Name of that role

Specified by:
getName in interface Role
Returns:
the role's Name

setName

public void setName(String roleName)
             throws NullParameterException
Description copied from interface: Role
Change the role Name

Specified by:
setName in interface Role
Parameters:
roleName - New name for the role
Throws:
NullParameterException - whenever the parameter is null

toSql

public ArrayList toSql()
Description copied from interface: Role
Creates update queries over the roles, roles_hierarchy and roles_rules tables.

Specified by:
toSql in interface Role
Returns:
A list of update SQL queries, to be used to mirror the objects' properties from memory to an SQL repository.

getRules

public static Set getRules(Set roles,
                           boolean direct)
Retrieve the set of rules defined for the given set of roles.

Parameters:
roles -
direct - direct or transtive closure
Returns:
the set of rules defined for the given set of roles.

setUri

public void setUri(String uri)
Specified by:
setUri in interface Role

getUri

public String getUri()
Specified by:
getUri in interface Role


Copyright © 2002-2006 Aduna BV, GNU LGPL License applies.