Class Membership

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

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 $
See Also:
  • Field Details

    • FIELD_CONTEXT_ID

      public static final String FIELD_CONTEXT_ID
      constant for field name for: contextId
      See Also:
    • TABLE_GROUPER_MEMBERSHIPS

      public static final String TABLE_GROUPER_MEMBERSHIPS
      table name where memberships are stored
      See Also:
    • COLUMN_ID

      public static final String COLUMN_ID
      id col in db
      See Also:
    • COLUMN_FIELD_ID

      public static final String COLUMN_FIELD_ID
      id col in db
      See Also:
    • COLUMN_LIST_NAME

      public static final String COLUMN_LIST_NAME
      list_name col in db
      See Also:
    • COLUMN_LIST_TYPE

      public static final String COLUMN_LIST_TYPE
      list_type col in db
      See Also:
    • COLUMN_OLD_LIST_NAME

      public static final String COLUMN_OLD_LIST_NAME
      old_list_name col in db
      See Also:
    • COLUMN_OLD_LIST_TYPE

      public static final String COLUMN_OLD_LIST_TYPE
      old_list_type col in db
      See Also:
    • COLUMN_MEMBERSHIP_UUID

      public static final String COLUMN_MEMBERSHIP_UUID
      uuid col in db
      See Also:
    • COLUMN_OLD_ID

      public static final String COLUMN_OLD_ID
      old id col for id conversion
      See Also:
    • COLUMN_OLD_MEMBERSHIP_UUID

      public static final String COLUMN_OLD_MEMBERSHIP_UUID
      old uuid id col for id conversion
      See Also:
    • COLUMN_DISABLED_TIMESTAMP

      public static final String COLUMN_DISABLED_TIMESTAMP
      epoch time of when to disable membership
      See Also:
    • COLUMN_ENABLED_TIMESTAMP

      public static final String COLUMN_ENABLED_TIMESTAMP
      epoch time of when to enable membership
      See Also:
    • COLUMN_ENABLED

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

      public static final String FIELD_CREATE_TIME_LONG
      constant for field name for: createTimeLong
      See Also:
    • FIELD_CREATOR_UUID

      public static final String FIELD_CREATOR_UUID
      constant for field name for: creatorUUID
      See Also:
    • FIELD_GROUP_SET_CREATE_TIME_LONG

      public static final String FIELD_GROUP_SET_CREATE_TIME_LONG
      constant for field name for: groupSetCreateTimeLong
      See Also:
    • FIELD_GROUP_SET_CREATOR_UUID

      public static final String FIELD_GROUP_SET_CREATOR_UUID
      constant for field name for: groupSetCreatorUUID
      See Also:
    • FIELD_DB_VERSION

      public static final String FIELD_DB_VERSION
      constant for field name for: dbVersion
      See Also:
    • FIELD_DEPTH

      public static final String FIELD_DEPTH
      constant for field name for: depth
      See Also:
    • FIELD_FIELD_ID

      public static final String FIELD_FIELD_ID
      constant for field name for: fieldId
      See Also:
    • FIELD_MEMBER_UUID

      public static final String FIELD_MEMBER_UUID
      constant for field name for: memberUUID
      See Also:
    • FIELD_OWNER_GROUP_ID

      public static final String FIELD_OWNER_GROUP_ID
      constant for field name for: ownerGroupId
      See Also:
    • FIELD_OWNER_STEM_ID

      public static final String FIELD_OWNER_STEM_ID
      constant for field name for: ownerStemId
      See Also:
    • FIELD_OWNER_ATTR_DEF_ID

      public static final String FIELD_OWNER_ATTR_DEF_ID
      constant for field name for: ownerAttrDefId
      See Also:
    • FIELD_TYPE

      public static final String FIELD_TYPE
      constant for field name for: type
      See Also:
    • FIELD_UUID

      public static final String FIELD_UUID
      constant for field name for: uuid
      See Also:
    • FIELD_GROUP_SET_ID

      public static final String FIELD_GROUP_SET_ID
      constant for field name for: groupSetId
      See Also:
    • FIELD_VIA_COMPOSITE_ID

      public static final String FIELD_VIA_COMPOSITE_ID
      constant for field name for: viaCompositeId
      See Also:
    • FIELD_VIA_GROUP_ID

      public static final String FIELD_VIA_GROUP_ID
      constant for field name for: viaGroupId
      See Also:
    • FIELD_GROUP_SET_PARENT_ID

      public static final String FIELD_GROUP_SET_PARENT_ID
      constant for field name for: groupSetParentId
      See Also:
    • FIELD_IMMEDIATE_MEMBERSHIP_ID

      public static final String FIELD_IMMEDIATE_MEMBERSHIP_ID
      constant for field name for: immediateMembershipId
      See Also:
    • FIELD_DISABLED_TIME_DB

      public static final String FIELD_DISABLED_TIME_DB
      constant for field name for: disabledTimeDb
      See Also:
    • FIELD_ENABLED

      public static final String FIELD_ENABLED
      constant for field name for: enabled
      See Also:
    • FIELD_ENABLED_TIME_DB

      public static final String FIELD_ENABLED_TIME_DB
      constant for field name for: enabledTimeDb
      See Also:
    • 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:
    • 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:
    • 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:
    • OWNER_TYPE_GROUP

      public static final String OWNER_TYPE_GROUP
      group owner type for change log
      See Also:
    • OWNER_TYPE_STEM

      public static final String OWNER_TYPE_STEM
      stem owner type for change log
      See Also:
    • OWNER_TYPE_ATTRIBUTE_DEF

      public static final String OWNER_TYPE_ATTRIBUTE_DEF
      attr def owner type for change log
      See Also:
    • membershipIdSeparator

      public static final String membershipIdSeparator
      separator used in the uuid field to split immediate_membership_id and group_set_id
      See Also:
    • 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:
    • COLUMN_VIA_COMPOSITE_ID

      public static final String COLUMN_VIA_COMPOSITE_ID
      See Also:
    • COLUMN_OWNER_STEM_ID

      public static final String COLUMN_OWNER_STEM_ID
      See Also:
    • COLUMN_OWNER_GROUP_ID

      public static final String COLUMN_OWNER_GROUP_ID
      See Also:
    • COLUMN_OWNER_ATTR_DEF_ID

      public static final String COLUMN_OWNER_ATTR_DEF_ID
      See Also:
    • COLUMN_OWNER_ID

      public static final String COLUMN_OWNER_ID
      See Also:
    • COLUMN_VIA_ID

      public static final String COLUMN_VIA_ID
      See Also:
    • COLUMN_DEPTH

      public static final String COLUMN_DEPTH
      See Also:
    • COLUMN_DEPTH_BAK

      public static final String COLUMN_DEPTH_BAK
      See Also:
    • COLUMN_PARENT_MEMBERSHIP

      public static final String COLUMN_PARENT_MEMBERSHIP
      See Also:
    • COLUMN_PARENT_MEMBERSHIP_BAK

      public static final String COLUMN_PARENT_MEMBERSHIP_BAK
      col
      See Also:
    • COLUMN_MEMBER_ID

      public static final String COLUMN_MEMBER_ID
      col
      See Also:
    • COLUMN_MSHIP_TYPE

      public static final String COLUMN_MSHIP_TYPE
      col
      See Also:
    • COLUMN_CREATOR_ID

      public static final String COLUMN_CREATOR_ID
      col
      See Also:
    • COLUMN_CREATE_TIME

      public static final String COLUMN_CREATE_TIME
      col
      See Also:
  • Constructor Details

    • Membership

      public Membership()
  • Method Details

    • 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
    • internal_isEnabledUsingTimestamps

      public boolean internal_isEnabledUsingTimestamps()
      Should this membership be enabled based on the enabled and disabled dates? Only applies to immediate/composite memberships.
      Returns:
      boolean
    • isEnabled

      public boolean isEnabled()
      Is this membership enabled? Only applies to immediate/composite memberships.
      Returns:
      boolean
    • deleteAndStore

      @Deprecated public void deleteAndStore()
      Deprecated.
      This shouldn't be used anymore 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/composite memberships.
      Parameters:
      enabled -
    • getEnabledDb

      public String getEnabledDb()
      Whether or not this membership is enabled. Only applies to immediate/composite memberships.
      Returns:
      the enabled
    • setEnabledDb

      public void setEnabledDb(String enabled)
      Whether to enable or disable this membership. Only applies to immediate/composite 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, 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, 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, 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, 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:
    • 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:
    • 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:
    • 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:
    • updateLastMembershipChangeDuringMembersListUpdate

      public static void updateLastMembershipChangeDuringMembersListUpdate(Set<String> groupIds)
      Update the last_membership_change for the ancestor groups and stems for the given groups.
      Parameters:
      groupIds -
    • fixComposites

      protected static Set<String> fixComposites(Set<Composite> composites, String ownerGroupId, Set<String> membersList)
      Parameters:
      composites -
      ownerGroupId -
      membersList -
      Returns:
      set of group ids with modified composite memberships
    • 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:
    • 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:
    • 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:
    • 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:
    • 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 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:
    • 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, 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, Subject subj, Field f) throws MemberDeleteException
      Parameters:
      s -
      attributeDef -
      subj -
      f -
      Returns:
      the deleted membership
      Throws:
      MemberDeleteException
    • addMembershipAddChangeLog

      public void addMembershipAddChangeLog(String contextId)
      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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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