Class OrganizationServiceUtil
Object
com.liferay.portal.kernel.service.OrganizationServiceUtil
Provides the remote service utility for Organization. This utility wraps
com.liferay.portal.service.impl.OrganizationServiceImpl
and is an
access point for service operations in application layer code running on a
remote server. Methods of this service are expected to have security checks
based on the propagated JAAS credentials because this service can be
accessed remotely.- Author:
- Brian Wing Shun Chan
- See Also:
- {$generated.description}
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addGroupOrganizations
(long groupId, long[] organizationIds) Adds the organizations to the group.static Organization
addOrganization
(String externalReferenceCode, long parentOrganizationId, String name, String type, long regionId, long countryId, long statusListTypeId, String comments, boolean site, ServiceContext serviceContext) Adds an organization.static Organization
addOrganization
(String externalReferenceCode, long parentOrganizationId, String name, String type, long regionId, long countryId, long statusListTypeId, String comments, boolean site, List<Address> addresses, List<EmailAddress> emailAddresses, List<OrgLabor> orgLabors, List<Phone> phones, List<Website> websites, ServiceContext serviceContext) Adds an organization with additional parameters.static User
addOrganizationUserByEmailAddress
(String emailAddress, long organizationId, ServiceContext serviceContext) static Organization
addOrUpdateOrganization
(String externalReferenceCode, long parentOrganizationId, String name, String type, long regionId, long countryId, long statusListTypeId, String comments, boolean hasLogo, byte[] logoBytes, boolean site, List<Address> addresses, List<EmailAddress> emailAddresses, List<OrgLabor> orgLabors, List<Phone> phones, List<Website> websites, ServiceContext serviceContext) static void
addPasswordPolicyOrganizations
(long passwordPolicyId, long[] organizationIds) Assigns the password policy to the organizations, removing any other currently assigned password policies.static void
addUserOrganizationByEmailAddress
(String emailAddress, long organizationId) static void
deleteLogo
(long organizationId) Deletes the organization's logo.static void
deleteOrganization
(long organizationId) Deletes the organization.static void
deleteUserOrganizationByEmailAddress
(String emailAddress, long organizationId) static Organization
fetchOrganization
(long organizationId) Returns the organization with the primary key.static Organization
fetchOrganizationByExternalReferenceCode
(String externalReferenceCode, long companyId) static List<Organization>
getGtOrganizations
(long gtOrganizationId, long companyId, long parentOrganizationId, int size) static Organization
getOrganization
(long organizationId) Returns the organization with the primary key.static Organization
getOrganizationByExternalReferenceCode
(String externalReferenceCode, long companyId) static long
getOrganizationId
(long companyId, String name) Returns the primary key of the organization with the name.static List<Organization>
getOrganizations
(long companyId, long parentOrganizationId) Returns all the organizations belonging to the parent organization.static List<Organization>
getOrganizations
(long companyId, long parentOrganizationId, int start, int end) Returns a range of all the organizations belonging to the parent organization.static List<Organization>
getOrganizations
(long companyId, long parentOrganizationId, int start, int end, OrderByComparator<Organization> orderByComparator) static List<Organization>
getOrganizations
(long companyId, long parentOrganizationId, String name, int start, int end) static List<Organization>
getOrganizations
(long companyId, long parentOrganizationId, String name, int start, int end, OrderByComparator<Organization> orderByComparator) static int
getOrganizationsCount
(long companyId, long parentOrganizationId) Returns the number of organizations belonging to the parent organization.static int
getOrganizationsCount
(long companyId, long parentOrganizationId, String name) static String
Returns the OSGi service identifier.static OrganizationService
static List<Organization>
getUserOrganizations
(long userId) Returns all the organizations with which the user is explicitly associated.static void
setGroupOrganizations
(long groupId, long[] organizationIds) Sets the organizations in the group, removing and adding organizations to the group as necessary.static void
setService
(OrganizationService service) static void
unsetGroupOrganizations
(long groupId, long[] organizationIds) Removes the organizations from the group.static void
unsetPasswordPolicyOrganizations
(long passwordPolicyId, long[] organizationIds) Removes the organizations from the password policy.static Organization
updateLogo
(long organizationId, byte[] logoBytes) static Organization
updateOrganization
(String externalReferenceCode, long organizationId, long parentOrganizationId, String name, String type, long regionId, long countryId, long statusListTypeId, String comments, boolean hasLogo, byte[] logoBytes, boolean site, List<Address> addresses, List<EmailAddress> emailAddresses, List<OrgLabor> orgLabors, List<Phone> phones, List<Website> websites, ServiceContext serviceContext) Updates the organization with additional parameters.static Organization
updateOrganization
(String externalReferenceCode, long organizationId, long parentOrganizationId, String name, String type, long regionId, long countryId, long statusListTypeId, String comments, boolean site, ServiceContext serviceContext) Updates the organization.
-
Constructor Details
-
OrganizationServiceUtil
public OrganizationServiceUtil()
-
-
Method Details
-
addGroupOrganizations
public static void addGroupOrganizations(long groupId, long[] organizationIds) throws PortalException Adds the organizations to the group.- Parameters:
groupId
- the primary key of the grouporganizationIds
- the primary keys of the organizations- Throws:
PortalException
-
addOrganization
public static Organization addOrganization(String externalReferenceCode, long parentOrganizationId, String name, String type, long regionId, long countryId, long statusListTypeId, String comments, boolean site, List<Address> addresses, List<EmailAddress> emailAddresses, List<OrgLabor> orgLabors, List<Phone> phones, List<Website> websites, ServiceContext serviceContext) throws PortalException Adds an organization with additional parameters.This method handles the creation and bookkeeping of the organization including its resources, metadata, and internal data structures.
- Parameters:
parentOrganizationId
- the primary key of the organization's parent organizationname
- the organization's nametype
- the organization's typeregionId
- the primary key of the organization's regioncountryId
- the primary key of the organization's countrystatusListTypeId
- the organization's workflow statuscomments
- the comments about the organizationsite
- whether the organization is to be associated with a main siteaddresses
- the organization's addressesemailAddresses
- the organization's email addressesorgLabors
- the organization's hours of operationphones
- the organization's phone numberswebsites
- the organization's websitesserviceContext
- the service context to be applied (optionallynull
). Can set asset category IDs, asset tag names, and expando bridge attributes for the organization.- Returns:
- the organization
- Throws:
PortalException
-
addOrganization
public static Organization addOrganization(String externalReferenceCode, long parentOrganizationId, String name, String type, long regionId, long countryId, long statusListTypeId, String comments, boolean site, ServiceContext serviceContext) throws PortalException Adds an organization.This method handles the creation and bookkeeping of the organization including its resources, metadata, and internal data structures.
- Parameters:
parentOrganizationId
- the primary key of the organization's parent organizationname
- the organization's nametype
- the organization's typeregionId
- the primary key of the organization's regioncountryId
- the primary key of the organization's countrystatusListTypeId
- the organization's workflow statuscomments
- the comments about the organizationsite
- whether the organization is to be associated with a main siteserviceContext
- the service context to be applied (optionallynull
). Can set asset category IDs, asset tag names, and expando bridge attributes for the organization.- Returns:
- the organization
- Throws:
PortalException
-
addOrganizationUserByEmailAddress
public static User addOrganizationUserByEmailAddress(String emailAddress, long organizationId, ServiceContext serviceContext) throws PortalException - Throws:
PortalException
-
addOrUpdateOrganization
public static Organization addOrUpdateOrganization(String externalReferenceCode, long parentOrganizationId, String name, String type, long regionId, long countryId, long statusListTypeId, String comments, boolean hasLogo, byte[] logoBytes, boolean site, List<Address> addresses, List<EmailAddress> emailAddresses, List<OrgLabor> orgLabors, List<Phone> phones, List<Website> websites, ServiceContext serviceContext) throws PortalException - Throws:
PortalException
-
addPasswordPolicyOrganizations
public static void addPasswordPolicyOrganizations(long passwordPolicyId, long[] organizationIds) throws PortalException Assigns the password policy to the organizations, removing any other currently assigned password policies.- Parameters:
passwordPolicyId
- the primary key of the password policyorganizationIds
- the primary keys of the organizations- Throws:
PortalException
-
addUserOrganizationByEmailAddress
public static void addUserOrganizationByEmailAddress(String emailAddress, long organizationId) throws PortalException - Throws:
PortalException
-
deleteLogo
Deletes the organization's logo.- Parameters:
organizationId
- the primary key of the organization- Throws:
PortalException
-
deleteOrganization
Deletes the organization. The organization's associated resources and assets are also deleted.- Parameters:
organizationId
- the primary key of the organization- Throws:
PortalException
-
deleteUserOrganizationByEmailAddress
public static void deleteUserOrganizationByEmailAddress(String emailAddress, long organizationId) throws PortalException - Throws:
PortalException
-
fetchOrganization
Returns the organization with the primary key.- Parameters:
organizationId
- the primary key of the organization- Returns:
- the organization with the primary key, or
null
if an organization with the primary key could not be found or if the user did not have permission to view the organization - Throws:
PortalException
-
fetchOrganizationByExternalReferenceCode
public static Organization fetchOrganizationByExternalReferenceCode(String externalReferenceCode, long companyId) throws PortalException - Throws:
PortalException
-
getGtOrganizations
public static List<Organization> getGtOrganizations(long gtOrganizationId, long companyId, long parentOrganizationId, int size) -
getOrganization
Returns the organization with the primary key.- Parameters:
organizationId
- the primary key of the organization- Returns:
- the organization with the primary key
- Throws:
PortalException
-
getOrganizationByExternalReferenceCode
public static Organization getOrganizationByExternalReferenceCode(String externalReferenceCode, long companyId) throws PortalException - Throws:
PortalException
-
getOrganizationId
Returns the primary key of the organization with the name.- Parameters:
companyId
- the primary key of the organization's companyname
- the organization's name- Returns:
- the primary key of the organization with the name, or
0
if the organization could not be found - Throws:
PortalException
-
getOrganizations
Returns all the organizations belonging to the parent organization.- Parameters:
companyId
- the primary key of the organizations' companyparentOrganizationId
- the primary key of the organizations' parent organization- Returns:
- the organizations belonging to the parent organization
-
getOrganizations
public static List<Organization> getOrganizations(long companyId, long parentOrganizationId, int start, int end) Returns a range of all the organizations belonging to the parent organization.Useful when paginating results. Returns a maximum of
end - start
instances.start
andend
are not primary keys, they are indexes in the result set. Thus,0
refers to the first result in the set. Setting bothstart
andend
toQueryUtil.ALL_POS
will return the full result set.- Parameters:
companyId
- the primary key of the organizations' companyparentOrganizationId
- the primary key of the organizations' parent organizationstart
- the lower bound of the range of organizations to returnend
- the upper bound of the range of organizations to return (not inclusive)- Returns:
- the range of organizations belonging to the parent organization
-
getOrganizations
public static List<Organization> getOrganizations(long companyId, long parentOrganizationId, int start, int end, OrderByComparator<Organization> orderByComparator) -
getOrganizations
public static List<Organization> getOrganizations(long companyId, long parentOrganizationId, String name, int start, int end) -
getOrganizations
public static List<Organization> getOrganizations(long companyId, long parentOrganizationId, String name, int start, int end, OrderByComparator<Organization> orderByComparator) -
getOrganizationsCount
public static int getOrganizationsCount(long companyId, long parentOrganizationId) Returns the number of organizations belonging to the parent organization.- Parameters:
companyId
- the primary key of the organizations' companyparentOrganizationId
- the primary key of the organizations' parent organization- Returns:
- the number of organizations belonging to the parent organization
-
getOrganizationsCount
public static int getOrganizationsCount(long companyId, long parentOrganizationId, String name) throws PortalException - Throws:
PortalException
-
getOSGiServiceIdentifier
Returns the OSGi service identifier.- Returns:
- the OSGi service identifier
-
getUserOrganizations
Returns all the organizations with which the user is explicitly associated.A user is considered to be explicitly associated with an organization if his account is individually created within the organization or if the user is later added as a member.
- Parameters:
userId
- the primary key of the user- Returns:
- the organizations with which the user is explicitly associated
- Throws:
PortalException
-
setGroupOrganizations
public static void setGroupOrganizations(long groupId, long[] organizationIds) throws PortalException Sets the organizations in the group, removing and adding organizations to the group as necessary.- Parameters:
groupId
- the primary key of the grouporganizationIds
- the primary keys of the organizations- Throws:
PortalException
-
unsetGroupOrganizations
public static void unsetGroupOrganizations(long groupId, long[] organizationIds) throws PortalException Removes the organizations from the group.- Parameters:
groupId
- the primary key of the grouporganizationIds
- the primary keys of the organizations- Throws:
PortalException
-
unsetPasswordPolicyOrganizations
public static void unsetPasswordPolicyOrganizations(long passwordPolicyId, long[] organizationIds) throws PortalException Removes the organizations from the password policy.- Parameters:
passwordPolicyId
- the primary key of the password policyorganizationIds
- the primary keys of the organizations- Throws:
PortalException
-
updateLogo
- Throws:
PortalException
-
updateOrganization
public static Organization updateOrganization(String externalReferenceCode, long organizationId, long parentOrganizationId, String name, String type, long regionId, long countryId, long statusListTypeId, String comments, boolean hasLogo, byte[] logoBytes, boolean site, List<Address> addresses, List<EmailAddress> emailAddresses, List<OrgLabor> orgLabors, List<Phone> phones, List<Website> websites, ServiceContext serviceContext) throws PortalException Updates the organization with additional parameters.- Parameters:
organizationId
- the primary key of the organizationparentOrganizationId
- the primary key of the organization's parent organizationname
- the organization's nametype
- the organization's typeregionId
- the primary key of the organization's regioncountryId
- the primary key of the organization's countrystatusListTypeId
- the organization's workflow statuscomments
- the comments about the organizationhasLogo
- if the organization has a custom logologoBytes
- the new logo image datasite
- whether the organization is to be associated with a main siteaddresses
- the organization's addressesemailAddresses
- the organization's email addressesorgLabors
- the organization's hours of operationphones
- the organization's phone numberswebsites
- the organization's websitesserviceContext
- the service context to be applied (optionallynull
). Can set asset category IDs and asset tag names for the organization, and merge expando bridge attributes for the organization.- Returns:
- the organization
- Throws:
PortalException
-
updateOrganization
public static Organization updateOrganization(String externalReferenceCode, long organizationId, long parentOrganizationId, String name, String type, long regionId, long countryId, long statusListTypeId, String comments, boolean site, ServiceContext serviceContext) throws PortalException Updates the organization.- Parameters:
organizationId
- the primary key of the organizationparentOrganizationId
- the primary key of the organization's parent organizationname
- the organization's nametype
- the organization's typeregionId
- the primary key of the organization's regioncountryId
- the primary key of the organization's countrystatusListTypeId
- the organization's workflow statuscomments
- the comments about the organizationsite
- whether the organization is to be associated with a main siteserviceContext
- the service context to be applied (optionallynull
). Can set asset category IDs and asset tag names for the organization, and merge expando bridge attributes for the organization.- Returns:
- the organization
- Throws:
PortalException
-
getService
-
setService
-