A list of MembershipBean objects, with a variety of filtering, grouping and CSV summary methods for working with a profile's or a report's set of memberships. Can be made readonly via readonly(), in which case the mutating list methods throw a RuntimeException rather than changing the underlying list.
Extends: KillableList
Properties
| Property | Returns | Description |
|---|---|---|
| first | MembershipBean | The first membership in this list. |
| groupByOrg | Map<OrgData,MembershipList> | Groups the memberships in this list by their organisation. |
| instanceCreatedDate | Date | The date this list instance was constructed. Not related to the membership records it holds. |
| last | MembershipBean | The last membership in this list. |
Methods
readonly() · get(String groupName) · active() · active(Date now) · hasGroup(String groupName) · filterByProfile(Profile p) · filterByProfile(ProfileBean p) · filterByOrg(String orgId) · filterByOrgs(List<String> orgIds) · filterByOrgId(Long orgId) · filterByOrgType(String orgType) · filterByOrgTypes(List<String> orgTypes) · filterByGroup(String groupName) · filterByGroups(List<String> groupNames) · filterByGroupFolder(String groupFolderName) · filterByGroupType(String groupType) · filterByRole(String roleName) · filterSubOrgs() · filterForPrimary() · filterForWebsite(Website website) · filterForNotPrimary() · filterForNotExpired() · filterForNotRoot() · filterForNotTag() · getGroupByOrg() · getFirst() · getLast() · forOrgs(String group) · toProfilesList() · toOrgsList() · toOrgsList(boolean nonRoot) · toGroupsList() · findById(Long id) · findOrgs() · findOrgsWithRoles(String roles) · findOrgsRolesApplyTo(String roles) · orgIdsCsv() · orgTitlesCsv() · emailsCsv() · userIdCsv() · groupNamesCsv() · orgTypeNamesCsv() · propVal(String s) · containsGroup(String groupName) · containsOrg(String orgId) · containsOrgType(String orgTypeName) · allParentOrgIds() · getInstanceCreatedDate() · filterByParentOrg(Organisation parentOrg)
readonly()
Returns: MembershipList
Returns a readonly copy of this list. The copy holds the same members, but any attempt to mutate it (add, remove, clear, and so on) throws a RuntimeException.
get(String groupName)
Returns: MembershipBean
Gets a membership by the group name.
| Parameter | Description |
|---|---|
groupName | the name of the group to look for |
active()
Returns: MembershipList
Return all memberships which are active for the current date/time. This includes all those with no expiry date, and those which have not expired at that date
active(Date now)
Returns: MembershipList
Return all memberships which are active for the given date. This includes all those with no expiry date, and those which have not expired at that date
| Parameter | Description |
|---|---|
now | - a Date |
hasGroup(String groupName)
Returns: boolean
Checks whether this list contains a membership to a group with the given name.
| Parameter | Description |
|---|---|
groupName | the name of the group to look for |
filterByProfile(Profile p)
Returns: MembershipList
Filters this membership list for only memberships held by the given profile.
| Parameter | Description |
|---|---|
p | the profile to filter by |
filterByProfile(ProfileBean p)
Returns: MembershipList
Filters this membership list for only memberships held by the given profile.
| Parameter | Description |
|---|---|
p | the profile to filter by |
filterByOrg(String orgId)
Returns: MembershipList
Return a new list which is this list filtered so it only contains memberships to the organisation with the given orgid
| Parameter | Description |
|---|---|
orgId | the org id (business identifier, not the numeric internal id) to filter by |
filterByOrgs(List<String> orgIds)
Returns: MembershipList
Filters this list so it only contains memberships to organisations whose org id is in the given list.
| Parameter | Description |
|---|---|
orgIds | the org ids (business identifiers, not numeric internal ids) to filter by |
filterByOrgId(Long orgId)
Returns: MembershipList
Return a new list which is this list filtered so it only contains memberships to the organisation with the given org id. NOTE This is the numeric internal ID, not the user identifier
| Parameter | Description |
|---|---|
orgId | the numeric internal id of the organisation to filter by |
filterByOrgType(String orgType)
Returns: MembershipList
Return a new list which is this list filtered so it only contains memberships to the organisation with the given orgTYpe
| Parameter | Description |
|---|---|
orgType | the org type to filter by |
filterByOrgTypes(List<String> orgTypes)
Returns: MembershipList
Filters this list so it only contains memberships to organisations carrying any of the given org types.
| Parameter | Description |
|---|---|
orgTypes | the org types to filter by |
filterByGroup(String groupName)
Returns: MembershipList
Return a new list which is this list filtered so it only contains memberships to the given group
| Parameter | Description |
|---|---|
groupName | the group name to filter by |
filterByGroups(List<String> groupNames)
Returns: MembershipList
Filters this list so it only contains memberships to groups whose name is in the given list.
| Parameter | Description |
|---|---|
groupNames | the group names to filter by |
filterByGroupFolder(String groupFolderName)
Returns: MembershipList
Filters this list so it only contains memberships to groups within the given group folder.
| Parameter | Description |
|---|---|
groupFolderName | the name of the group folder to filter by |
filterByGroupType(String groupType)
Returns: MembershipList
Filters this list so it only contains memberships to groups of the given group type.
| Parameter | Description |
|---|---|
groupType | the group type to filter by |
filterByRole(String roleName)
Returns: MembershipList
Filters this list so it only contains memberships whose group grants the given role.
| Parameter | Description |
|---|---|
roleName | the role name to filter by |
filterSubOrgs()
Returns: MembershipList
Returns a list which only includes memberships to sub-organisations, ie organisations other than the current tenant organisation.
filterForPrimary()
Returns: MembershipList
Filters this list so it only contains memberships to a profile's primary group.
filterForWebsite(Website website)
Returns: MembershipList
Filters this list so it only contains memberships whose group is associated with the given website.
| Parameter | Description |
|---|---|
website | the website to filter by |
filterForNotPrimary()
Returns: MembershipList
Filters this list so it only contains memberships that are not a profile's primary group.
filterForNotExpired()
Returns: MembershipList
Filters this list so it only contains memberships that have not expired, rebuilding each surviving membership from its live entity. Memberships with no expiry date are always kept.
filterForNotRoot()
Returns: MembershipList
Filters for memberships which are NOT connected to the root account.
filterForNotTag()
Returns: MembershipList
Filters this list so it excludes memberships to mailing-list type groups.
getGroupByOrg()
Returns: Map<OrgData,MembershipList>
Groups the memberships in this list by their organisation.
getFirst()
Returns: MembershipBean
The first membership in this list.
getLast()
Returns: MembershipBean
The last membership in this list.
forOrgs(String group)
Returns: MembershipList
Returns a list of memberships for orgs referenced from this list and which have the given group
| Parameter | Description |
|---|---|
group | the name of the group to look up in each organisation |
toProfilesList()
Returns: List<Profile>
Collects the distinct profiles referenced by the memberships in this list.
toOrgsList()
Returns: OrgDataList
Gets a list of all distinct organisations referenced by the memberships in this list.
toOrgsList(boolean nonRoot)
Returns: OrgDataList
Gets a list of all distinct organisations referenced by the memberships in this list, optionally excluding the current tenant's root account.
| Parameter | Description |
|---|---|
nonRoot | true to exclude the current tenant's root account from the result |
toGroupsList()
Returns: List<Group>
Gets a list of all distinct, non-deleted groups referenced by the memberships in this list.
findById(Long id)
Returns: MembershipBean
Finds the membership in this list with the given id.
| Parameter | Description |
|---|---|
id | the membership id to look for |
findOrgs()
Returns: List<Organisation>
Finds the distinct organisations that the memberships in this list belong within.
findOrgsWithRoles(String roles)
Returns: List<Organisation>
Finds the distinct organisations of memberships in this list whose group grants at least one of the given roles.
| Parameter | Description |
|---|---|
roles | the role names to match, at least one of which must be granted |
findOrgsRolesApplyTo(String roles)
Returns: List<Organisation>
Similar to findOrgsWithRoles, except for roles which are configured as being contextual to a specific org it will return that instead of the org of the membership
| Parameter | Description |
|---|---|
roles | the role names to look up |
orgIdsCsv()
Returns: String
Returns a csv formatted list of the distinct organisation ids referenced by this list.
orgTitlesCsv()
Returns: String
Returns a csv formatted list of the distinct organisation titles referenced by this list.
emailsCsv()
Returns: String
Returns all referenced profile emails as a comma-separated value.
userIdCsv()
Returns: String
Returns all referenced profile names as a comma-separated value.
groupNamesCsv()
Returns: String
Returns a csv formatted list of the distinct group names referenced by this list.
orgTypeNamesCsv()
Returns: Object
Returns a csv formatted list of the names of the org types selected on the organisations referenced by this list.
propVal(String s)
Returns: String
Returns the first non-blank value found from custom fields in this membership list
| Parameter | Description |
|---|---|
s | the custom field name to look up |
containsGroup(String groupName)
Returns: boolean
Returns true if any membership in this list has the given group name
| Parameter | Description |
|---|---|
groupName | the group name to look for |
containsOrg(String orgId)
Returns: boolean
Checks whether any membership in this list belongs to the organisation with the given org id.
| Parameter | Description |
|---|---|
orgId | the org id (business identifier, not the numeric internal id) to look for |
containsOrgType(String orgTypeName)
Returns: boolean
Returns true if any membership in this list is to an organisation carrying the given org type. An org can have several selected org types, so this is a "has" check rather than an equality one.
| Parameter | Description |
|---|---|
orgTypeName | the org type to look for |
allParentOrgIds()
Returns: Set<Long>
Finds the ids of all organisations that are ancestors of the organisations referenced by the memberships in this list, up to the admin domain. Computed on first access and cached.
getInstanceCreatedDate()
Returns: Date
The date this list instance was constructed. Not related to the membership records it holds.
filterByParentOrg(Organisation parentOrg)
Returns: MembershipList
Return memberships for orgs which are within the given parent org
| Parameter | Description |
|---|---|
parentOrg | the organisation to filter within |