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

PropertyReturnsDescription
addressStringFirst line of this organisation's postal address.
addressLine2StringSecond line of this organisation's postal address, may be null or empty.
addressStateStringState or region component of this organisation's postal address.
adminDomainbooleanChecks whether this organisation is an admin domain, ie the top-level organisation for a Kademi account.
cityStringCity component of this organisation's postal address.
countryStringCountry component of this organisation's postal address.
emailStringContact email address for this organisation.
entityNameStringIdentifier used by the generic EntityBean API to refer to this organisation, which for an organisation is its org id.
fieldsMap<String,String>All custom field values set on this organisation, keyed on field name. Loaded on first call and cached for reuse.
formattedNameStringDisplay name for this organisation, delegating to the underlying Organisation's formatted name (typically its title, falling back to its org id). Equivalent to formattedName().
hasPrimaryMembersbooleanChecks whether this organisation has at least one group membership. Note this checks all memberships, not only primary ones, despite the method name.
hasPrimaryMembersbooleanChecks whether this organisation has at least one group membership, delegating to isHasPrimaryMembers().
idlongNumeric database id of this organisation.
latDoubleLatitude of this organisation's location, or null if not set.
lngDoubleLongitude of this organisation's location, or null if not set.
orgIdStringPath-safe, admin-unique identifier for this organisation, used in URLs and as the lookup key for child org searches.
orgTypeDisplayNameStringHuman-readable display name of this organisation's primary org type.
orgTypeNameStringMachine name of this organisation's primary org type.
parentOrgDataReturns 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.
phoneStringContact phone number for this organisation.
photoHashStringHash used to build the URL of this organisation's photo, or null if it has none.
postcodeStringPostcode component of this organisation's postal address.
selectedOrgTypesList<OrgTypeBean>All org types selected on this organisation, not just its primary one. Loaded on first call and cached for reuse.
stateStringState or region component of this organisation's postal address, duplicated from getAddressState.
timezoneStringTimezone id for this organisation, defaulting to the server's local timezone (or Pacific/Auckland) when the organisation has none set.
titleStringFree-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.

ParameterDescription
namethe 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.

ParameterDescription
groupNamethe 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.

ParameterDescription
fieldNamethe name of the custom field to match on
valuethe 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.

ParameterDescription
fieldNamethe name of the custom field to match on
valuethe field value to match
recursiveif 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.

ParameterDescription
orgIdthe org id of the child organisation to look up

childOrg(long orgId)

Returns: OrgData

Finds a direct child organisation by its database id.

ParameterDescription
orgIdthe 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.

ParameterDescription
orgTypeoptional. 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.

ParameterDescription
emailOrNamethe 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.

ParameterDescription
fieldNamethe name of a custom field defined for the member
valuethe value to match against that field
containsif 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.

ParameterDescription
groupNamethe name of the group whose members to search
fieldNamethe name of a custom field defined for the member
valuethe value to match against that field
containsif 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.

ParameterDescription
groupNamethe name of the group to search
fieldNamethe name of a custom field defined for the member
ovaluethe value to match against that field, converted to a string for comparison
containsif 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.

ParameterDescription
groupNamethe name of the group to search
fieldNamethe name of a custom field defined for the member
ovaluethe value to match against that field, converted to a string for comparison
containsif true, matches when the field value contains the given value rather than requiring an exact match
enabledif 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.

ParameterDescription
userIdthe id of the profile to check
groupNamethe 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.

ParameterDescription
userIdoptional. If given is taken as the unique id for the user
emailrequired if userId is null, and optional if userId is provided. Used to locate the user if userId is not provided
orgIdoptional, if provided is the org id of the child org to create the membership in
groupNamethe 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.

ParameterDescription
groupNamethe name of the group to remove the membership from
profilethe 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.

ParameterDescription
groupNamethe name of the group to remove the membership from
userIdthe 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.

ParameterDescription
groupNamethe name of the group to remove the membership from
profileBeanthe 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.

ParameterDescription
profilethe profile to update
firstNamethe new first name
surNamethe new surname
phonethe 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.

ParameterDescription
profilethe profile to update
firstNamethe new first name
surNamethe new surname
phonethe new phone number
emailthe 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.

ParameterDescription
profilethe profile whose field values are being copied
groupNamethe name of the group whose fields are copied
withinOrgthe 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.

ParameterDescription
profilethe profile whose membership is being created or updated
groupNamethe name of the group to join
withinOrgthe organisation the membership is created within
fieldValuesoptional 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.

ParameterDescription
userIdoptional. If given is taken as the unique id for the user
emailrequired if userId is null, and optional if userId is provided. Used to locate the user if userId is not provided
orgDataToJoinoptional, the organisation to create the membership in. Defaults to this organisation
groupNamethe 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

ParameterDescription
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

ParameterDescription
parametersMap<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.

ParameterDescription
namethe machine name of the new group
titlethe display title of the group, defaults to name if blank
groupTypethe group type, one of the Group.GROUP_TYPE_* constants, defaults to primary if not valid
regoModethe 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.

ParameterDescription
namethe 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.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.