edu.internet2.middleware.grouper
Class Composite

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

public class Composite
extends GrouperAPI
implements GrouperHasContext, Hib3GrouperVersioned, XmlImportable<Composite>

A composite membership definition within the Groups Registry. A composite group is composed of two groups and a set operator (stored in grouper_composites table) (e.g. union, intersection, etc). A composite group has no immediate members. All subjects in a composite group are effective members.

Since:
1.0
Version:
$Id: Composite.java,v 1.71 2009-12-07 07:31:08 mchyzer Exp $
Author:
blair christensen.
See Also:
Serialized Form

Field Summary
static String COLUMN_ID
          id col in db
static String COLUMN_OLD_ID
          old id col for id conversion
static String COLUMN_OLD_UUID
          old uuid id col for id conversion
static String COLUMN_UUID
          uuid col in db
static String FIELD_CREATE_TIME
          constant for field name for: createTime
static String FIELD_CREATOR_UUID
          constant for field name for: creatorUUID
static String FIELD_DB_VERSION
          constant for field name for: dbVersion
static String FIELD_FACTOR_OWNER_UUID
          constant for field name for: factorOwnerUUID
static String FIELD_LEFT_FACTOR_UUID
          constant for field name for: leftFactorUUID
static String FIELD_RIGHT_FACTOR_UUID
          constant for field name for: rightFactorUUID
static String FIELD_TYPE
          constant for field name for: type
static String FIELD_UUID
          constant for field name for: uuid
static String TABLE_GROUPER_COMPOSITES
          table for composites
 
Fields inherited from class edu.internet2.middleware.grouper.GrouperAPI
COLUMN_HIBERNATE_VERSION_NUMBER, FIELD_HIBERNATE_VERSION_NUMBER, INITIAL_VERSION_NUMBER
 
Fields inherited from interface org.hibernate.classic.Lifecycle
NO_VETO, VETO
 
Constructor Summary
Composite()
           
 
Method Summary
 Composite clone()
          deep clone the fields in this object
 Composite dbVersion()
          save the state when retrieving from DB
 Set<String> dbVersionDifferentFields()
          note, these are massaged so that name, extension, etc look like normal fields.
 void dbVersionReset()
          take a snapshot of the data since this is what is in the db
 boolean equals(Object other)
           
 String getContextId()
          context id of the transaction
 long getCreateTime()
           
 String getCreatorUuid()
           
 String getFactorOwnerUuid()
           
 String getLeftFactorUuid()
           
 Group getLeftGroup()
          Return this Composite's left factor.
 String getName()
           
 Group getOwnerGroup()
          Return this Composite's owner.
 String getRightFactorUuid()
           
 Group getRightGroup()
          Return this Composite's right factor.
 CompositeType getType()
          Return this composite's type.
 String getTypeDb()
          simple getter for type for db
 String getUuid()
           
 int hashCode()
           
