Class AttributeAssignActionSet
java.lang.Object
edu.internet2.middleware.grouper.GrouperAPI
edu.internet2.middleware.grouper.attr.assign.AttributeAssignActionSet
- All Implemented Interfaces:
GrouperSet
,HibGrouperLifecycle
,Hib3GrouperVersioned
,GrouperCloneable
,GrouperUtil.FieldValuable
,XmlImportable<AttributeAssignActionSet>
,XmlImportableBase<AttributeAssignActionSet>
,Serializable
,org.hibernate.classic.Lifecycle
public class AttributeAssignActionSet
extends GrouperAPI
implements Hib3GrouperVersioned, GrouperSet, XmlImportable<AttributeAssignActionSet>
Make a directed graph of attribute assign actions. e.g. "admin" implies "read" and "write". RegistryReset.internal_resetRegistryAndAddTestSubjects(); exit; grouperSession = GrouperSession.startRootSession(); root = StemFinder.findRootStem(this.grouperSession); top = this.root.addChildStem("top", "top display name"); -or- top = StemFinder.findByName(grouperSession, "top"); role = top.addChildRole("role", "role"); //make a permission definition permissionDef = top.addChildAttributeDef("permissionDef", AttributeDefType.perm); //make a permission name permissionName = top.addChildAttributeDefName(permissionDef, "permission", "permission"); //set the list of allowed actions for this permission definition permissionDef.getAttributeDefActionDelegate().configureActionList("admin,read,write"); admin = permissionDef.getAttributeDefActionDelegate().allowedAction("admin", true); read = permissionDef.getAttributeDefActionDelegate().allowedAction("read", true); write = permissionDef.getAttributeDefActionDelegate().allowedAction("write", true); //if someone has admin, then they have read or write admin.getAttributeAssignActionSetDelegate().addToAttributeAssignActionSet(read); admin.getAttributeAssignActionSetDelegate().addToAttributeAssignActionSet(write); //assign admin permission to a role role.getPermissionRoleDelegate().assignRolePermission("admin", permissionName); //assign the role to a user role.addMember(SubjectFinder.findById("test.subject.0")); //see what permissions that user has (true is returned to all) GrouperDAOFactory.getFactory().getPermissionEntry().hasPermissionBySubjectIdSourceIdActionAttributeDefName("test.subject.0", "jdbc", "admin", "top:permission"); GrouperDAOFactory.getFactory().getPermissionEntry().hasPermissionBySubjectIdSourceIdActionAttributeDefName("test.subject.0", "jdbc", "read", "top:permission"); GrouperDAOFactory.getFactory().getPermissionEntry().hasPermissionBySubjectIdSourceIdActionAttributeDefName("test.subject.0", "jdbc", "write", "top:permission");
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
columnstatic final String
columnstatic final String
columnstatic final String
columnstatic final String
columnstatic final String
columnstatic final String
columnstatic final String
columnstatic final String
columnstatic final String
constant for field name for: contextIdstatic final String
constant for field name for: createdOnDbstatic final String
constant for field name for: depthstatic final String
constant for field name for: idstatic final String
constant for field name for: ifHasAttributeAssignActionIdstatic final String
constant for field name for: lastUpdatedDbstatic final String
constant for field name for: parentAttrAssignActionSetIdstatic final String
constant for field name for: thenHasAttributeAssignActionIdstatic final String
constant for field name for: typestatic final String
name of the groups attribute assign action setFields inherited from class edu.internet2.middleware.grouper.GrouperAPI
COLUMN_HIBERNATE_VERSION_NUMBER, dbVersion, FIELD_DB_VERSION, FIELD_HIBERNATE_VERSION_NUMBER, INITIAL_VERSION_NUMBER
Fields inherited from interface org.hibernate.classic.Lifecycle
NO_VETO, VETO
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
depth of this relationship (0 means self, 1 means one hop, 2 means 2 hops, etc)__getId()
if of this objectif has this element then has another elementif has this element id then has another element idget the parent set the parent is the relationship leading up to this relationship.parent set idhas this element if it has anotherhas this element Id if it has another idvoid
__setParentGrouperSetId
(String grouperSetId) set the parent id of this set.clone()
deep clone the fields in this objectsave the state when retrieving from DBsee which fields have changed compared to the DB state (last known) note that attributes will print out: attribute__attributeNamevoid
take a snapshot of the data since this is what is in the dbvoid
delete()
delete this objectboolean
static AttributeAssignActionSet
findInCollection
(Collection<AttributeAssignActionSet> attributeDefNameSets, String ifHasId, String thenHasId, int depth, boolean exceptionIfNull) find an attribute def name set, better be herecontext id of the transactionwhen createdwhen createdint
getDepth()
getId()
when last updatedwhen last updatedfor self, or immediate, just use this id.getType()
get string value of type for hibernateint
hashCode()
void
onPreDelete
(HibernateSession hibernateSession) before a delete (insert) occursvoid
onPreSave
(HibernateSession hibernateSession) before a save (insert) occursvoid
onPreUpdate
(HibernateSession hibernateSession) before an update occursvoid
save or update this objectvoid
setContextId
(String contextId) set context idvoid
setCreatedOn
(Timestamp createdOn1) when createdvoid
setCreatedOnDb
(Long createdOn1) when createdvoid
setDepth
(int depth) set depthvoid
set idvoid
setIfHasAttrAssignActionId
(String memberAttributeAssignActionId) Set attribute def name id for the childvoid
setLastUpdated
(Timestamp lastUpdated1) when last updatedvoid
setLastUpdatedDb
(Long lastUpdated1) when last updatedvoid
setParentAttrAssignActionSetId
(String parentId1) for self, or immediate, just use this id.void
setThenHasAttrAssignActionId
(String ownerAttributeDefId) Set attribute def id for the ownervoid
setType
(AttributeAssignActionType type1) set group set assignment typevoid
set group set assignment typetoString()
void
xmlCopyBusinessPropertiesToExisting
(AttributeAssignActionSet existingRecord) copy business (non update) properties to an existing recordboolean
see if the non update cols are different (e.g.boolean
see if the update cols are different (e.g.xmlGetId()
set id key in dbretrieve from db by id or key.xmlSaveBusinessProperties
(AttributeAssignActionSet existingRecord) save the business properties (not update properties)void
save the udpate properties (e.g.void
set id key in dbxmlToExportAttributeAssignActionSet
(GrouperVersion grouperVersion) convert to xml bean for exportconvert to string for logMethods inherited from class edu.internet2.middleware.grouper.GrouperAPI
dbVersionClear, dbVersionIsDifferent, fieldValue, getHibernateVersionNumber, onDelete, onLoad, onPostDelete, onPostSave, onPostUpdate, onSave, onUpdate, setHibernateVersionNumber
-
Field Details
-
TABLE_GROUPER_ATTR_ASSIGN_ACTION_SET
name of the groups attribute assign action set- See Also:
-
COLUMN_CONTEXT_ID
column- See Also:
-
COLUMN_CREATED_ON
column- See Also:
-
COLUMN_LAST_UPDATED
column- See Also:
-
COLUMN_ID
column- See Also:
-
COLUMN_DEPTH
column- See Also:
-
COLUMN_IF_HAS_ATTR_ASSN_ACTION_ID
column- See Also:
-
COLUMN_THEN_HAS_ATTR_ASSN_ACTION_ID
column- See Also:
-
COLUMN_PARENT_ATTR_ASSN_ACTION_ID
column- See Also:
-
COLUMN_TYPE
column- See Also:
-
FIELD_CONTEXT_ID
constant for field name for: contextId- See Also:
-
FIELD_CREATED_ON_DB
constant for field name for: createdOnDb- See Also:
-
FIELD_DEPTH
constant for field name for: depth- See Also:
-
FIELD_ID
constant for field name for: id- See Also:
-
FIELD_IF_HAS_ATTR_ASSIGN_ACTION_ID
constant for field name for: ifHasAttributeAssignActionId- See Also:
-
FIELD_LAST_UPDATED_DB
constant for field name for: lastUpdatedDb- See Also:
-
FIELD_PARENT_ATTR_ASSIGN_ACTION_SET_ID
constant for field name for: parentAttrAssignActionSetId- See Also:
-
FIELD_THEN_HAS_ATTR_ASSIGN_ACTION_ID
constant for field name for: thenHasAttributeAssignActionId- See Also:
-
FIELD_TYPE
constant for field name for: type- See Also:
-
-
Constructor Details
-
AttributeAssignActionSet
public AttributeAssignActionSet()
-
-
Method Details
-
toString
-
findInCollection
public static AttributeAssignActionSet findInCollection(Collection<AttributeAssignActionSet> attributeDefNameSets, String ifHasId, String thenHasId, int depth, boolean exceptionIfNull) find an attribute def name set, better be here- Parameters:
attributeDefNameSets
-ifHasId
-thenHasId
-depth
- is the depth expectingexceptionIfNull
-- Returns:
- the def name set
-
equals
-
hashCode
public int hashCode() -
clone
Description copied from class:GrouperAPI
deep clone the fields in this object- Specified by:
clone
in interfaceGrouperCloneable
- Specified by:
clone
in classGrouperAPI
- Returns:
- the clone of the object
- See Also:
-
getParentAttributeDefSet
- Returns:
- the parent group set or null if none
-
getIfHasAttributeAssignAction
- Returns:
- the parent group set or null if none
-
getThenHasAttributeAssignAction
- Returns:
- the parent group set or null if none
-
getId
- Returns:
- id
-
setId
set id- Parameters:
id
-
-
setContextId
set context id- Parameters:
contextId
-
-
getParentAttrAssignActionSetId
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
-
setParentAttrAssignActionSetId
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
-
-
getThenHasAttrAssignActionId
- Returns:
- attribute def id for the owner
-
setThenHasAttrAssignActionId
Set attribute def id for the owner- Parameters:
ownerAttributeDefId
-
-
getIfHasAttrAssignActionId
- Returns:
- member attribute def name id for the child
-
setIfHasAttrAssignActionId
Set attribute def name id for the child- Parameters:
memberAttributeAssignActionId
-
-
getType
- Returns:
- membership type (immediate, effective, or composite)
-
getTypeDb
get string value of type for hibernate- Returns:
- type
-
setType
set group set assignment type- Parameters:
type1
-
-
setTypeDb
set group set assignment type- Parameters:
type1
-
-
getDepth
public int getDepth()- Returns:
- depth
-
setDepth
public void setDepth(int depth) set depth- Parameters:
depth
-
-
getContextId
context id of the transaction- Returns:
- context id
-
getCreatedOn
when created- Returns:
- timestamp
-
getCreatedOnDb
when created- Returns:
- timestamp
-
getLastUpdated
when last updated- Returns:
- timestamp
-
getLastUpdatedDb
when last updated- Returns:
- timestamp
-
saveOrUpdate
public void saveOrUpdate()save or update this object- Specified by:
saveOrUpdate
in interfaceGrouperSet
-
delete
public void delete()delete this object- Specified by:
delete
in interfaceGrouperSet
-
setCreatedOnDb
when created- Parameters:
createdOn1
-
-
setCreatedOn
when created- Parameters:
createdOn1
-
-
setLastUpdated
when last updated- Parameters:
lastUpdated1
-
-
setLastUpdatedDb
when last updated- Parameters:
lastUpdated1
-
-
__getId
Description copied from interface:GrouperSet
if of this object- Specified by:
__getId
in interfaceGrouperSet
- Returns:
- id
- See Also:
-
__getIfHasElementId
Description copied from interface:GrouperSet
if has this element id then has another element id- Specified by:
__getIfHasElementId
in interfaceGrouperSet
- Returns:
- id
- See Also:
-
__getThenHasElementId
Description copied from interface:GrouperSet
has this element Id if it has another id- Specified by:
__getThenHasElementId
in interfaceGrouperSet
- Returns:
- id
- See Also:
-
__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 interfaceGrouperSet
- Returns:
- depth
- See Also:
-
__getIfHasElement
Description copied from interface:GrouperSet
if has this element then has another element- Specified by:
__getIfHasElement
in interfaceGrouperSet
- Returns:
- id
- See Also:
-
__getThenHasElement
Description copied from interface:GrouperSet
has this element if it has another- Specified by:
__getThenHasElement
in interfaceGrouperSet
- Returns:
- id
- See Also:
-
__setParentGrouperSetId
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 interfaceGrouperSet
- See Also:
-
__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 interfaceGrouperSet
- Returns:
- parent
- See Also:
-
__getParentGrouperSetId
Description copied from interface:GrouperSet
parent set id- Specified by:
__getParentGrouperSetId
in interfaceGrouperSet
- Returns:
- parent set id
- See Also:
-
xmlCopyBusinessPropertiesToExisting
Description copied from interface:XmlImportableBase
copy business (non update) properties to an existing record- Specified by:
xmlCopyBusinessPropertiesToExisting
in interfaceXmlImportableBase<AttributeAssignActionSet>
- See Also:
-
xmlDifferentBusinessProperties
Description copied from interface:XmlImportableBase
see if the non update cols are different (e.g. name)- Specified by:
xmlDifferentBusinessProperties
in interfaceXmlImportableBase<AttributeAssignActionSet>
- Parameters:
other
- the one to compare with- Returns:
- true if so
- See Also:
-
xmlDifferentUpdateProperties
Description copied from interface:XmlImportableBase
see if the update cols are different (e.g. last updated)- Specified by:
xmlDifferentUpdateProperties
in interfaceXmlImportableBase<AttributeAssignActionSet>
- Parameters:
other
- the one to compare with- Returns:
- true if so
- See Also:
-
xmlRetrieveByIdOrKey
Description copied from interface:XmlImportable
retrieve from db by id or key. throws exception if duplicate- Specified by:
xmlRetrieveByIdOrKey
in interfaceXmlImportable<AttributeAssignActionSet>
- Returns:
- the object or null if not found
- See Also:
-
xmlSaveBusinessProperties
Description copied from interface:XmlImportableBase
save the business properties (not update properties)- Specified by:
xmlSaveBusinessProperties
in interfaceXmlImportableBase<AttributeAssignActionSet>
- 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:
-
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 interfaceXmlImportableBase<AttributeAssignActionSet>
- See Also:
-
xmlToExportAttributeAssignActionSet
public XmlExportAttributeAssignActionSet xmlToExportAttributeAssignActionSet(GrouperVersion grouperVersion) convert to xml bean for export- Parameters:
grouperVersion
-- Returns:
- xml bean
-
xmlGetId
Description copied from interface:XmlImportableBase
set id key in db- Specified by:
xmlGetId
in interfaceXmlImportableBase<AttributeAssignActionSet>
- Returns:
- id
- See Also:
-
xmlSetId
Description copied from interface:XmlImportableBase
set id key in db- Specified by:
xmlSetId
in interfaceXmlImportableBase<AttributeAssignActionSet>
- See Also:
-
xmlToString
Description copied from interface:XmlImportableBase
convert to string for log- Specified by:
xmlToString
in interfaceXmlImportableBase<AttributeAssignActionSet>
- Returns:
- the string value for log
- See Also:
-
onPreSave
Description copied from interface:HibGrouperLifecycle
before a save (insert) occurs- Specified by:
onPreSave
in interfaceHibGrouperLifecycle
- Overrides:
onPreSave
in classGrouperAPI
- See Also:
-
onPreDelete
Description copied from interface:HibGrouperLifecycle
before a delete (insert) occurs- Specified by:
onPreDelete
in interfaceHibGrouperLifecycle
- Overrides:
onPreDelete
in classGrouperAPI
- See Also:
-
onPreUpdate
Description copied from interface:HibGrouperLifecycle
before an update occurs- Specified by:
onPreUpdate
in interfaceHibGrouperLifecycle
- Overrides:
onPreUpdate
in classGrouperAPI
- See Also:
-
dbVersion
save the state when retrieving from DB- Overrides:
dbVersion
in classGrouperAPI
- Returns:
- the dbVersion
-
dbVersionReset
public void dbVersionReset()take a snapshot of the data since this is what is in the db- Overrides:
dbVersionReset
in classGrouperAPI
-
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 classGrouperAPI
- Returns:
- a set of attributes changed, or empty set if none
- See Also:
-