edu.internet2.middleware.grouper
Class Membership

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

public class Membership
extends GrouperAPI
implements GrouperHasContext, Hib3GrouperVersioned, XmlImportable<Membership>, AttributeAssignable

A list membership in the Groups Registry. A membership is the object which represents a join of member and group. Has metadata like type and creator, and, if an effective membership, the parent membership

Version:
$Id: Membership.java,v 1.141 2009-12-21 06:15:02 mchyzer Exp $
Author:
blair christensen.
See Also:
Serialized Form

Field Summary
static String CACHE_GET_ATTR_DEF
           
static String CACHE_GET_GROUP
           
static String CACHE_GET_STEM
           
static String COLUMN_CREATE_TIME
          col
static String COLUMN_CREATOR_ID
          col
static String COLUMN_DEPTH
           
static String COLUMN_DEPTH_BAK
           
static String COLUMN_DISABLED_TIMESTAMP
          epoch time of when to disable membership
static String COLUMN_ENABLED
          whether the membership is enabled or disabled: T|F
static String COLUMN_ENABLED_TIMESTAMP
          epoch time of when to enable membership
static String COLUMN_FIELD_ID
          id col in db
static String COLUMN_ID
          id col in db
static String COLUMN_LIST_NAME
          list_name col in db
static String COLUMN_LIST_TYPE
          list_type col in db
static String COLUMN_MEMBER_ID
          col
static String COLUMN_MEMBERSHIP_UUID
          uuid col in db
static String COLUMN_MSHIP_TYPE
          col
static String COLUMN_OLD_ID
          old id col for id conversion
static String COLUMN_OLD_LIST_NAME
          old_list_name col in db
static String COLUMN_OLD_LIST_TYPE
          old_list_type col in db
static String COLUMN_OLD_MEMBERSHIP_UUID
          old uuid id col for id conversion
static String COLUMN_OWNER_ATTR_DEF_ID
           
static String COLUMN_OWNER_GROUP_ID
           
static String COLUMN_OWNER_ID
           
static String COLUMN_OWNER_STEM_ID
           
static String COLUMN_PARENT_MEMBERSHIP
           
static String COLUMN_PARENT_MEMBERSHIP_BAK
          col
static String COLUMN_VIA_COMPOSITE_ID
           
static String COLUMN_VIA_ID
           
static String COLUMN_VIA_ID_BAK
           
static String COMPOSITE
          Deprecated. 
static String EFFECTIVE
          Deprecated. 
static String FIELD_CONTEXT_ID
          constant for field name for: contextId
static String FIELD_CREATE_TIME_LONG
          constant for field name for: createTimeLong
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_DEPTH
          constant for field name for: depth
static String FIELD_DISABLED_TIME_DB
          constant for field name for: disabledTimeDb
static String FIELD_ENABLED
          constant for field name for: enabled
static String FIELD_ENABLED_TIME_DB
          constant for field name for: enabledTimeDb
static String FIELD_FIELD_ID
          constant for field name for: fieldId
static String FIELD_GROUP_SET_CREATE_TIME_LONG
          constant for field name for: groupSetCreateTimeLong
static String FIELD_GROUP_SET_CREATOR_UUID
          constant for field name for: groupSetCreatorUUID
static String FIELD_GROUP_SET_ID
          constant for field name for: groupSetId
static String FIELD_GROUP_SET_PARENT_ID
          constant for field name for: groupSetParentId
static String FIELD_IMMEDIATE_MEMBERSHIP_ID
          constant for field name for: immediateMembershipId
static String FIELD_MEMBER_UUID
          constant for field name for: memberUUID
static String FIELD_OWNER_ATTR_DEF_ID
          constant for field name for: ownerAttrDefId
static String FIELD_OWNER_GROUP_ID
          constant for field name for: ownerGroupId
static String FIELD_OWNER_STEM_ID
          constant for field name for: ownerStemId
static String FIELD_TYPE
          constant for field name for: type
static String FIELD_UUID
          constant for field name for: uuid
static String FIELD_VIA_COMPOSITE_ID
          constant for field name for: viaCompositeId
static String FIELD_VIA_GROUP_ID
          constant for field name for: viaGroupId
static String IMMEDIATE
          Deprecated. 
static String membershipIdSeparator
          separator used in the uuid field to split immediate_membership_id and group_set_id
static String OWNER_TYPE_ATTRIBUTE_DEF
          attr def owner type for change log
static String OWNER_TYPE_GROUP
          group owner type for change log
static String OWNER_TYPE_STEM
          stem owner type for change log
