Read-oriented view of a profile's membership to a group, wrapping a GroupMembership entity for use in templates and scripting. Exposes the group, role, registration and expiry details of the membership. Supports a "detached" mode where it holds only the membership id and re-loads the underlying entity on each access instead of keeping a reference, so instances can be cached or passed around without pinning a Hibernate session.
Implements: Relational
Properties
| Property | Returns | Description |
|---|---|---|
| createdById | Long | The internal id of the profile who created this membership, typically an administrator who registered the user. |
| expiryDate | Date | The date this membership expires, after which it is no longer considered active. |
| fields | Map<String,String> | The membership's custom field values, keyed on field name. Lazily loaded and cached on first access. |
| groupFolderName | String | The name of the group folder the group belongs to, if any. |
| groupId | Long | The internal id of the group this membership belongs to. |
| groupName | String | The name of the group this membership belongs to. |
| groupTitle | String | The display title of the group this membership belongs to, falling back to the group name if no title is set. |
| groupType | String | The type code of the group this membership belongs to. |
| id | long | The internal id of this membership. |
| modifiedDate | Date | The date the underlying membership record was last modified. Always resolves the live entity, so it is not available from a detached bean whose backing membership has been deleted. |
| org | OrgData | The organisation this membership was registered within. In detached mode this is re-resolved on each call rather than cached, so the bean does not hold a long-lived reference to the organisation. |
| primaryGroup | boolean | Whether the group this membership belongs to is the profile's primary group. |
| registrationDate | Date | The date this membership was created, ie the user's registration date to the group. |
| roles | List<String> | The names of the roles held on the group by way of this membership. |
| userId | long | The internal Kademi id for the profile of the membership. |
Methods
getFields() · getGroupId() · getGroupName() · getGroupTitle() · getOrg() · withinOrg() · isPrimaryGroup() · getId() · getRoles() · hasRole(String roleName) · numLocalMembers() · profile() · getUserId() · moduleStatuses(WebsiteResource wr) · loadExtraFieldValues() · moduleStatuses(OrgData org) · allMemberships() · getRegistrationDate() · getExpiryDate() · getModifiedDate() · getGroupFolderName() · getGroupType() · useGroupMembership(Function<GroupMembership,R> p) · acceptGroupMembership(Consumer<GroupMembership> p) · groupRegoOrgType() · group() · getCreatedById() · createdBy() · rowId() · groupRoles(String roleName) · orgsByRole()
getFields()
Returns: Map<String,String>
The membership's custom field values, keyed on field name. Lazily loaded and cached on first access.
getGroupId()
Returns: Long
The internal id of the group this membership belongs to.
getGroupName()
Returns: String
The name of the group this membership belongs to.
getGroupTitle()
Returns: String
The display title of the group this membership belongs to, falling back to the group name if no title is set.
getOrg()
Returns: OrgData
The organisation this membership was registered within. In detached mode this is re-resolved on each call rather than cached, so the bean does not hold a long-lived reference to the organisation.
withinOrg()
Returns: Organisation
The organisation this membership was registered within, as the underlying entity rather than the OrgData wrapper.
isPrimaryGroup()
Returns: boolean
Whether the group this membership belongs to is the profile's primary group.
getId()
Returns: long
The internal id of this membership.
getRoles()
Returns: List<String>
The names of the roles held on the group by way of this membership.
hasRole(String roleName)
Returns: boolean
Checks whether the group grants the given role.
| Parameter | Description |
|---|---|
roleName | the name of the role to check for |
numLocalMembers()
Returns: long
Finds the number of members within this same group on this organisation. This is an expensive, database-backed count, cached on the bean after the first call.
profile()
Returns: ExtProfileBean
The profile of this membership.
getUserId()
Returns: long
The internal Kademi id for the profile of the membership.
moduleStatuses(WebsiteResource wr)
Returns: Map<String,Integer>
Finds this membership's module completion statuses, keyed on the program, course and module code, scoped to the given website.
| Parameter | Description |
|---|---|
wr | the website to limit module statuses to |
loadExtraFieldValues()
Returns: Map<ExtraField,String>
Loads this membership's extra field definitions together with their stored values, resolved against the field set configured on the group.
moduleStatuses(OrgData org)
Returns: Map<String,Integer>
Finds this membership's module completion statuses, keyed on the program, course and module code, scoped to the given organisation.
| Parameter | Description |
|---|---|
org | the organisation to limit module statuses to |
allMemberships()
Returns: MembershipList
Return all memberships for this user to groups within the parent organisation of this group
getRegistrationDate()
Returns: Date
The date this membership was created, ie the user's registration date to the group.
getExpiryDate()
Returns: Date
The date this membership expires, after which it is no longer considered active.
getModifiedDate()
Returns: Date
The date the underlying membership record was last modified. Always resolves the live entity, so it is not available from a detached bean whose backing membership has been deleted.
getGroupFolderName()
Returns: String
The name of the group folder the group belongs to, if any.
getGroupType()
Returns: String
The type code of the group this membership belongs to.
useGroupMembership(Function<GroupMembership,R> p)
Returns: R
Runs the given function against the live GroupMembership entity backing this bean, resolving it first if the bean is detached. Use this to reach entity state not exposed directly by this bean.
| Parameter | Description |
|---|---|
p | the function to apply to the resolved GroupMembership |
acceptGroupMembership(Consumer<GroupMembership> p)
Returns: void
Passes the live GroupMembership entity backing this bean to the given consumer, resolving it first if the bean is detached. Use this to act on entity state not exposed directly by this bean.
| Parameter | Description |
|---|---|
p | the consumer to invoke with the resolved GroupMembership |
groupRegoOrgType()
Returns: OrgType
The org type that new registrations to this group are created within.
group()
Returns: Group
The group this membership belongs to, resolved from the held entity reference, or by id when the bean is detached.
getCreatedById()
Returns: Long
The internal id of the profile who created this membership, typically an administrator who registered the user.
createdBy()
Returns: Profile
The profile who created this membership, typically an administrator who registered the user.
rowId()
Returns: Long
The database row id of this membership, per the Relational contract.
groupRoles(String roleName)
Returns: List<GroupRole>
The group roles on this membership's group which have the given role name. A group can define more than one GroupRole with the same name, each scoped to a different organisation or repository.
| Parameter | Description |
|---|---|
roleName | the role name to filter by |
orgsByRole()
Returns: Map<String,Organisation>
Returns a map of roles on this group, where the key is the role name and the value is the organisation the role applies to. Group roles which apply to a specific repository are considered to not have an organisation in context, so are not returned. For group roles which are configured to apply to a specific organisation (including the account) that organisation is returned; otherwise the organisation from the membership is taken as the applicable one. This method is not cached.