static Membership internal_createNewCompositeMembershipObject(String ownerGroupId, String memberUuid, String viaCompositeId)
           
 String internal_getLeftName()
          left name
 String internal_getOwnerName()
          owner name
 String internal_getRightName()
          right name
 void onPostDelete(HibernateSession hibernateSession)
          after a delete occurs
 void onPostSave(HibernateSession hibernateSession)
          after a save (insert) occurs
 void onPostUpdate(HibernateSession hibernateSession)
          after an update occurs
 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 setContextId(String contextId1)
          context id of the transaction
 void setCreateTime(long createTime)
           
 void setCreatorUuid(String creatorUUID)
           
 void setFactorOwnerUuid(String factorOwnerUUID)
           
 void setLeftFactorUuid(String leftFactorUUID)
           
 void setRightFactorUuid(String rightFactorUUID)
           
 void setTypeDb(String type)
           
 void setUuid(String uuid)
           
 void store()
          store this object to the DB.
 String toString()
           
 String toStringDto()
           
 void xmlCopyBusinessPropertiesToExisting(Composite existingRecord)
          copy business (non update) properties to an existing record
 boolean xmlDifferentBusinessProperties(Composite other)
          see if the non update cols are different (e.g.
 boolean xmlDifferentUpdateProperties(Composite other)
          see if the update cols are different (e.g.
 String xmlGetId()
          set id key in db
 Composite xmlRetrieveByIdOrKey()
          retrieve from db by id or key.
 Composite xmlSaveBusinessProperties(Composite 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
 XmlExportComposite xmlToExportComposite(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, onSave, onUpdate, setHibernateVersionNumber
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TABLE_GROUPER_COMPOSITES

public static final String TABLE_GROUPER_COMPOSITES
table for composites

See Also:
Constant Field Values

COLUMN_ID

public static final String COLUMN_ID
id col in db

See Also:
Constant Field Values

COLUMN_UUID

public static final String COLUMN_UUID
uuid col in db

See Also:
Constant Field Values

COLUMN_OLD_ID

public static final String COLUMN_OLD_ID
old id col for id conversion

See Also:
Constant Field Values

COLUMN_OLD_UUID

public static final String COLUMN_OLD_UUID
old uuid id col for id conversion

See Also:
Constant Field Values

FIELD_CREATE_TIME

public static final String FIELD_CREATE_TIME
constant for field name for: createTime

See Also:
Constant Field Values

FIELD_CREATOR_UUID

public static final String FIELD_CREATOR_UUID
constant for field name for: creatorUUID

See Also:
Constant Field Values

FIELD_DB_VERSION

public static final String FIELD_DB_VERSION
constant for field name for: dbVersion

See Also:
Constant Field Values

FIELD_FACTOR_OWNER_UUID

public static final String FIELD_FACTOR_OWNER_UUID
constant for field name for: factorOwnerUUID

See Also:
Constant Field Values

FIELD_LEFT_FACTOR_UUID

public static final String FIELD_LEFT_FACTOR_UUID
constant for field name for: leftFactorUUID

See Also:
Constant Field Values

FIELD_RIGHT_FACTOR_UUID

public static final String FIELD_RIGHT_FACTOR_UUID
constant for field name for: rightFactorUUID

See Also:
Constant Field Values

FIELD_TYPE

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

See Also:
Constant Field Values

FIELD_UUID

public static final String FIELD_UUID
constant for field name for: uuid

See Also:
Constant Field Values
Constructor Detail

Composite

public Composite()
Method Detail

getLeftGroup

public Group getLeftGroup()
                   throws GroupNotFoundException
Return this Composite's left factor.
 try {
   Group left = c.getLeftGroup();
 }
 catch (GroupNotFoundException eGNF) {
   // unable to retrieve group
 }
 

Returns:
Left factor Group.
Throws:
GroupNotFoundException
Since:
1.0

getOwnerGroup

public Group getOwnerGroup()
                    throws GroupNotFoundException
Return this Composite's owner.
 try {
   Group owner = c.geOwnerGroup();
 }
 catch (GroupNotFoundException eGNF) {
   // unable to retrieve group
 }
 

Returns:
Owner Group.
Throws:
GroupNotFoundException
Since:
1.0

getRightGroup

public Group getRightGroup()
                    throws GroupNotFoundException
Return this Composite's right factor.
 try {
   Group right = c.getRightGroup();
 }
 catch (GroupNotFoundException eGNF) {
   // unable to retrieve group
 }
 

Returns:
Right factor Group.
Throws:
GroupNotFoundException
Since:
1.0

getType

public CompositeType getType()
Return this composite's type.
 CompositeType type = c.getType();
 

Returns:
CompositeType of this Composite.
Since:
1.0

getTypeDb

public String getTypeDb()
simple getter for type for db

Returns:
type db

toString

public String toString()
Overrides:
toString in class Object
Returns:
string
Since:
1.0

getName

public String getName()
Returns:
name

internal_getLeftName

public String internal_getLeftName()
left name

Returns:
left name

internal_getOwnerName

public String internal_getOwnerName()
owner name

Returns:
the owner name

internal_getRightName

public String internal_getRightName()
right name

Returns:
right name

equals

public boolean equals(Object other)
Overrides:
equals in class Object
Parameters:
other -
Returns:
if one equals the other
Since:
1.2.0

getCreateTime

public long getCreateTime()
Returns:
create time
Since:
1.2.0

getCreatorUuid

public String getCreatorUuid()
Returns:
creator uuid
Since:
1.2.0

getFactorOwnerUuid

public String getFactorOwnerUuid()
Returns:
factor owner uuid
Since:
1.2.0

getLeftFactorUuid

public String getLeftFactorUuid()
Returns:
left factor uuid
Since:
1.2.0

getRightFactorUuid

public String getRightFactorUuid()
Returns:
right factor uuid
Since:
1.2.0

getUuid

public String getUuid()
Returns:
uuid
Since:
1.2.0

hashCode

public int hashCode()
Overrides:
hashCode in class Object
Returns:
hashcode
Since:
1.2.0

setCreateTime

public void setCreateTime(long createTime)
Parameters:
createTime -
Since:
1.2.0

setCreatorUuid

public void setCreatorUuid(String creatorUUID)
Parameters:
creatorUUID -
Since:
1.2.0

setFactorOwnerUuid

public void setFactorOwnerUuid(String factorOwnerUUID)
Parameters:
factorOwnerUUID -
Since:
1.2.0

setLeftFactorUuid

public void setLeftFactorUuid(String leftFactorUUID)
Parameters:
leftFactorUUID -
Since:
1.2.0

setRightFactorUuid

public void setRightFactorUuid(String rightFactorUUID)
Parameters:
rightFactorUUID -
Since:
1.2.0

setTypeDb

public void setTypeDb(String type)
Parameters:
type -
Since:
1.2.0

setUuid

public void setUuid(String uuid)
Parameters:
uuid -
Since:
1.2.0

toStringDto

public String toStringDto()
Returns:
string
Since:
1.2.0

onPostDelete

public void onPostDelete(HibernateSession hibernateSession)
Description copied from interface: HibGrouperLifecycle
after a delete occurs

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

onPostSave

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

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

onPostUpdate

public void onPostUpdate(HibernateSession hibernateSession)
Description copied from interface: HibGrouperLifecycle
after an update occurs

Specified by:
onPostUpdate in interface HibGrouperLifecycle
Overrides:
onPostUpdate in class GrouperAPI
See Also:
GrouperAPI.onPostUpdate(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)

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)

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)

dbVersion

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

Overrides:
dbVersion in class GrouperAPI
Returns:
the dbVersion

dbVersionDifferentFields

public Set<String> dbVersionDifferentFields()
note, these are massaged so that name, extension, etc look like normal fields. access with fieldValue()

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

dbVersionReset

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

Overrides:
dbVersionReset in class GrouperAPI

clone

public Composite clone()
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()

getContextId

public String getContextId()
context id of the transaction

Returns:
context id

setContextId

public void setContextId(String contextId1)
context id of the transaction

Specified by:
setContextId in interface GrouperHasContext
Parameters:
contextId1 -

internal_createNewCompositeMembershipObject

public static Membership internal_createNewCompositeMembershipObject(String ownerGroupId,
                                                                     String memberUuid,
                                                                     String viaCompositeId)
Parameters:
ownerGroupId -
memberUuid -
viaCompositeId -
Returns:
membership

xmlCopyBusinessPropertiesToExisting

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

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

xmlDifferentBusinessProperties

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

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

xmlDifferentUpdateProperties

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

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

xmlRetrieveByIdOrKey

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

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

xmlSaveBusinessProperties

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

Specified by:
xmlSaveBusinessProperties in interface XmlImportableBase<Composite>
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)

store

public void store()
store this object to the DB.


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<Composite>
See Also:
XmlImportableBase.xmlSaveUpdateProperties()

xmlToExportComposite

public XmlExportComposite xmlToExportComposite(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<Composite>
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<Composite>
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<Composite>
Returns:
the string value for log
See Also:
XmlImportableBase.xmlToString()