static String TABLE_GROUPER_MEMBERSHIPS
          table name where memberships are stored
 
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
Membership()
           
 
Method Summary
 void addMembershipAddChangeLog()
          add a change log entry for a membership add
 void addMembershipDeleteChangeLog(Member member)
          add a change log entry for a membership delete
 Membership clone()
          deep clone the fields in this object
 Membership 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
 void delete()
          delete this record (and security and actions etc, but not attribute def names yet)
 void deleteAndStore()
          e.g.
 boolean equals(Object other)
           
 AttributeDef getAttributeDef()
          Deprecated. use getOwnerAttributeDef() instead
 AttributeAssignMembershipDelegate getAttributeDelegate()
          get the logic delegate
 AttributeAssignEffMshipDelegate getAttributeDelegateEffMship()
          delegate for effective memberships
 AttributeValueDelegate getAttributeValueDelegate()
          this delegate works on attributes and values at the same time
 AttributeValueDelegate getAttributeValueDelegateEffMship()
          this delegate works on attributes and values at the same time
 Set getChildMemberships()
          Get child memberships of this membership.
 String getContextId()
          context id of the transaction
 Date getCreateTime()
           
 long getCreateTimeLong()
          This returns the create time of the membership.
 Member getCreator()
           
 String getCreatorUuid()
          This returns the creator of the membership.
 int getDepth()
          number of hops between this membership and direct membership
 Timestamp getDisabledTime()
          Time when this membership is disabled if the value is in the future.
 Long getDisabledTimeDb()
          Time when this membership is disabled if the value is in the future.
 String getEnabledDb()
          Whether or not this membership is enabled.
 Timestamp getEnabledTime()
          Time when this membership is enabled if the value is in the future.
 Long getEnabledTimeDb()
          Time when this membership is enabled if the value is in the future.
 Field getField()
          get the field based on field id (if there is one there)
 String getFieldId()
          id of the field which is the list name and type
 Group getGroup()
          Deprecated. use getOwnerGroup() instead
 String getGroupName()
          getter for group name if group membership
 long getGroupSetCreateTimeLong()
           
 String getGroupSetCreatorUuid()
           
 String getGroupSetId()
           
 String getGroupSetParentId()
           
 String getImmediateFieldId()
          id of the field for the immediate membership that causes this membership
 String getImmediateMembershipId()
           
 Field getList()
          Get this membership's list.
 String getListName()
           
 String getListType()
           
 Member getMember()
          Get this membership's member.
 String getMemberSourceId()
           
 String getMemberSubjectId()
           
 String getMemberUuid()
           
 String getOwnerAttrDefId()
          if attrDef membership, this is the attrDef id
 AttributeDef getOwnerAttributeDef()
          Get this membership's group.
 Group getOwnerGroup()
          Get this membership's group.
 String getOwnerGroupId()
          if group membership, this is the group id
 String getOwnerId()
          get the owner id
 String getOwnerName()
          get the name of the owner (group or stem)
 Stem getOwnerStem()
           
 String getOwnerStemId()
          if this is a stem membership, this is the stem id
 Membership getParentMembership()
          Get parent membership of this membership.
 String getParentUuid()
           
 Stem getStem()
          Deprecated. use getOwnerStem() instead
 String getType()
           
 MembershipType getTypeEnum()
          get MembershipType of type
 String getUuid()
           
 Composite getViaComposite()
          A composite group is composed of two groups and a set operator (stored in grouper_composites table) (e.g.
 String getViaCompositeId()
          if composite, this is composite id
 Group getViaGroup()
          Get this membership's via group.
 String getViaGroupId()
          if effective, this is group it is in
 int hashCode()
           
static Membership internal_addImmediateMembership(GrouperSession s, AttributeDef attributeDef, edu.internet2.middleware.subject.Subject subj, Field f, String uuid)
           
static Membership internal_addImmediateMembership(GrouperSession s, Group g, edu.internet2.middleware.subject.Subject subj, Field f, String uuid, Timestamp startDate, Timestamp endDate)
           
static Membership internal_addImmediateMembership(GrouperSession s, Stem ns, edu.internet2.middleware.subject.Subject subj, Field f, String uuid)
           
static void internal_deleteAllField(GrouperSession s, AttributeDef attributeDef, Field f)
           
static void internal_deleteAllField(GrouperSession s, Group g, Field f)
           
static void internal_deleteAllField(GrouperSession s, Stem ns, Field f)
           
static void internal_deleteAllFieldType(GrouperSession s, AttributeDef attributeDef, FieldType type)
           
static void internal_deleteAllFieldType(GrouperSession s, Group g, FieldType type)
           
static void internal_deleteAllFieldType(GrouperSession s, Stem ns, FieldType type)
           
static Membership internal_delImmediateMembership(GrouperSession s, AttributeDef attributeDef, edu.internet2.middleware.subject.Subject subj, Field f)
           
static Membership internal_delImmediateMembership(GrouperSession s, Group g, edu.internet2.middleware.subject.Subject subj, Field f)
           
static Membership internal_delImmediateMembership(GrouperSession s, Stem ns, edu.internet2.middleware.subject.Subject subj, Field f)
           
static int internal_fixEnabledDisabled()
          fix enabled and disabled memberships, and return the count of how many were fixed
 boolean isComposite()
          if this is a composite membership
 boolean isEffective()
          if this is a effective membership
 boolean isEnabled()
          Is this membership enabled? Only applies to immediate memberships.
 boolean isImmediate()
          if this is a immediate membership
static String membershipOwnerMemberToString(Collection<Object[]> membershipGroupMembers)
          convert membership owner member to string
 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
static void resolveSubjects(Collection<Object[]> rows)
          resolve subjects from a collection of arrays of rows of object (typically members are the 3rd index)
static Set<Group> retrieveGroups(Collection<Membership> memberships)
          retrieve a set of groups based on some memberships (and store in each membership, like getGroup
 void setContextId(String contextId1)
          context id of the transaction
 void setCreateTimeLong(long createTime)
           
 void setCreatorUuid(String creatorUUID)
           
 void setDepth(int depth)
           
 void setDisabledTime(Timestamp disabledTimeDb)
          Set the time to disable this membership.
 void setDisabledTimeDb(Long disabledTimeDb)
          Set the time to disable this membership.
 void setEnabled(boolean enabled)
          Whether to enable or disable this membership.
 void setEnabledDb(String enabled)
          Whether to enable or disable this membership.
 void setEnabledTime(Timestamp enabledTimeDb)
          Set the time when this membership should be enabled.
 void setEnabledTimeDb(Long enabledTimeDb)
          Set the time when this membership should be enabled.
 void setFieldId(String fieldId1)
          id of the field which is the list name and type
 void setGroupSetCreateTimeLong(long groupSetCreateTimeLong)
           
 void setGroupSetCreatorUuid(String groupSetCreatorUUID)
           
 void setGroupSetId(String groupSetId)
           
 void setGroupSetParentId(String groupSetParentId)
           
 void setImmediateFieldId(String immediateFieldId)
          id of the field for the immediate membership that causes this membership
 void setImmediateMembershipId(String immediateMembershipId)
          Set the immediate membership id
 void setMember(Member member)
          this can be called to set the member object even though the memberuuid is not changing
 void setMemberUuid(String memberUUID)
           
 void setOwnerAttrDefId(String attrDefId1)
          if this is an attrDef membership, this is the attrDef id
 void setOwnerAttributeDef(AttributeDef attributeDef)
          set the owner attributeDef
 void setOwnerGroup(Group group)
          set the owner group
 void setOwnerGroupId(String groupId1)
          if this is a group membership, this is the group id
 void setOwnerId(String owner)
          This is for internal use only.
 void setOwnerStem(Stem stem)
          set the owner stem
 void setOwnerStemId(String stemId1)
          if this is a stem membership, this is the stem id
 void setType(String type)
           
 void setUuid(String uuid)
           
 void setViaCompositeId(String viaCompositeId)
          if composite, this is composite id
 void setViaGroupId(String viaGroupId)
          if effective, this is group it is in
 String toString()
           
 void update()
          update this record to the DB
 void xmlCopyBusinessPropertiesToExisting(Membership existingRecord)
          copy business (non update) properties to an existing record
 boolean xmlDifferentBusinessProperties(Membership other)
          see if the non update cols are different (e.g.
 boolean xmlDifferentUpdateProperties(Membership other)
          see if the update cols are different (e.g.
 String xmlGetId()
          set id key in db
 Membership xmlRetrieveByIdOrKey()
          retrieve from db by id or key.
 Membership xmlSaveBusinessProperties(Membership 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
 XmlExportMembership xmlToExportMembership(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

FIELD_CONTEXT_ID

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

See Also:
Constant Field Values

TABLE_GROUPER_MEMBERSHIPS

public static final String TABLE_GROUPER_MEMBERSHIPS
table name where memberships are stored

See Also:
Constant Field Values

COLUMN_ID

public static final String COLUMN_ID
id col in db

See Also:
Constant Field Values

COLUMN_FIELD_ID

public static final String COLUMN_FIELD_ID
id col in db

See Also:
Constant Field Values

COLUMN_LIST_NAME

public static final String COLUMN_LIST_NAME
list_name col in db

See Also:
Constant Field Values

COLUMN_LIST_TYPE

public static final String COLUMN_LIST_TYPE
list_type col in db

See Also:
Constant Field Values

COLUMN_OLD_LIST_NAME

public static final String COLUMN_OLD_LIST_NAME
old_list_name col in db

See Also:
Constant Field Values

COLUMN_OLD_LIST_TYPE

public static final String COLUMN_OLD_LIST_TYPE
old_list_type col in db

See Also:
Constant Field Values

COLUMN_MEMBERSHIP_UUID

public static final String COLUMN_MEMBERSHIP_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_MEMBERSHIP_UUID

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

See Also:
Constant Field Values

COLUMN_DISABLED_TIMESTAMP

public static final String COLUMN_DISABLED_TIMESTAMP
epoch time of when to disable membership

See Also:
Constant Field Values

COLUMN_ENABLED_TIMESTAMP

public static final String COLUMN_ENABLED_TIMESTAMP
epoch time of when to enable membership

See Also:
Constant Field Values

COLUMN_ENABLED

public static final String COLUMN_ENABLED
whether the membership is enabled or disabled: T|F

See Also:
Constant Field Values

FIELD_CREATE_TIME_LONG

public static final String FIELD_CREATE_TIME_LONG
constant for field name for: createTimeLong

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_GROUP_SET_CREATE_TIME_LONG

public static final String FIELD_GROUP_SET_CREATE_TIME_LONG
constant for field name for: groupSetCreateTimeLong

See Also:
Constant Field Values

FIELD_GROUP_SET_CREATOR_UUID

public static final String FIELD_GROUP_SET_CREATOR_UUID
constant for field name for: groupSetCreatorUUID

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_DEPTH

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

See Also:
Constant Field Values

FIELD_FIELD_ID

public static final String FIELD_FIELD_ID
constant for field name for: fieldId

See Also:
Constant Field Values

FIELD_MEMBER_UUID

public static final String FIELD_MEMBER_UUID
constant for field name for: memberUUID

See Also:
Constant Field Values

FIELD_OWNER_GROUP_ID

public static final String FIELD_OWNER_GROUP_ID
constant for field name for: ownerGroupId

See Also:
Constant Field Values

FIELD_OWNER_STEM_ID

public static final String FIELD_OWNER_STEM_ID
constant for field name for: ownerStemId

See Also:
Constant Field Values

FIELD_OWNER_ATTR_DEF_ID

public static final String FIELD_OWNER_ATTR_DEF_ID
constant for field name for: ownerAttrDefId

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

FIELD_GROUP_SET_ID

public static final String FIELD_GROUP_SET_ID
constant for field name for: groupSetId

See Also:
Constant Field Values

FIELD_VIA_COMPOSITE_ID

public static final String FIELD_VIA_COMPOSITE_ID
constant for field name for: viaCompositeId

See Also:
Constant Field Values

FIELD_VIA_GROUP_ID

public static final String FIELD_VIA_GROUP_ID
constant for field name for: viaGroupId

See Also:
Constant Field Values

FIELD_GROUP_SET_PARENT_ID

public static final String FIELD_GROUP_SET_PARENT_ID
constant for field name for: groupSetParentId

See Also:
Constant Field Values

FIELD_IMMEDIATE_MEMBERSHIP_ID

public static final String FIELD_IMMEDIATE_MEMBERSHIP_ID
constant for field name for: immediateMembershipId

See Also:
Constant Field Values

FIELD_DISABLED_TIME_DB

public static final String FIELD_DISABLED_TIME_DB
constant for field name for: disabledTimeDb

See Also:
Constant Field Values

FIELD_ENABLED

public static final String FIELD_ENABLED
constant for field name for: enabled

See Also:
Constant Field Values

FIELD_ENABLED_TIME_DB

public static final String FIELD_ENABLED_TIME_DB
constant for field name for: enabledTimeDb

See Also:
Constant Field Values

COMPOSITE

@Deprecated
public static final String COMPOSITE
Deprecated. 
A member of a group (aka composite member) has either or both of an immediate (direct) membership, or an effective (indirect) membership use MembershipType.COMPOSITE.getTypeString() instead

See Also:
Constant Field Values

EFFECTIVE

@Deprecated
public static final String EFFECTIVE
Deprecated. 
An effective member has an indirect membership to a group (e.g. in a group within a group). All subjects in a composite group are effective members (since the composite group has two groups and a set operator and no other immediate members). Note that a member can have 0 to 1 immediate memberships to a single group, and 0 to many effective memberships to a group. 'group within a group' can be nested to any level so long as it does not become circular. A group can have potentially unlimited effective memberships use MembershipType.EFFECTIVE.getTypeString() instead

See Also:
Constant Field Values

IMMEDIATE

@Deprecated
public static final String IMMEDIATE
Deprecated. 
An immediate member is directly assigned to a group. A composite group has no immediate members. Note that a member can have 0 to 1 immediate memberships to a single group, and 0 to many effective memberships to a group. A group can have potentially unlimited effective memberships use MembershipType.IMMEDIATE.getTypeString() instead

See Also:
Constant Field Values

OWNER_TYPE_GROUP

public static final String OWNER_TYPE_GROUP
group owner type for change log

See Also:
Constant Field Values

OWNER_TYPE_STEM

public static final String OWNER_TYPE_STEM
stem owner type for change log

See Also:
Constant Field Values

OWNER_TYPE_ATTRIBUTE_DEF

public static final String OWNER_TYPE_ATTRIBUTE_DEF
attr def owner type for change log

See Also:
Constant Field Values

membershipIdSeparator

public static final String membershipIdSeparator
separator used in the uuid field to split immediate_membership_id and group_set_id

See Also:
Constant Field Values

CACHE_GET_GROUP

public static final String CACHE_GET_GROUP

CACHE_GET_ATTR_DEF

public static final String CACHE_GET_ATTR_DEF

CACHE_GET_STEM

public static final String CACHE_GET_STEM

COLUMN_VIA_ID_BAK

public static final String COLUMN_VIA_ID_BAK
See Also:
Constant Field Values

COLUMN_VIA_COMPOSITE_ID

public static final String COLUMN_VIA_COMPOSITE_ID
See Also:
Constant Field Values

COLUMN_OWNER_STEM_ID

public static final String COLUMN_OWNER_STEM_ID
See Also:
Constant Field Values

COLUMN_OWNER_GROUP_ID

public static final String COLUMN_OWNER_GROUP_ID
See Also:
Constant Field Values

COLUMN_OWNER_ATTR_DEF_ID

public static final String COLUMN_OWNER_ATTR_DEF_ID
See Also:
Constant Field Values

COLUMN_OWNER_ID

public static final String COLUMN_OWNER_ID
See Also:
Constant Field Values

COLUMN_VIA_ID

public static final String COLUMN_VIA_ID
See Also:
Constant Field Values

COLUMN_DEPTH

public static final String COLUMN_DEPTH
See Also:
Constant Field Values

COLUMN_DEPTH_BAK

public static final String COLUMN_DEPTH_BAK
See Also:
Constant Field Values

COLUMN_PARENT_MEMBERSHIP

public static final String COLUMN_PARENT_MEMBERSHIP
See Also:
Constant Field Values

COLUMN_PARENT_MEMBERSHIP_BAK

public static final String COLUMN_PARENT_MEMBERSHIP_BAK
col

See Also:
Constant Field Values

COLUMN_MEMBER_ID

public static final String COLUMN_MEMBER_ID
col

See Also:
Constant Field Values

COLUMN_MSHIP_TYPE

public static final String COLUMN_MSHIP_TYPE
col

See Also:
Constant Field Values

COLUMN_CREATOR_ID

public static final String COLUMN_CREATOR_ID
col

See Also:
Constant Field Values

COLUMN_CREATE_TIME

public static final String COLUMN_CREATE_TIME
col

See Also:
Constant Field Values
Constructor Detail

Membership

public Membership()
Method Detail

resolveSubjects

public static void resolveSubjects(Collection<Object[]> rows)
resolve subjects from a collection of arrays of rows of object (typically members are the 3rd index)

Parameters:
rows -

update

public void update()
update this record to the DB


getOwnerName

public String getOwnerName()
get the name of the owner (group or stem)

Returns:
the name

getAttributeDelegate

public AttributeAssignMembershipDelegate getAttributeDelegate()
Description copied from interface: AttributeAssignable
get the logic delegate

Specified by:
getAttributeDelegate in interface AttributeAssignable
Returns:
the delegate

getAttributeValueDelegate

public AttributeValueDelegate getAttributeValueDelegate()
this delegate works on attributes and values at the same time

Specified by:
getAttributeValueDelegate in interface AttributeAssignable
Returns:
the delegate

isEnabled

public boolean isEnabled()
Is this membership enabled? Only applies to immediate memberships.

Returns:
boolean

deleteAndStore

public void deleteAndStore()
e.g. if enabled or disabled is switching, delete this membership (and child objects) and recommit it (which will not have the child objects or will have this time)


delete

public void delete()
delete this record (and security and actions etc, but not attribute def names yet)


setEnabled

public void setEnabled(boolean enabled)
Whether to enable or disable this membership. Only applies to immediate memberships.

Parameters:
enabled -

getEnabledDb

public String getEnabledDb()
Whether or not this membership is enabled. Only applies to immediate memberships.

Returns:
the enabled

setEnabledDb

public void setEnabledDb(String enabled)
Whether to enable or disable this membership. Only applies to immediate memberships.

Parameters:
enabled -

getEnabledTimeDb

public Long getEnabledTimeDb()
Time when this membership is enabled if the value is in the future. Only applies to immediate memberships.

Returns:
Long

getEnabledTime

public Timestamp getEnabledTime()
Time when this membership is enabled if the value is in the future. Only applies to immediate memberships.

Returns:
Timestamp

setEnabledTimeDb

public void setEnabledTimeDb(Long enabledTimeDb)
Set the time when this membership should be enabled. Only applies to immediate memberships.

Parameters:
enabledTimeDb -

setEnabledTime

public void setEnabledTime(Timestamp enabledTimeDb)
Set the time when this membership should be enabled. Only applies to immediate memberships.

Parameters:
enabledTimeDb -

getDisabledTimeDb

public Long getDisabledTimeDb()
Time when this membership is disabled if the value is in the future. Only applies to immediate memberships.

Returns:
Long

getDisabledTime

public Timestamp getDisabledTime()
Time when this membership is disabled if the value is in the future. Only applies to immediate memberships.

Returns:
Timestamp

setDisabledTimeDb

public void setDisabledTimeDb(Long disabledTimeDb)
Set the time to disable this membership. Only applies to immediate memberships.

Parameters:
disabledTimeDb -

setDisabledTime

public void setDisabledTime(Timestamp disabledTimeDb)
Set the time to disable this membership. Only applies to immediate memberships.

Parameters:
disabledTimeDb -

isComposite

public boolean isComposite()
if this is a composite membership

Returns:
true if composite

isImmediate

public boolean isImmediate()
if this is a immediate membership

Returns:
true if immediate

isEffective

public boolean isEffective()
if this is a effective membership

Returns:
true if effective

getChildMemberships

public Set getChildMemberships()
Get child memberships of this membership. A membership is the object which represents a join of member and group. Has metadata like type and creator, and, if an effective membership, the parent membership
 
 Set children = ms.getChildMemberships();
 

Returns:
Set of Membership objects.

getGroupSetParentId

public String getGroupSetParentId()
Returns:
group set parent id

setGroupSetParentId

public void setGroupSetParentId(String groupSetParentId)
Parameters:
groupSetParentId -

getCreateTime

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

getCreator

public Member getCreator()
                  throws MemberNotFoundException
Returns:
creator
Throws:
MemberNotFoundException
Since:
1.2.0

getDepth

public int getDepth()
number of hops between this membership and direct membership

Returns:
depth

getGroupName

public String getGroupName()
getter for group name if group membership

Returns:
group name

getGroup

@Deprecated
public Group getGroup()
               throws GroupNotFoundException
Deprecated. use getOwnerGroup() instead

Get this membership's group. To get the groups of a bunch of membership, might want to try retrieveGroups()
 Group g = ms.getGroup();
 

Returns:
A Group
Throws:
GroupNotFoundException - if group not found

getAttributeDef

@Deprecated
public AttributeDef getAttributeDef()
                             throws AttributeDefNotFoundException
Deprecated. use getOwnerAttributeDef() instead

Get this membership's group. To get the groups of a bunch of membership, might want to try retrieveGroups()
 Group g = ms.getAttributeDef();
 

Returns:
A AttributeDef
Throws:
AttributeDefNotFoundException - if attrDef not found

getOwnerAttributeDef

public AttributeDef getOwnerAttributeDef()
                                  throws AttributeDefNotFoundException
Get this membership's group. To get the groups of a bunch of membership, might want to try retrieveGroups()
 Group g = ms.getAttributeDef();
 

Returns:
A AttributeDef
Throws:
AttributeDefNotFoundException - if attrDef not found

retrieveGroups

public static Set<Group> retrieveGroups(Collection<Membership> memberships)
retrieve a set of groups based on some memberships (and store in each membership, like getGroup

Parameters:
memberships -
Returns:
the set of groups

getList

public Field getList()
Get this membership's list.
 String list = g.getList();
 

Returns:
The Field type of this membership.

getMemberSubjectId

public String getMemberSubjectId()
Returns:
the subject id of the member

getMemberSourceId

public String getMemberSourceId()
Returns:
the source id of the member

getMember

public Member getMember()
                 throws MemberNotFoundException
Get this membership's member. All immediate subjects, and effective members are members. No duplicates will be returned (e.g. if immediate and effective).
 Member m = ms.getMember();
 

Returns:
A Member
Throws:
MemberNotFoundException

getParentMembership

public Membership getParentMembership()
                               throws MembershipNotFoundException
Get parent membership of this membership. A membership is the object which represents a join of member and group. Has metadata like type and creator, and, if an effective membership, the parent membership
 try {
   Membership parent = ms.getParentMembership();
 }
 catch (MembershipNotFoundException e) {
   // Unable to retrieve parent membership
 }
 

Returns:
A Membership
Throws:
MembershipNotFoundException

getStem

@Deprecated
public Stem getStem()
             throws StemNotFoundException
Deprecated. use getOwnerStem() instead

Returns:
stem
Throws:
StemNotFoundException
Since:
1.2.0

getType

public String getType()
Returns:
type effective, immediate, composite
Since:
1.2.0

getTypeEnum

public MembershipType getTypeEnum()
get MembershipType of type

Returns:
type

getUuid

public String getUuid()
Returns:
uuid

getParentUuid

public String getParentUuid()
Returns:
the membership uuid of the parent
Since:
1.2.0

getViaComposite

public Composite getViaComposite()
                          throws CompositeNotFoundException
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.

Returns:
composite
Throws:
CompositeNotFoundException
Since:
1.2.0

getViaGroup

public Group getViaGroup()
                  throws GroupNotFoundException
Get this membership's via group.

Groups with Composite memberships will not have a via group. Use the getViaComposite() method instead.

 try {
   Group via = ms.getViaGroup();
 }
 catch (GroupNotFoundException e) {
   // Unable to retrieve via group
 }
 

Returns:
A Group
Throws:
GroupNotFoundException

internal_addImmediateMembership

public static Membership internal_addImmediateMembership(GrouperSession s,
                                                         Group g,
                                                         edu.internet2.middleware.subject.Subject subj,
                                                         Field f,
                                                         String uuid,
                                                         Timestamp startDate,
                                                         Timestamp endDate)
                                                  throws MemberAddException
Parameters:
s -
g -
subj -
f -
uuid - is uuid or null
startDate -
endDate -
Returns:
the membership if available
Throws:
MemberAddException

internal_addImmediateMembership

public static Membership internal_addImmediateMembership(GrouperSession s,
                                                         Stem ns,
                                                         edu.internet2.middleware.subject.Subject subj,
                                                         Field f,
                                                         String uuid)
                                                  throws MemberAddException
Parameters:
s -
ns -
subj -
f -
uuid -
Returns:
Membership
Throws:
MemberAddException

internal_delImmediateMembership

public static Membership internal_delImmediateMembership(GrouperSession s,
                                                         Group g,
                                                         edu.internet2.middleware.subject.Subject subj,
                                                         Field f)
                                                  throws MemberDeleteException
Parameters:
s -
g -
subj -
f -
Returns:
the deleted membership
Throws:
MemberDeleteException

internal_delImmediateMembership

public static Membership internal_delImmediateMembership(GrouperSession s,
                                                         Stem ns,
                                                         edu.internet2.middleware.subject.Subject subj,
                                                         Field f)
                                                  throws MemberDeleteException
Parameters:
s -
ns -
subj -
f -
Returns:
the deleted membership
Throws:
MemberDeleteException

internal_deleteAllField

public static void internal_deleteAllField(GrouperSession s,
                                           Group g,
                                           Field f)
                                    throws MemberDeleteException,
                                           SchemaException
Parameters:
s -
g -
f -
Throws:
MemberDeleteException
SchemaException
Since:
1.2.0

internal_deleteAllField

public static void internal_deleteAllField(GrouperSession s,
                                           Stem ns,
                                           Field f)
                                    throws MemberDeleteException
Parameters:
s -
ns -
f -
Throws:
MemberDeleteException
Since:
1.2.0

internal_deleteAllFieldType

public static void internal_deleteAllFieldType(GrouperSession s,
                                               Group g,
                                               FieldType type)
                                        throws MemberDeleteException,
                                               SchemaException
Parameters:
s -
g -
type -
Throws:
MemberDeleteException
SchemaException

internal_deleteAllFieldType

public static void internal_deleteAllFieldType(GrouperSession s,
                                               Stem ns,
                                               FieldType type)
                                        throws MemberDeleteException,
                                               SchemaException
Parameters:
s -
ns -
type -
Throws:
MemberDeleteException
SchemaException

equals

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

getCreateTimeLong

public long getCreateTimeLong()
This returns the create time of the membership. If the membership is effective, this will be for the immediate membership that causes the effective membership.

Returns:
create time

getCreatorUuid

public String getCreatorUuid()
This returns the creator of the membership. If the membership is effective, this will be for the immediate membership that causes the effective membership.

Returns:
creator uuid

membershipOwnerMemberToString

public static String membershipOwnerMemberToString(Collection<Object[]> membershipGroupMembers)
convert membership owner member to string

Parameters:
membershipGroupMembers -
Returns:
the string

getListName

public String getListName()
Returns:
list name

getField

public Field getField()
get the field based on field id (if there is one there)

Returns:
the field or null if not there

getListType

public String getListType()
Returns:
list type

getMemberUuid

public String getMemberUuid()
Returns:
member uuid
Since:
1.2.0

getGroupSetId

public String getGroupSetId()
Returns:
string

setGroupSetId

public void setGroupSetId(String groupSetId)
Parameters:
groupSetId -

hashCode

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

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)

setCreateTimeLong

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

setCreatorUuid

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

getGroupSetCreateTimeLong

public long getGroupSetCreateTimeLong()
Returns:
long

setGroupSetCreateTimeLong

public void setGroupSetCreateTimeLong(long groupSetCreateTimeLong)
Parameters:
groupSetCreateTimeLong -

getGroupSetCreatorUuid

public String getGroupSetCreatorUuid()
Returns:
string

setGroupSetCreatorUuid

public void setGroupSetCreatorUuid(String groupSetCreatorUUID)
Parameters:
groupSetCreatorUUID -

setDepth

public void setDepth(int depth)
Parameters:
depth -
Since:
1.2.0

setMember

public void setMember(Member member)
this can be called to set the member object even though the memberuuid is not changing

Parameters:
member -
Since:
1.3.0

setMemberUuid

public void setMemberUuid(String memberUUID)
Parameters:
memberUUID -

setType

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

setUuid

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

getViaGroupId

public String getViaGroupId()
if effective, this is group it is in

Returns:
group id

setViaGroupId

public void setViaGroupId(String viaGroupId)
if effective, this is group it is in

Parameters:
viaGroupId -

getViaCompositeId

public String getViaCompositeId()
if composite, this is composite id

Returns:
composite id

setViaCompositeId

public void setViaCompositeId(String viaCompositeId)
if composite, this is composite id

Parameters:
viaCompositeId -

toString

public String toString()
Overrides:
toString in class Object
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)

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 Membership 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

internal_fixEnabledDisabled

public static int internal_fixEnabledDisabled()
fix enabled and disabled memberships, and return the count of how many were fixed

Returns:
the number of records affected

clone

public Membership 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()

getFieldId

public String getFieldId()
id of the field which is the list name and type

Returns:
the field id

setFieldId

public void setFieldId(String fieldId1)
id of the field which is the list name and type

Parameters:
fieldId1 -

getImmediateFieldId

public String getImmediateFieldId()
id of the field for the immediate membership that causes this membership

Returns:
the field id

setImmediateFieldId

public void setImmediateFieldId(String immediateFieldId)
id of the field for the immediate membership that causes this membership

Parameters:
immediateFieldId -

getOwnerId

public String getOwnerId()
get the owner id

Returns:
the owner id

setOwnerId

public void setOwnerId(String owner)
This is for internal use only.

Parameters:
owner -

getOwnerGroupId

public String getOwnerGroupId()
if group membership, this is the group id

Returns:
the group id

getOwnerAttrDefId

public String getOwnerAttrDefId()
if attrDef membership, this is the attrDef id

Returns:
the attrdef id

setOwnerGroupId

public void setOwnerGroupId(String groupId1)
if this is a group membership, this is the group id

Parameters:
groupId1 -

getOwnerGroup

public Group getOwnerGroup()
Get this membership's group. To get the groups of a bunch of membership, might want to try retrieveGroups()
 Group g = ms.getGroup();
 

Returns:
A Group
Throws:
GroupNotFoundException - if group not found

setOwnerGroup

public void setOwnerGroup(Group group)
set the owner group

Parameters:
group -

setOwnerAttributeDef

public void setOwnerAttributeDef(AttributeDef attributeDef)
set the owner attributeDef

Parameters:
attributeDef -

setOwnerStem

public void setOwnerStem(Stem stem)
set the owner stem

Parameters:
stem -

setOwnerAttrDefId

public void setOwnerAttrDefId(String attrDefId1)
if this is an attrDef membership, this is the attrDef id

Parameters:
attrDefId1 -

getOwnerStemId

public String getOwnerStemId()
if this is a stem membership, this is the stem id

Returns:
stem id

setOwnerStemId

public void setOwnerStemId(String stemId1)
if this is a stem membership, this is the stem id

Parameters:
stemId1 -

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 -

setImmediateMembershipId

public void setImmediateMembershipId(String immediateMembershipId)
Set the immediate membership id

Parameters:
immediateMembershipId -

getImmediateMembershipId

public String getImmediateMembershipId()
Returns:
the immediate membership id

internal_addImmediateMembership

public static Membership internal_addImmediateMembership(GrouperSession s,
                                                         AttributeDef attributeDef,
                                                         edu.internet2.middleware.subject.Subject subj,
                                                         Field f,
                                                         String uuid)
                                                  throws MemberAddException
Parameters:
s -
attributeDef -
subj -
f -
uuid -
Returns:
Membership
Throws:
MemberAddException

internal_deleteAllField

public static void internal_deleteAllField(GrouperSession s,
                                           AttributeDef attributeDef,
                                           Field f)
                                    throws MemberDeleteException
Parameters:
s -
attributeDef -
f -
Throws:
MemberDeleteException
Since:
1.2.0

internal_deleteAllFieldType

public static void internal_deleteAllFieldType(GrouperSession s,
                                               AttributeDef attributeDef,
                                               FieldType type)
                                        throws MemberDeleteException,
                                               SchemaException
Parameters:
s -
attributeDef -
type -
Throws:
MemberDeleteException
SchemaException

internal_delImmediateMembership

public static Membership internal_delImmediateMembership(GrouperSession s,
                                                         AttributeDef attributeDef,
                                                         edu.internet2.middleware.subject.Subject subj,
                                                         Field f)
                                                  throws MemberDeleteException
Parameters:
s -
attributeDef -
subj -
f -
Returns:
the deleted membership
Throws:
MemberDeleteException

addMembershipAddChangeLog

public void addMembershipAddChangeLog()
add a change log entry for a membership add


addMembershipDeleteChangeLog

public void addMembershipDeleteChangeLog(Member member)
add a change log entry for a membership delete

Parameters:
member -

xmlCopyBusinessPropertiesToExisting

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

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

xmlDifferentBusinessProperties

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

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

xmlDifferentUpdateProperties

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

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

xmlRetrieveByIdOrKey

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

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

xmlSaveBusinessProperties

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

Specified by:
xmlSaveBusinessProperties in interface XmlImportableBase<Membership>
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<Membership>
See Also:
XmlImportableBase.xmlSaveUpdateProperties()

xmlToExportMembership

public XmlExportMembership xmlToExportMembership(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<Membership>
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<Membership>
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<Membership>
Returns:
the string value for log
See Also:
XmlImportableBase.xmlToString()

getAttributeValueDelegateEffMship

public AttributeValueDelegate getAttributeValueDelegateEffMship()
this delegate works on attributes and values at the same time

Returns:
the delegate

getAttributeDelegateEffMship

public AttributeAssignEffMshipDelegate getAttributeDelegateEffMship()
delegate for effective memberships

Returns:
the delegate

getOwnerStem

public Stem getOwnerStem()
                  throws StemNotFoundException
Returns:
stem
Throws:
StemNotFoundException
Since:
1.2.0