edu.internet2.middleware.grouper.permissions.role
Class RoleSet

java.lang.Object
  extended by edu.internet2.middleware.grouper.GrouperAPI
      extended by edu.internet2.middleware.grouper.permissions.role.RoleSet
All Implemented Interfaces:
GrouperSet, HibGrouperLifecycle, Hib3GrouperVersioned, GrouperCloneable, GrouperHasContext, GrouperUtil.FieldValuable, XmlImportable<RoleSet>, XmlImportableBase<RoleSet>, Serializable, org.hibernate.classic.Lifecycle

public class RoleSet
extends GrouperAPI
implements Hib3GrouperVersioned, GrouperSet, GrouperHasContext, XmlImportable<RoleSet>

Author:
mchyzer $Id: RoleSet.java,v 1.1 2009-10-02 05:57:58 mchyzer Exp $
See Also:
Serialized Form

Field Summary
static String COLUMN_CONTEXT_ID
          column
static String COLUMN_CREATED_ON
          column
static String COLUMN_DEPTH
          column
static String COLUMN_ID
          column
static String COLUMN_IF_HAS_ROLE_ID
          column
static String COLUMN_LAST_UPDATED
          column
static String COLUMN_PARENT_ROLE_SET_ID
          column
static String COLUMN_THEN_HAS_ROLE_ID
          column
static String COLUMN_TYPE
          column
static String FIELD_CONTEXT_ID
          constant for field name for: contextId
static String FIELD_CREATED_ON_DB
          constant for field name for: createdOnDb
static String FIELD_DEPTH
          constant for field name for: depth
static String FIELD_ID
          constant for field name for: id
static String FIELD_IF_HAS_ROLE_ID
          constant for field name for: ifHasRoleId
static String FIELD_LAST_UPDATED_DB
          constant for field name for: lastUpdatedDb
static String FIELD_PARENT_ROLE_SET_ID
          constant for field name for: parentRoleSetId
static String FIELD_THEN_HAS_ROLE_ID
          constant for field name for: thenHasRoleId
static String FIELD_TYPE
          constant for field name for: type
static String TABLE_GROUPER_ROLE_SET
          name of the groups role table in the db
 
Fields inherited from class edu.internet2.middleware.grouper.GrouperAPI
COLUMN_HIBERNATE_VERSION_NUMBER, FIELD_DB_VERSION, FIELD_HIBERNATE_VERSION_NUMBER, INITIAL_VERSION_NUMBER
 
Fields inherited from interface org.hibernate.classic.Lifecycle
NO_VETO, VETO
 
Constructor Summary
RoleSet()
           
 
Method Summary
 int __getDepth()
          depth of this relationship (0 means self, 1 means one hop, 2 means 2 hops, etc)
 String __getId()
          if of this object
 GrouperSetElement __getIfHasElement()
          if has this element then has another element
 String __getIfHasElementId()
          if has this element id then has another element id
 GrouperSet __getParentGrouperSet()
          get the parent set the parent is the relationship leading up to this relationship.
 String __getParentGrouperSetId()
          parent set id
 GrouperSetElement __getThenHasElement()
          has this element if it has another
 String __getThenHasElementId()
          has this element Id if it has another id
 void __setParentGrouperSetId(String grouperSetId)
          set the parent id of this set.
 GrouperAPI clone()
          deep clone the fields in this object
 RoleSet dbVersion()
          save the state when retrieving from DB
 Set<String> dbVersionDifferentFields()
          see which fields have changed compared to the DB state (last known) note that attributes will print out: attribute__attributeName
 void dbVersionReset()
          take a snapshot of the data since this is what is in the db
 void delete()
          save or update this object
 boolean equals(Object other)
           
