Represents an organisation, and allows access to information about members of that organisation You can get the OrgData for the organisation which owns the current website in templating with the orgData property of the WebsiteRootFolder eg $page.find("/").orgData You can also get the OrgData object for a user's membership And once you have an OrgData, if it contains child organisations then you can use the childOrgs and allSubOrgs methods on the OrgData object to get them
Extends: EntityBean
Properties
| Property | Returns | Description |
|---|---|---|
| address | String | First line of this organisation's postal address. |
| addressLine2 | String | Second line of this organisation's postal address, may be null or empty. |
| addressState | String | State or region component of this organisation's postal address. |
| adminDomain | boolean | Checks whether this organisation is an admin domain, ie the top-level organisation for a Kademi account. |
| city | String | City component of this organisation's postal address. |
| country | String | Country component of this organisation's postal address. |
String | Contact email address for this organisation. | |
| entityName | String | Identifier used by the generic EntityBean API to refer to this organisation, which for an organisation is its org id. |
| fields | Map<String,String> | All custom field values set on this organisation, keyed on field name. Loaded on first call and cached for reuse. |
| formattedName | String | Display name for this organisation, delegating to the underlying Organisation's formatted name (typically its title, falling back to its org id). Equivalent to formattedName(). |
| hasPrimaryMembers | boolean | Checks whether this organisation has at least one group membership. Note this checks all memberships, not only primary ones, despite the method name. |
| hasPrimaryMembers | boolean | Checks whether this organisation has at least one group membership, delegating to isHasPrimaryMembers(). |
| id | long | Numeric database id of this organisation. |
| lat | Double | Latitude of this organisation's location, or null if not set. |
| lng | Double | Longitude of this organisation's location, or null if not set. |
| orgId | String | Path-safe, admin-unique identifier for this organisation, used in URLs and as the lookup key for child org searches. |
| orgTypeDisplayName | String | Human-readable display name of this organisation's primary org type. |
| orgTypeName | String | Machine name of this organisation's primary org type. |
| parent | OrgData | Returns the parent organisation of this organisation, unless this organisation is the owner of the current website, in which case it returns null. Loaded on first call and cached for reuse. |
| phone | String | Contact phone number for this organisation. |
| photoHash | String | Hash used to build the URL of this organisation's photo, or null if it has none. |
| postcode | String | Postcode component of this organisation's postal address. |
| selectedOrgTypes | List<OrgTypeBean> | All org types selected on this organisation, not just its primary one. Loaded on first call and cached for reuse. |
| state | String | State or region component of this organisation's postal address, duplicated from getAddressState. |
| timezone | String | Timezone id for this organisation, defaulting to the server's local timezone (or Pacific/Auckland) when the organisation has none set. |
| title | String | Free-text display title of this organisation, as entered by an administrator. |
Methods
formattedName() · getEntityName() · getId() · getOrgId() · getOrgTypeName() · getOrgTypeDisplayName() · getSelectedOrgTypes() · hasOrgType(String name) · getTitle() · getAddress() · getAddressLine2() · getCity() · getAddressState() · getPhone() · getEmail() · getState() · getPostcode() · getCountry() · getPhotoHash() · getLat() · getLng() · getTimezone() · getFormattedName() · getFields() · members(String groupName) · isHasPrimaryMembers() · getHasPrimaryMembers() · primaryMembers() · childOrgs() · childOrgsRecursive() · findChildOrgByField(String fieldName, String value) · findChildOrgByField(String fieldName, String value, Boolean recursive) · childOrg(String orgId) · childOrg(long orgId) · allSubOrgs(String orgType) · org() · findProfile(String emailOrName) · findPrimaryMemberByField(String fieldName, String value, boolean contains) · findMembershipByField(String groupName, String fieldName, String value, boolean contains) · findChildMembershipByField(String groupName, String fieldName, Object ovalue, boolean contains) · findChildMembershipByField(String groupName, String fieldName, Object ovalue, boolean contains, Boolean enabled) · hasMembership(String userId, String groupName) · createMembership(String userId, String email, String orgId, String groupName) · deleteMembership(String groupName, Profile profile) · deleteMembership(String groupName, String userId) · deleteMembership(String groupName, ProfileBean profileBean) · updateProfile(ProfileBean profile, String firstName, String surName, String phone) · updateProfile(ProfileBean profile, String firstName, String surName, String phone, String email) · copyExtraFields(Profile profile, String groupName, OrgData withinOrg) · updateMembership(ProfileBean profile, String groupName, OrgData withinOrg, Map<Object,Object> fieldValues) · createMembership(String userId, String email, OrgData orgDataToJoin, String groupName) · getOrCreateChildOrg(String newOrgId, String orgTitle, String orgType) · getParent() · updateOrg(Map<String,String> parameters) · createGroup(String name, String title, String groupType, String regoMode) · createGroup(String name) · entityObject() · isAdminDomain() · withinOrg() · rowId()
formattedName()
Returns: String
Display name for this organisation, delegating to the underlying Organisation's formatted name (typically its title, falling back to its org id).
getEntityName()
Returns: String
Identifier used by the generic EntityBean API to refer to this organisation, which for an organisation is its org id.
getId()
Returns: long
Numeric database id of this organisation.
getOrgId()
Returns: String
Path-safe, admin-unique identifier for this organisation, used in URLs and as the lookup key for child org searches.
getOrgTypeName()
Returns: String
Machine name of this organisation's primary org type.
getOrgTypeDisplayName()
Returns: String
Human-readable display name of this organisation's primary org type.
getSelectedOrgTypes()
Returns: List<OrgTypeBean>
All org types selected on this organisation, not just its primary one. Loaded on first call and cached for reuse.
hasOrgType(String name)
Returns: boolean
Checks whether the given org type is one of this organisation's selected org types.
| Parameter | Description |
|---|---|
name | the machine name of the org type to check for |
getTitle()
Returns: String
Free-text display title of this organisation, as entered by an administrator.
getAddress()
Returns: String
First line of this organisation's postal address.
getAddressLine2()
Returns: String
Second line of this organisation's postal address, may be null or empty.
getCity()
Returns: String
City component of this organisation's postal address.
getAddressState()
Returns: String
State or region component of this organisation's postal address.
getPhone()
Returns: String
Contact phone number for this organisation.
getEmail()
Returns: String
Contact email address for this organisation.
getState()
Returns: String
State or region component of this organisation's postal address, duplicated from getAddressState.
getPostcode()
Returns: String
Postcode component of this organisation's postal address.
getCountry()
Returns: String
Country component of this organisation's postal address.
getPhotoHash()
Returns: String
Hash used to build the URL of this organisation's photo, or null if it has none.
getLat()
Returns: Double
Latitude of this organisation's location, or null if not set.
getLng()
Returns: Double
Longitude of this organisation's location, or null if not set.
getTimezone()
Returns: String
Timezone id for this organisation, defaulting to the server's local timezone (or Pacific/Auckland) when the organisation has none set.
getFormattedName()
Returns: String
Display name for this organisation, delegating to the underlying Organisation's formatted name (typically its title, falling back to its org id). Equivalent to formattedName().
getFields()
Returns: Map<String,String>
All custom field values set on this organisation, keyed on field name. Loaded on first call and cached for reuse.
members(String groupName)
Returns: MembershipList
Finds all memberships of the named group within this organisation.
| Parameter | Description |
|---|---|
groupName | the name of the group to list memberships for |
isHasPrimaryMembers()
Returns: boolean
Checks whether this organisation has at least one group membership. Note this checks all memberships, not only primary ones, despite the method name.
getHasPrimaryMembers()
Returns: boolean
Checks whether this organisation has at least one group membership, delegating to isHasPrimaryMembers().
primaryMembers()
Returns: MembershipList
Finds all memberships in this organisation whose group is flagged as primary. Loaded on first call and cached for reuse.
childOrgs()
Returns: OrgDataList
Finds the direct child organisations of this organisation, ie organisations whose parent is this one, sorted by title (falling back to org id). Loaded on first call and cached for reuse.
childOrgsRecursive()
Returns: OrgDataList
Finds every organisation subordinate to this one, recursing through child organisations of child organisations and so on. Loaded on first call and cached for reuse.
findChildOrgByField(String fieldName, String value)
Returns: OrgData
Finds a direct child organisation whose named custom field has the given value. Results are cached by field name and value for reuse.
| Parameter | Description |
|---|---|
fieldName | the name of the custom field to match on |
value | the field value to match |
findChildOrgByField(String fieldName, String value, Boolean recursive)
Returns: OrgData
Finds a child organisation whose named custom field has the given value, optionally searching recursively through all descendant organisations rather than only direct children.
| Parameter | Description |
|---|---|
fieldName | the name of the custom field to match on |
value | the field value to match |
recursive | if true, search all descendant organisations rather than only direct children |
childOrg(String orgId)
Returns: OrgData
Finds a direct or descendant child organisation by its org id.
| Parameter | Description |
|---|---|
orgId | the org id of the child organisation to look up |
childOrg(long orgId)
Returns: OrgData
Finds a direct child organisation by its database id.
| Parameter | Description |
|---|---|
orgId | the database id of the child organisation to look up |
allSubOrgs(String orgType)
Returns: OrgDataList
Finds all organisations subordinate to this one, ie child organisations and their child organisations, and so on. Loaded on first call and cached for reuse.
| Parameter | Description |
|---|---|
orgType | optional. If given, limits the returned organisations to those with this organisation type |
org()
Returns: Organisation
Reloads the underlying Organisation entity for this bean from the current Hibernate session, by id.
findProfile(String emailOrName)
Returns: ExtProfileBean
Finds a profile in this organisation by email address (if the value contains "@") or by username otherwise.
| Parameter | Description |
|---|---|
emailOrName | the email address or username to look up |
findPrimaryMemberByField(String fieldName, String value, boolean contains)
Returns: MembershipBean
Finds a primary membership of this organisation whose named custom field matches the given value.
| Parameter | Description |
|---|---|
fieldName | the name of a custom field defined for the member |
value | the value to match against that field |
contains | if true, matches when the field value contains the given value rather than requiring an exact match |
findMembershipByField(String groupName, String fieldName, String value, boolean contains)
Returns: MembershipBean
Finds a member of the named group in this organisation whose custom field matches the given value. This only locates members directly connected to this organisation, not descendant organisations.
| Parameter | Description |
|---|---|
groupName | the name of the group whose members to search |
fieldName | the name of a custom field defined for the member |
value | the value to match against that field |
contains | if true, matches when the field value contains the given value rather than requiring an exact match |
findChildMembershipByField(String groupName, String fieldName, Object ovalue, boolean contains)
Returns: MembershipBean
Locates any membership within this organisation (including descendant organisations) with the given field name and value for the given group. Results are cached by group, field name and value for reuse.
| Parameter | Description |
|---|---|
groupName | the name of the group to search |
fieldName | the name of a custom field defined for the member |
ovalue | the value to match against that field, converted to a string for comparison |
contains | if true, matches when the field value contains the given value rather than requiring an exact match |
findChildMembershipByField(String groupName, String fieldName, Object ovalue, boolean contains, Boolean enabled)
Returns: MembershipBean
Locates any membership within this organisation (including descendant organisations) with the given field name and value for the given group, optionally restricted to enabled or disabled memberships. Results are cached by group, field name and value for reuse. Any exception encountered during the lookup is logged and treated as no match, rather than being propagated.
| Parameter | Description |
|---|---|
groupName | the name of the group to search |
fieldName | the name of a custom field defined for the member |
ovalue | the value to match against that field, converted to a string for comparison |
contains | if true, matches when the field value contains the given value rather than requiring an exact match |
enabled | if given, restricts the match to memberships that are enabled (true) or disabled (false) |
hasMembership(String userId, String groupName)
Returns: boolean
Checks whether a user has a membership to the named group. Any exception during the lookup is logged and treated as false rather than being propagated.
| Parameter | Description |
|---|---|
userId | the id of the profile to check |
groupName | the name of the group to check membership of |
createMembership(String userId, String email, String orgId, String groupName)
Returns: MembershipBean
Creates a new membership, or returns an existing one, for a profile. Will create the profile if it does not exist.
| Parameter | Description |
|---|---|
userId | optional. If given is taken as the unique id for the user |
email | required if userId is null, and optional if userId is provided. Used to locate the user if userId is not provided |
orgId | optional, if provided is the org id of the child org to create the membership in |
groupName | the group to add the user to, if they are not already a member |
deleteMembership(String groupName, Profile profile)
Returns: void
Deletes a profile's membership of the named group within the current admin organisation.
| Parameter | Description |
|---|---|
groupName | the name of the group to remove the membership from |
profile | the profile whose membership is being deleted |
deleteMembership(String groupName, String userId)
Returns: void
Deletes a user's membership of the named group within the current admin organisation, looking the profile up by username or email first.
| Parameter | Description |
|---|---|
groupName | the name of the group to remove the membership from |
userId | the username or email of the profile whose membership is being deleted |
deleteMembership(String groupName, ProfileBean profileBean)
Returns: void
Deletes a profile's membership of the named group within the current admin organisation.
| Parameter | Description |
|---|---|
groupName | the name of the group to remove the membership from |
profileBean | the profile whose membership is being deleted |
updateProfile(ProfileBean profile, String firstName, String surName, String phone)
Returns: void
Updates a profile's first name, surname and phone number and saves the change.
| Parameter | Description |
|---|---|
profile | the profile to update |
firstName | the new first name |
surName | the new surname |
phone | the new phone number |
updateProfile(ProfileBean profile, String firstName, String surName, String phone, String email)
Returns: void
Updates a profile's first name, surname, phone number and email address and saves the change.
| Parameter | Description |
|---|---|
profile | the profile to update |
firstName | the new first name |
surName | the new surname |
phone | the new phone number |
email | the new email address |
copyExtraFields(Profile profile, String groupName, OrgData withinOrg)
Returns: void
Copies a profile's custom field values for the named group from this organisation to their membership of the same group within another organisation.
| Parameter | Description |
|---|---|
profile | the profile whose field values are being copied |
groupName | the name of the group whose fields are copied |
withinOrg | the organisation whose membership receives the copied field values |
updateMembership(ProfileBean profile, String groupName, OrgData withinOrg, Map<Object,Object> fieldValues)
Returns: void
Creates or updates a profile's membership of the named group within another organisation, applying the given custom field values. If the membership does not already exist it is created, and any existing membership of the same group within this organisation is copied across then deleted.
| Parameter | Description |
|---|---|
profile | the profile whose membership is being created or updated |
groupName | the name of the group to join |
withinOrg | the organisation the membership is created within |
fieldValues | optional custom field values to set on the membership, keyed by field name |
createMembership(String userId, String email, OrgData orgDataToJoin, String groupName)
Returns: MembershipBean
Creates a new membership, or returns an existing one, for a profile within the given organisation. Will create the profile if it does not exist.
| Parameter | Description |
|---|---|
userId | optional. If given is taken as the unique id for the user |
email | required if userId is null, and optional if userId is provided. Used to locate the user if userId is not provided |
orgDataToJoin | optional, the organisation to create the membership in. Defaults to this organisation |
groupName | the group to add the user to, if they are not already a member |
getOrCreateChildOrg(String newOrgId, String orgTitle, String orgType)
Returns: OrgData
Create a new child organisation or return one if it already exists, by looking up the orgID
| Parameter | Description |
|---|---|
newOrgId | - required |
orgTitle | - optional long title |
orgType | - optional, oganisation type |
getParent()
Returns: OrgData
Returns the parent organisation of this organisation, unless this organisation is the owner of the current website, in which case it returns null. Loaded on first call and cached for reuse.
updateOrg(Map<String,String> parameters)
Returns: JsonResult
Update organisation info e.g. lat/lng, address, etc
| Parameter | Description |
|---|---|
parameters | Map<String, String> |
createGroup(String name, String title, String groupType, String regoMode)
Returns: Group
Creates a new group within this organisation, defaulting invalid or blank values for title, group type and registration mode.
| Parameter | Description |
|---|---|
name | the machine name of the new group |
title | the display title of the group, defaults to name if blank |
groupType | the group type, one of the Group.GROUP_TYPE_* constants, defaults to primary if not valid |
regoMode | the registration mode, one of the Group.REGO_MODE_* constants, defaults to closed if not valid |
createGroup(String name)
Returns: Group
Creates a new primary group within this organisation with a closed registration mode, using name as both the group's machine name and its title. Deprecated, use GroupManager instead.
| Parameter | Description |
|---|---|
name | the machine name and title of the new group |
entityObject()
Returns: BaseEntity
Returns the domain object underlying this bean.
isAdminDomain()
Returns: boolean
Checks whether this organisation is an admin domain, ie the top-level organisation for a Kademi account.
withinOrg()
Returns: Organisation
Returns the underlying Organisation entity as it was when this bean was constructed, without reloading it from the session as org() does.
rowId()
Returns: Long
Numeric database id of this organisation, used as the row identifier for Relational-based lookups.