static RoleSet findInCollection(Collection<RoleSet> roleSets, String ifHasId, String thenHasId, int depth, boolean exceptionIfNull)
          find role set, better be here
 String getContextId()
          context id of the transaction
 Timestamp getCreatedOn()
          when created
 Long getCreatedOnDb()
          when created
 int getDepth()
           
 String getId()
           
 Role getIfHasRole()
           
 String getIfHasRoleId()
           
 Timestamp getLastUpdated()
          when last updated
 Long getLastUpdatedDb()
          when last updated
 RoleSet getParentRoleSet()
           
 String getParentRoleSetId()
          for self, or immediate, just use this id.
 Role getThenHasRole()
           
 String getThenHasRoleId()
           
 RoleHierarchyType getType()
           
 String getTypeDb()
          get string value of type for hibernate
 int hashCode()
           
 void onPreDelete(HibernateSession hibernateSession)
          before a delete (insert) occurs
 void onPreSave(HibernateSession hibernateSession)
          before a save (insert) occurs
 void onPreUpdate(HibernateSession hibernateSession)
          before an update occurs
 void saveOrUpdate()
          save or update this object
 void setContextId(String contextId)
          set context id
 void setCreatedOn(Timestamp createdOn1)
          when created
 void setCreatedOnDb(Long createdOn1)
          when created
 void setDepth(int depth)
          set depth
 void setId(String id)
          set id
 void setIfHasRoleId(String memberRoleId)
          Set role id for the child
 void setLastUpdated(Timestamp lastUpdated1)
          when last updated
 void setLastUpdatedDb(Long lastUpdated1)
          when last updated
 void setParentRoleSetId(String parentId1)
          for self, or immediate, just use this id.
 void setThenHasRoleId(String thenHasRoleId)
          Set role id for the then
 void setType(RoleHierarchyType type1)
          set group set assignment type
 void setTypeDb(String type1)
          set group set assignment type
 void xmlCopyBusinessPropertiesToExisting(RoleSet existingRecord)
          copy business (non update) properties to an existing record
 boolean xmlDifferentBusinessProperties(RoleSet other)
          see if the non update cols are different (e.g.
 boolean xmlDifferentUpdateProperties(RoleSet other)
          see if the update cols are different (e.g.
 String xmlGetId()
          set id key in db
 RoleSet xmlRetrieveByIdOrKey()
          retrieve from db by id or key.
 RoleSet xmlSaveBusinessProperties(RoleSet existingRecord)
          save the business properties (not update properties)
 void xmlSaveUpdateProperties()
          save the udpate properties (e.g.
 void xmlSetId(String theId)
          set id key in db
 XmlExportRoleSet xmlToExportRoleSet(GrouperVersion grouperVersion)
          convert to xml bean for export
 String xmlToString()
          convert to string for log
 
Methods inherited from class edu.internet2.middleware.grouper.GrouperAPI
dbVersionClear, dbVersionIsDifferent, fieldValue, getHibernateVersionNumber, onDelete, onLoad, onPostDelete, onPostSave, onPostUpdate, onSave, onUpdate, setHibernateVersionNumber
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TABLE_GROUPER_ROLE_SET

public static final String TABLE_GROUPER_ROLE_SET
name of the groups role table in the db

See Also:
Constant Field Values

COLUMN_CONTEXT_ID

public static final String COLUMN_CONTEXT_ID
column

See Also:
Constant Field Values

COLUMN_CREATED_ON

public static final String COLUMN_CREATED_ON
column

See Also:
Constant Field Values

COLUMN_LAST_UPDATED

public static final String COLUMN_LAST_UPDATED
column

See Also:
Constant Field Values

COLUMN_ID

public static final String COLUMN_ID
column

See Also:
Constant Field Values

COLUMN_DEPTH

public static final String COLUMN_DEPTH
column

See Also:
Constant Field Values

COLUMN_IF_HAS_ROLE_ID

public static final String COLUMN_IF_HAS_ROLE_ID
column

See Also:
Constant Field Values

COLUMN_THEN_HAS_ROLE_ID

public static final String COLUMN_THEN_HAS_ROLE_ID
column

See Also:
Constant Field Values

COLUMN_PARENT_ROLE_SET_ID

public static final String COLUMN_PARENT_ROLE_SET_ID
column

See Also:
Constant Field Values

COLUMN_TYPE

public static final String COLUMN_TYPE
column

See Also:
Constant Field Values

FIELD_CONTEXT_ID

public static final String FIELD_CONTEXT_ID
constant for field name for: contextId

See Also:
Constant Field Values

FIELD_CREATED_ON_DB

public static final String FIELD_CREATED_ON_DB
constant for field name for: createdOnDb

See Also:
Constant Field Values

FIELD_DEPTH

public static final String FIELD_DEPTH
constant for field name for: depth

See Also:
Constant Field Values

FIELD_ID

public static final String FIELD_ID
constant for field name for: id

See Also:
Constant Field Values

FIELD_IF_HAS_ROLE_ID

public static final String FIELD_IF_HAS_ROLE_ID
constant for field name for: ifHasRoleId

See Also:
Constant Field Values

FIELD_LAST_UPDATED_DB

public static final String FIELD_LAST_UPDATED_DB
constant for field name for: lastUpdatedDb

See Also:
Constant Field Values

FIELD_THEN_HAS_ROLE_ID

public static final String FIELD_THEN_HAS_ROLE_ID
constant for field name for: thenHasRoleId

See Also:
Constant Field Values

FIELD_PARENT_ROLE_SET_ID

public static final String FIELD_PARENT_ROLE_SET_ID
constant for field name for: parentRoleSetId

See Also:
Constant Field Values

FIELD_TYPE

public static final String FIELD_TYPE
constant for field name for: type

See Also:
Constant Field Values
Constructor Detail

RoleSet

public RoleSet()
Method Detail

onPreSave

public void onPreSave(HibernateSession hibernateSession)
Description copied from interface: HibGrouperLifecycle
before a save (insert) occurs

Specified by:
onPreSave in interface HibGrouperLifecycle
Overrides:
onPreSave in class GrouperAPI
See Also:
GrouperAPI.onPreSave(edu.internet2.middleware.grouper.hibernate.HibernateSession)

onPreDelete

public void onPreDelete(HibernateSession hibernateSession)
Description copied from interface: HibGrouperLifecycle
before a delete (insert) occurs

Specified by:
onPreDelete in interface HibGrouperLifecycle
Overrides:
onPreDelete in class GrouperAPI
See Also:
GrouperAPI.onPreDelete(edu.internet2.middleware.grouper.hibernate.HibernateSession)

onPreUpdate

public void onPreUpdate(HibernateSession hibernateSession)
Description copied from interface: HibGrouperLifecycle
before an update occurs

Specified by:
onPreUpdate in interface HibGrouperLifecycle
Overrides:
onPreUpdate in class GrouperAPI
See Also:
GrouperAPI.onPreUpdate(edu.internet2.middleware.grouper.hibernate.HibernateSession)

findInCollection

public static RoleSet findInCollection(Collection<RoleSet> roleSets,
                                       String ifHasId,
                                       String thenHasId,
                                       int depth,
                                       boolean exceptionIfNull)
find role set, better be here

Parameters:
roleSets -
ifHasId -
thenHasId -
depth - is the depth expecting
exceptionIfNull -
Returns:
the def name set

equals

public boolean equals(Object other)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

clone

public GrouperAPI clone()
Description copied from class: GrouperAPI
deep clone the fields in this object

Specified by:
clone in interface GrouperCloneable
Specified by:
clone in class GrouperAPI
Returns:
the clone of the object
See Also:
Object.clone()

getParentRoleSet

public RoleSet getParentRoleSet()
Returns:
the parent group set or null if none

getIfHasRole

public Role getIfHasRole()
Returns:
the parent group set or null if none

getThenHasRole

public Role getThenHasRole()
Returns:
the parent group set or null if none

getId

public String getId()
Returns:
id

setId

public void setId(String id)
set id

Parameters:
id -

setContextId

public void setContextId(String contextId)
set context id

Specified by:
setContextId in interface GrouperHasContext
Parameters:
contextId -

getParentRoleSetId

public String getParentRoleSetId()
for self, or immediate, just use this id. for effective, this is the first hop on the directed graph to get to this membership.

Returns:
parent id

setParentRoleSetId

public void setParentRoleSetId(String parentId1)
for self, or immediate, just use this id. for effective, this is the first hop on the directed graph to get to this membership.

Parameters:
parentId1 -

getThenHasRoleId

public String getThenHasRoleId()
Returns:
role id for then

setThenHasRoleId

public void setThenHasRoleId(String thenHasRoleId)
Set role id for the then

Parameters:
thenHasRoleId -

getIfHasRoleId

public String getIfHasRoleId()
Returns:
member role id for the child

setIfHasRoleId

public void setIfHasRoleId(String memberRoleId)
Set role id for the child

Parameters:
memberRoleId -

getType

public RoleHierarchyType getType()
Returns:
membership type (immediate, effective, or composite)

getTypeDb

public String getTypeDb()
get string value of type for hibernate

Returns:
type

setType

public void setType(RoleHierarchyType type1)
set group set assignment type

Parameters:
type1 -

setTypeDb

public void setTypeDb(String type1)
set group set assignment type

Parameters:
type1 -

getDepth

public int getDepth()
Returns:
depth

setDepth

public void setDepth(int depth)
set depth

Parameters:
depth -

getContextId

public String getContextId()
context id of the transaction

Returns:
context id

getCreatedOn

public Timestamp getCreatedOn()
when created

Returns:
timestamp

getCreatedOnDb

public Long getCreatedOnDb()
when created

Returns:
timestamp

getLastUpdated

public Timestamp getLastUpdated()
when last updated

Returns:
timestamp

getLastUpdatedDb

public Long getLastUpdatedDb()
when last updated

Returns:
timestamp

saveOrUpdate

public void saveOrUpdate()
save or update this object

Specified by:
saveOrUpdate in interface GrouperSet

delete

public void delete()
save or update this object

Specified by:
delete in interface GrouperSet

setCreatedOnDb

public void setCreatedOnDb(Long createdOn1)
when created

Parameters:
createdOn1 -

setCreatedOn

public void setCreatedOn(Timestamp createdOn1)
when created

Parameters:
createdOn1 -

setLastUpdated

public void setLastUpdated(Timestamp lastUpdated1)
when last updated

Parameters:
lastUpdated1 -

setLastUpdatedDb

public void setLastUpdatedDb(Long lastUpdated1)
when last updated

Parameters:
lastUpdated1 -

__getId

public String __getId()
Description copied from interface: GrouperSet
if of this object

Specified by:
__getId in interface GrouperSet
Returns:
id
See Also:
GrouperSet.__getId()

__getIfHasElementId

public String __getIfHasElementId()
Description copied from interface: GrouperSet
if has this element id then has another element id

Specified by:
__getIfHasElementId in interface GrouperSet
Returns:
id
See Also:
GrouperSet.__getIfHasElementId()

__getThenHasElementId

public String __getThenHasElementId()
Description copied from interface: GrouperSet
has this element Id if it has another id

Specified by:
__getThenHasElementId in interface GrouperSet
Returns:
id
See Also:
GrouperSet.__getThenHasElementId()

__getDepth

public int __getDepth()
Description copied from interface: GrouperSet
depth of this relationship (0 means self, 1 means one hop, 2 means 2 hops, etc)

Specified by:
__getDepth in interface GrouperSet
Returns:
depth
See Also:
GrouperSet.__getDepth()

__getIfHasElement

public GrouperSetElement __getIfHasElement()
Description copied from interface: GrouperSet
if has this element then has another element

Specified by:
__getIfHasElement in interface GrouperSet
Returns:
id
See Also:
GrouperSet.__getIfHasElement()

__getThenHasElement

public GrouperSetElement __getThenHasElement()
Description copied from interface: GrouperSet
has this element if it has another

Specified by:
__getThenHasElement in interface GrouperSet
Returns:
id
See Also:
GrouperSet.__getThenHasElement()

__setParentGrouperSetId

public void __setParentGrouperSetId(String grouperSetId)
Description copied from interface: GrouperSet
set the parent id of this set. the parent is the relationship leading up to this relationship. e.g. if this is the graph: A->B->C, and the relationship is A->C, then the parent is A->B

Specified by:
__setParentGrouperSetId in interface GrouperSet
See Also:
GrouperSet.__setParentGrouperSetId(java.lang.String)

__getParentGrouperSet

public GrouperSet __getParentGrouperSet()
Description copied from interface: GrouperSet
get the parent set the parent is the relationship leading up to this relationship. e.g. if this is the graph: A->B->C, and the relationship is A->C, then the parent is A->B

Specified by:
__getParentGrouperSet in interface GrouperSet
Returns:
parent
See Also:
GrouperSet.__getParentGrouperSet()

__getParentGrouperSetId

public String __getParentGrouperSetId()
Description copied from interface: GrouperSet
parent set id

Specified by:
__getParentGrouperSetId in interface GrouperSet
Returns:
parent set id
See Also:
GrouperSet.__getParentGrouperSetId()

xmlCopyBusinessPropertiesToExisting

public void xmlCopyBusinessPropertiesToExisting(RoleSet existingRecord)
Description copied from interface: XmlImportableBase
copy business (non update) properties to an existing record

Specified by:
xmlCopyBusinessPropertiesToExisting in interface XmlImportableBase<RoleSet>
See Also:
XmlImportableBase.xmlCopyBusinessPropertiesToExisting(java.lang.Object)

xmlDifferentBusinessProperties

public boolean xmlDifferentBusinessProperties(RoleSet other)
Description copied from interface: XmlImportableBase
see if the non update cols are different (e.g. name)

Specified by:
xmlDifferentBusinessProperties in interface XmlImportableBase<RoleSet>
Parameters:
other - the one to compare with
Returns:
true if so
See Also:
XmlImportableBase.xmlDifferentBusinessProperties(java.lang.Object)

xmlDifferentUpdateProperties

public boolean xmlDifferentUpdateProperties(RoleSet other)
Description copied from interface: XmlImportableBase
see if the update cols are different (e.g. last updated)

Specified by:
xmlDifferentUpdateProperties in interface XmlImportableBase<RoleSet>
Parameters:
other - the one to compare with
Returns:
true if so
See Also:
XmlImportableBase.xmlDifferentUpdateProperties(java.lang.Object)

xmlRetrieveByIdOrKey

public RoleSet xmlRetrieveByIdOrKey()
Description copied from interface: XmlImportable
retrieve from db by id or key. throws exception if duplicate

Specified by:
xmlRetrieveByIdOrKey in interface XmlImportable<RoleSet>
Returns:
the object or null if not found
See Also:
XmlImportable.xmlRetrieveByIdOrKey()

xmlSaveBusinessProperties

public RoleSet xmlSaveBusinessProperties(RoleSet existingRecord)
Description copied from interface: XmlImportableBase
save the business properties (not update properties)

Specified by:
xmlSaveBusinessProperties in interface XmlImportableBase<RoleSet>
Parameters:
existingRecord - null if insert, the object if exists in DB generally just copy the hibernate version number, and last updated to the object and store it
Returns:
the new object or existing
See Also:
XmlImportableBase.xmlSaveBusinessProperties(java.lang.Object)

xmlSaveUpdateProperties

public void xmlSaveUpdateProperties()
Description copied from interface: XmlImportableBase
save the udpate properties (e.g. last updated). Note, this is done with a sql update statement, not with hibernate

Specified by:
xmlSaveUpdateProperties in interface XmlImportableBase<RoleSet>
See Also:
XmlImportableBase.xmlSaveUpdateProperties()

xmlToExportRoleSet

public XmlExportRoleSet xmlToExportRoleSet(GrouperVersion grouperVersion)
convert to xml bean for export

Parameters:
grouperVersion -
Returns:
xml bean

xmlGetId

public String xmlGetId()
Description copied from interface: XmlImportableBase
set id key in db

Specified by:
xmlGetId in interface XmlImportableBase<RoleSet>
Returns:
id
See Also:
XmlImportableBase.xmlGetId()

xmlSetId

public void xmlSetId(String theId)
Description copied from interface: XmlImportableBase
set id key in db

Specified by:
xmlSetId in interface XmlImportableBase<RoleSet>
See Also:
XmlImportableBase.xmlSetId(java.lang.String)

xmlToString

public String xmlToString()
Description copied from interface: XmlImportableBase
convert to string for log

Specified by:
xmlToString in interface XmlImportableBase<RoleSet>
Returns:
the string value for log
See Also:
XmlImportableBase.xmlToString()

dbVersion

public RoleSet dbVersion()
save the state when retrieving from DB

Overrides:
dbVersion in class GrouperAPI
Returns:
the dbVersion

dbVersionReset

public void dbVersionReset()
take a snapshot of the data since this is what is in the db

Overrides:
dbVersionReset in class GrouperAPI

dbVersionDifferentFields

public Set<String> dbVersionDifferentFields()
Description copied from class: GrouperAPI
see which fields have changed compared to the DB state (last known) note that attributes will print out: attribute__attributeName

Overrides:
dbVersionDifferentFields in class GrouperAPI
Returns:
a set of attributes changed, or empty set if none
See Also:
GrouperAPI.dbVersionDifferentFields()