Class OrganizationLocalServiceUtil
com.liferay.portal.service.impl.OrganizationLocalServiceImpl and
is an access point for service operations in application layer code running
on the local server. Methods of this service will not have security checks
based on the propagated JAAS credentials because this service can only be
accessed from within the same VM.- Author:
- Brian Wing Shun Chan
- See Also:
- {$generated.description}
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanaddGroupOrganization(long groupId, long organizationId) static booleanaddGroupOrganization(long groupId, Organization organization) static booleanaddGroupOrganizations(long groupId, long[] organizationIds) static booleanaddGroupOrganizations(long groupId, List<Organization> organizations) static OrganizationaddOrganization(long userId, long parentOrganizationId, String name, boolean site) Adds an organization.static OrganizationaddOrganization(Organization organization) Adds the organization to the database.static OrganizationaddOrganization(String externalReferenceCode, long userId, long parentOrganizationId, String name, String type, long regionId, long countryId, long statusListTypeId, String comments, boolean site, ServiceContext serviceContext) Adds an organization.static voidaddOrganizationResources(long userId, Organization organization) Adds a resource for each type of permission available on the organization.static UseraddOrganizationUserByEmailAddress(String emailAddress, long organizationId, ServiceContext serviceContext) static OrganizationaddOrUpdateOrganization(String externalReferenceCode, long userId, long parentOrganizationId, String name, String type, long regionId, long countryId, long statusListTypeId, String comments, boolean hasLogo, byte[] logoBytes, boolean site, ServiceContext serviceContext) static voidaddPasswordPolicyOrganizations(long passwordPolicyId, long[] organizationIds) Assigns the password policy to the organizations, removing any other currently assigned password policies.static booleanaddUserOrganization(long userId, long organizationId) static booleanaddUserOrganization(long userId, Organization organization) static voidaddUserOrganizationByEmailAddress(String emailAddress, long organizationId) static booleanaddUserOrganizations(long userId, long[] organizationIds) static booleanaddUserOrganizations(long userId, List<Organization> organizations) static voidclearGroupOrganizations(long groupId) static voidclearUserOrganizations(long userId) static OrganizationcreateOrganization(long organizationId) Creates a new organization with the primary key.static PersistedModelcreatePersistedModel(Serializable primaryKeyObj) static voiddeleteGroupOrganization(long groupId, long organizationId) static voiddeleteGroupOrganization(long groupId, Organization organization) static voiddeleteGroupOrganizations(long groupId, long[] organizationIds) static voiddeleteGroupOrganizations(long groupId, List<Organization> organizations) static voiddeleteLogo(long organizationId) Deletes the organization's logo.static OrganizationdeleteOrganization(long organizationId) Deletes the organization with the primary key from the database.static OrganizationdeleteOrganization(Organization organization) Deletes the organization from the database.static PersistedModeldeletePersistedModel(PersistedModel persistedModel) static voiddeleteUserOrganization(long userId, long organizationId) static voiddeleteUserOrganization(long userId, Organization organization) static voiddeleteUserOrganizationByEmailAddress(String emailAddress, long organizationId) static voiddeleteUserOrganizations(long userId, long[] organizationIds) static voiddeleteUserOrganizations(long userId, List<Organization> organizations) static <T> TdslQuery(com.liferay.petra.sql.dsl.query.DSLQuery dslQuery) static intdslQueryCount(com.liferay.petra.sql.dsl.query.DSLQuery dslQuery) static DynamicQuerystatic <T> List<T>dynamicQuery(DynamicQuery dynamicQuery) Performs a dynamic query on the database and returns the matching rows.static <T> List<T>dynamicQuery(DynamicQuery dynamicQuery, int start, int end) Performs a dynamic query on the database and returns a range of the matching rows.static <T> List<T>dynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator<T> orderByComparator) Performs a dynamic query on the database and returns an ordered range of the matching rows.static longdynamicQueryCount(DynamicQuery dynamicQuery) Returns the number of rows matching the dynamic query.static longdynamicQueryCount(DynamicQuery dynamicQuery, Projection projection) Returns the number of rows matching the dynamic query.static OrganizationfetchOrganization(long organizationId) static OrganizationfetchOrganization(long companyId, String name) Returns the organization with the name.static OrganizationfetchOrganizationByExternalReferenceCode(String externalReferenceCode, long companyId) static OrganizationfetchOrganizationByUuidAndCompanyId(String uuid, long companyId) Returns the organization with the matching UUID and company.static ActionableDynamicQuerystatic String[]getChildrenTypes(String type) static ExportActionableDynamicQuerygetExportActionableDynamicQuery(PortletDataContext portletDataContext) static List<Organization>getGroupOrganizations(long groupId) static List<Organization>getGroupOrganizations(long groupId, int start, int end) static List<Organization>getGroupOrganizations(long groupId, int start, int end, OrderByComparator<Organization> orderByComparator) static intgetGroupOrganizationsCount(long groupId) static long[]getGroupPrimaryKeys(long organizationId) Returns the groupIds of the groups associated with the organization.static List<Organization>getGroupUserOrganizations(long groupId, long userId) static List<Organization>static OrganizationgetOrganization(long organizationId) Returns the organization with the primary key.static OrganizationgetOrganization(long companyId, String name) Returns the organization with the name.static OrganizationgetOrganizationByExternalReferenceCode(String externalReferenceCode, long companyId) static OrganizationgetOrganizationByUuidAndCompanyId(String uuid, long companyId) Returns the organization with the matching UUID and company.static longgetOrganizationId(long companyId, String name) Returns the primary key of the organization with the name.static List<Organization>getOrganizations(int start, int end) Returns a range of all the organizations.static List<Organization>getOrganizations(long[] organizationIds) Returns the organizations with the primary keys.static List<Organization>getOrganizations(long userId, int start, int end, OrderByComparator<Organization> orderByComparator) 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, String name, int start, int end) static List<Organization>getOrganizations(long companyId, String treePath) static List<Organization>getOrganizations(long companyId, String name, int start, int end, OrderByComparator<Organization> orderByComparator) getOrganizationsAndUsers(long companyId, long parentOrganizationId, int status, int start, int end, OrderByComparator<?> orderByComparator) Returns all the organizations and users belonging to the parent organization.static intgetOrganizationsAndUsersCount(long companyId, long parentOrganizationId, int status) Returns the number of organizations and users belonging to the parent organization.static intReturns the number of organizations.static intgetOrganizationsCount(long companyId, long parentOrganizationId) Returns the number of organizations belonging to the parent organization.static intgetOrganizationsCount(long companyId, long parentOrganizationId, String name) static intgetOrganizationsCount(long companyId, String name) static StringReturns the OSGi service identifier.static List<Organization>getParentOrganizations(long organizationId) Returns the parent organizations in order by closest ancestor.static PersistedModelgetPersistedModel(Serializable primaryKeyObj) static OrganizationLocalServicestatic List<Organization>getSuborganizations(long companyId, long organizationId) Returns the suborganizations of the organization.static List<Organization>getSuborganizations(List<Organization> organizations) Returns the suborganizations of the organizations.static intgetSuborganizationsCount(long companyId, long organizationId) Returns the count of suborganizations of the organization.static List<Organization>getSubsetOrganizations(List<Organization> allOrganizations, List<Organization> availableOrganizations) Returns the intersection ofallOrganizationsandavailableOrganizations.static String[]getTypes()static long[]getUserOrganizationIds(long userId, boolean includeAdministrative) Returns all the IDs of organizations with which the user is explicitly associated, optionally including the IDs of organizations that the user administers or owns.static List<Organization>getUserOrganizations(long userId) static List<Organization>getUserOrganizations(long userId, boolean includeAdministrative) Returns all the organizations with which the user is explicitly associated, optionally including the organizations that the user administers or owns.static List<Organization>getUserOrganizations(long userId, int start, int end) static List<Organization>getUserOrganizations(long userId, int start, int end, OrderByComparator<Organization> orderByComparator) static intgetUserOrganizationsCount(long userId) static long[]getUserPrimaryKeys(long organizationId) Returns the userIds of the users associated with the organization.static booleanhasGroupOrganization(long groupId, long organizationId) static booleanhasGroupOrganizations(long groupId) static booleanhasPasswordPolicyOrganization(long passwordPolicyId, long organizationId) Returnstrueif the password policy has been assigned to the organization.static booleanhasUserOrganization(long userId, long organizationId) static booleanhasUserOrganization(long userId, long organizationId, boolean inheritSuborganizations, boolean includeSpecifiedOrganization) Returnstrueif the user is a member of the organization, optionally focusing on suborganizations or the specified organization.static booleanhasUserOrganizations(long userId) static booleanisCountryEnabled(String type) static booleanisCountryRequired(String type) static booleanisRootable(String type) static voidrebuildTree(long companyId) Rebuilds the organization's tree.static List<Organization>search(long companyId, long parentOrganizationId, String keywords, String type, Long regionId, Long countryId, LinkedHashMap<String, Object> params, int start, int end) Returns a name ordered range of all the organizations that match the keywords, type, region, and country, without using the indexer.static List<Organization>search(long companyId, long parentOrganizationId, String keywords, String type, Long regionId, Long countryId, LinkedHashMap<String, Object> params, int start, int end, OrderByComparator<Organization> orderByComparator) Returns an ordered range of all the organizations that match the keywords, type, region, and country, without using the indexer.static List<Organization>search(long companyId, long parentOrganizationId, String name, String type, String street, String city, String zip, Long regionId, Long countryId, LinkedHashMap<String, Object> params, boolean andOperator, int start, int end) Returns a name ordered range of all the organizations with the type, region, and country, and whose name, street, city, and zipcode match the keywords specified for them, without using the indexer.static List<Organization>search(long companyId, long parentOrganizationId, String name, String type, String street, String city, String zip, Long regionId, Long countryId, LinkedHashMap<String, Object> params, boolean andOperator, int start, int end, OrderByComparator<Organization> orderByComparator) Returns an ordered range of all the organizations with the type, region, and country, and whose name, street, city, and zipcode match the keywords specified for them, without using the indexer.static Hitssearch(long companyId, long parentOrganizationId, String name, String type, String street, String city, String zip, String region, String country, LinkedHashMap<String, Object> params, boolean andSearch, int start, int end, Sort sort) Returns an ordered range of all the organizations whose name, type, or location fields match the keywords specified for them, using the indexer.static Hitssearch(long companyId, long parentOrganizationId, String keywords, LinkedHashMap<String, Object> params, int start, int end, Sort sort) Returns an ordered range of all the organizations that match the keywords, using the indexer.static intsearchCount(long companyId, long parentOrganizationId, String keywords, String type, Long regionId, Long countryId, LinkedHashMap<String, Object> params) Returns the number of organizations that match the keywords, type, region, and country.static intsearchCount(long companyId, long parentOrganizationId, String name, String type, String street, String city, String zip, Long regionId, Long countryId, LinkedHashMap<String, Object> params, boolean andOperator) Returns the number of organizations with the type, region, and country, and whose name, street, city, and zipcode match the keywords specified for them.static BaseModelSearchResult<Organization>searchOrganizations(long companyId, long parentOrganizationId, String name, String type, String street, String city, String zip, String region, String country, LinkedHashMap<String, Object> params, boolean andSearch, int start, int end, Sort sort) static BaseModelSearchResult<Organization>searchOrganizations(long companyId, long parentOrganizationId, String keywords, LinkedHashMap<String, Object> params, int start, int end, Sort sort) static HitssearchOrganizationsAndUsers(long companyId, long parentOrganizationId, String keywords, int status, LinkedHashMap<String, Object> params, int start, int end, Sort[] sorts) Returns the organizations and users that match the keywords specified for them and belong to the parent organization.static intsearchOrganizationsAndUsersCount(long companyId, long parentOrganizationId, String keywords, int status, LinkedHashMap<String, Object> params) Returns the number of organizations and users that match the keywords specified for them and belong to the parent organization.static voidsetGroupOrganizations(long groupId, long[] organizationIds) static voidsetService(OrganizationLocalService service) static voidsetUserOrganizations(long userId, long[] organizationIds) static voidunsetGroupOrganizations(long groupId, long[] organizationIds) Removes the organizations from the group.static voidunsetPasswordPolicyOrganizations(long passwordPolicyId, long[] organizationIds) Removes the organizations from the password policy.static voidupdateAsset(long userId, Organization organization, long[] assetCategoryIds, String[] assetTagNames) Updates the organization's asset with the new asset categories and tag names, removing and adding asset categories and tag names as necessary.static OrganizationupdateLogo(long organizationId, byte[] logoBytes) static OrganizationupdateOrganization(Organization organization) Updates the organization in the database or adds it if it does not yet exist.static OrganizationupdateOrganization(String externalReferenceCode, long companyId, long organizationId, long parentOrganizationId, String name, String type, long regionId, long countryId, long statusListTypeId, String comments, boolean hasLogo, byte[] logoBytes, boolean site, ServiceContext serviceContext) Updates the organization.
-
Constructor Details
-
OrganizationLocalServiceUtil
public OrganizationLocalServiceUtil()
-
-
Method Details
-
addGroupOrganization
public static boolean addGroupOrganization(long groupId, long organizationId) -
addGroupOrganization
-
addGroupOrganizations
-
addGroupOrganizations
public static boolean addGroupOrganizations(long groupId, long[] organizationIds) -
addOrganization
public static Organization addOrganization(long userId, long parentOrganizationId, String name, boolean site) throws PortalException Adds an organization.This method handles the creation and bookkeeping of the organization including its resources, metadata, and internal data structures. It is not necessary to make a subsequent call to
addOrganizationResources(long, Organization).- Parameters:
userId- the primary key of the creator/owner of the organizationparentOrganizationId- the primary key of the organization's parent organizationname- the organization's namesite- whether the organization is to be associated with a main site- Returns:
- the organization
- Throws:
PortalException
-
addOrganization
Adds the organization to the database. Also notifies the appropriate model listeners.Important: Inspect OrganizationLocalServiceImpl for overloaded versions of the method. If provided, use these entry points to the API, as the implementation logic may require the additional parameters defined there.
- Parameters:
organization- the organization- Returns:
- the organization that was added
-
addOrganization
public static Organization addOrganization(String externalReferenceCode, long userId, 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. It is not necessary to make a subsequent call to
addOrganizationResources(long, Organization).- Parameters:
userId- the primary key of the creator/owner 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, asset tag names, and expando bridge attributes for the organization.- Returns:
- the organization
- Throws:
PortalException
-
addOrganizationResources
public static void addOrganizationResources(long userId, Organization organization) throws PortalException Adds a resource for each type of permission available on the organization.- Parameters:
userId- the primary key of the creator/owner of the organizationorganization- 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 userId, long parentOrganizationId, String name, String type, long regionId, long countryId, long statusListTypeId, String comments, boolean hasLogo, byte[] logoBytes, boolean site, ServiceContext serviceContext) throws PortalException - Throws:
PortalException
-
addPasswordPolicyOrganizations
public static void addPasswordPolicyOrganizations(long passwordPolicyId, long[] organizationIds) 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
-
addUserOrganization
public static boolean addUserOrganization(long userId, long organizationId) -
addUserOrganization
-
addUserOrganizationByEmailAddress
public static void addUserOrganizationByEmailAddress(String emailAddress, long organizationId) throws PortalException - Throws:
PortalException
-
addUserOrganizations
-
addUserOrganizations
public static boolean addUserOrganizations(long userId, long[] organizationIds) -
clearGroupOrganizations
public static void clearGroupOrganizations(long groupId) -
clearUserOrganizations
public static void clearUserOrganizations(long userId) -
createOrganization
Creates a new organization with the primary key. Does not add the organization to the database.- Parameters:
organizationId- the primary key for the new organization- Returns:
- the new organization
-
createPersistedModel
public static PersistedModel createPersistedModel(Serializable primaryKeyObj) throws PortalException - Throws:
PortalException
-
deleteGroupOrganization
public static void deleteGroupOrganization(long groupId, long organizationId) -
deleteGroupOrganization
-
deleteGroupOrganizations
-
deleteGroupOrganizations
public static void deleteGroupOrganizations(long groupId, long[] organizationIds) -
deleteLogo
Deletes the organization's logo.- Parameters:
organizationId- the primary key of the organization- Throws:
PortalException
-
deleteOrganization
Deletes the organization with the primary key from the database. Also notifies the appropriate model listeners.Important: Inspect OrganizationLocalServiceImpl for overloaded versions of the method. If provided, use these entry points to the API, as the implementation logic may require the additional parameters defined there.
- Parameters:
organizationId- the primary key of the organization- Returns:
- the organization that was removed
- Throws:
PortalException- if a organization with the primary key could not be found
-
deleteOrganization
Deletes the organization from the database. Also notifies the appropriate model listeners.Important: Inspect OrganizationLocalServiceImpl for overloaded versions of the method. If provided, use these entry points to the API, as the implementation logic may require the additional parameters defined there.
- Parameters:
organization- the organization- Returns:
- the organization that was removed
- Throws:
PortalException
-
deletePersistedModel
public static PersistedModel deletePersistedModel(PersistedModel persistedModel) throws PortalException - Throws:
PortalException
-
deleteUserOrganization
public static void deleteUserOrganization(long userId, long organizationId) -
deleteUserOrganization
-
deleteUserOrganizationByEmailAddress
public static void deleteUserOrganizationByEmailAddress(String emailAddress, long organizationId) throws PortalException - Throws:
PortalException
-
deleteUserOrganizations
-
deleteUserOrganizations
public static void deleteUserOrganizations(long userId, long[] organizationIds) -
dslQuery
public static <T> T dslQuery(com.liferay.petra.sql.dsl.query.DSLQuery dslQuery) -
dslQueryCount
public static int dslQueryCount(com.liferay.petra.sql.dsl.query.DSLQuery dslQuery) -
dynamicQuery
-
dynamicQuery
Performs a dynamic query on the database and returns the matching rows.- Parameters:
dynamicQuery- the dynamic query- Returns:
- the matching rows
-
dynamicQuery
Performs a dynamic query on the database and returns a range of the matching rows.Useful when paginating results. Returns a maximum of
end - startinstances.startandendare not primary keys, they are indexes in the result set. Thus,0refers to the first result in the set. Setting bothstartandendtocom.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POSwill return the full result set. IforderByComparatoris specified, then the query will include the given ORDER BY logic. IforderByComparatoris absent, then the query will include the default ORDER BY logic fromcom.liferay.portal.model.impl.OrganizationModelImpl.- Parameters:
dynamicQuery- the dynamic querystart- the lower bound of the range of model instancesend- the upper bound of the range of model instances (not inclusive)- Returns:
- the range of matching rows
-
dynamicQuery
public static <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator<T> orderByComparator) Performs a dynamic query on the database and returns an ordered range of the matching rows.Useful when paginating results. Returns a maximum of
end - startinstances.startandendare not primary keys, they are indexes in the result set. Thus,0refers to the first result in the set. Setting bothstartandendtocom.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POSwill return the full result set. IforderByComparatoris specified, then the query will include the given ORDER BY logic. IforderByComparatoris absent, then the query will include the default ORDER BY logic fromcom.liferay.portal.model.impl.OrganizationModelImpl.- Parameters:
dynamicQuery- the dynamic querystart- the lower bound of the range of model instancesend- the upper bound of the range of model instances (not inclusive)orderByComparator- the comparator to order the results by (optionallynull)- Returns:
- the ordered range of matching rows
-
dynamicQueryCount
Returns the number of rows matching the dynamic query.- Parameters:
dynamicQuery- the dynamic query- Returns:
- the number of rows matching the dynamic query
-
dynamicQueryCount
Returns the number of rows matching the dynamic query.- Parameters:
dynamicQuery- the dynamic queryprojection- the projection to apply to the query- Returns:
- the number of rows matching the dynamic query
-
fetchOrganization
-
fetchOrganization
Returns the organization with the name.- Parameters:
companyId- the primary key of the organization's companyname- the organization's name- Returns:
- the organization with the name, or
nullif no organization could be found
-
fetchOrganizationByExternalReferenceCode
public static Organization fetchOrganizationByExternalReferenceCode(String externalReferenceCode, long companyId) -
fetchOrganizationByUuidAndCompanyId
Returns the organization with the matching UUID and company.- Parameters:
uuid- the organization's UUIDcompanyId- the primary key of the company- Returns:
- the matching organization, or
nullif a matching organization could not be found
-
getActionableDynamicQuery
-
getChildrenTypes
-
getExportActionableDynamicQuery
public static ExportActionableDynamicQuery getExportActionableDynamicQuery(PortletDataContext portletDataContext) -
getGroupOrganizations
-
getGroupOrganizations
-
getGroupOrganizations
public static List<Organization> getGroupOrganizations(long groupId, int start, int end, OrderByComparator<Organization> orderByComparator) -
getGroupOrganizationsCount
public static int getGroupOrganizationsCount(long groupId) -
getGroupPrimaryKeys
public static long[] getGroupPrimaryKeys(long organizationId) Returns the groupIds of the groups associated with the organization.- Parameters:
organizationId- the organizationId of the organization- Returns:
- long[] the groupIds of groups associated with the organization
-
getGroupUserOrganizations
public static List<Organization> getGroupUserOrganizations(long groupId, long userId) throws PortalException - Throws:
PortalException
-
getIndexableActionableDynamicQuery
-
getNoAssetOrganizations
-
getOrganization
Returns the organization with the primary key.- Parameters:
organizationId- the primary key of the organization- Returns:
- the organization
- Throws:
PortalException- if a organization with the primary key could not be found
-
getOrganization
Returns the organization with the name.- Parameters:
companyId- the primary key of the organization's companyname- the organization's name- Returns:
- the organization with the name
- Throws:
PortalException
-
getOrganizationByExternalReferenceCode
public static Organization getOrganizationByExternalReferenceCode(String externalReferenceCode, long companyId) throws PortalException - Throws:
PortalException
-
getOrganizationByUuidAndCompanyId
public static Organization getOrganizationByUuidAndCompanyId(String uuid, long companyId) throws PortalException Returns the organization with the matching UUID and company.- Parameters:
uuid- the organization's UUIDcompanyId- the primary key of the company- Returns:
- the matching organization
- Throws:
PortalException- if a matching organization could not be found
-
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
0if the organization could not be found
-
getOrganizations
Returns a range of all the organizations.Useful when paginating results. Returns a maximum of
end - startinstances.startandendare not primary keys, they are indexes in the result set. Thus,0refers to the first result in the set. Setting bothstartandendtocom.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POSwill return the full result set. IforderByComparatoris specified, then the query will include the given ORDER BY logic. IforderByComparatoris absent, then the query will include the default ORDER BY logic fromcom.liferay.portal.model.impl.OrganizationModelImpl.- Parameters:
start- the lower bound of the range of organizationsend- the upper bound of the range of organizations (not inclusive)- Returns:
- the range of organizations
-
getOrganizations
public static List<Organization> getOrganizations(long userId, int start, int end, OrderByComparator<Organization> orderByComparator) throws PortalException - Throws:
PortalException
-
getOrganizations
Returns all the organizations belonging to the parent organization.- Parameters:
companyId- the primary key of the organization's companyparentOrganizationId- the primary key of the organization's 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 - startinstances.startandendare not primary keys, they are indexes in the result set. Thus,0refers to the first result in the set. Setting bothstartandendtoQueryUtil#ALL_POSwill return the full result set.- Parameters:
companyId- the primary key of the organization's companyparentOrganizationId- the primary key of the organization's 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
- See Also:
-
getOrganizations
public static List<Organization> getOrganizations(long companyId, long parentOrganizationId, String name, int start, int end) -
getOrganizations
-
getOrganizations
public static List<Organization> getOrganizations(long companyId, String name, int start, int end, OrderByComparator<Organization> orderByComparator) -
getOrganizations
Returns the organizations with the primary keys.- Parameters:
organizationIds- the primary keys of the organizations- Returns:
- the organizations with the primary keys
- Throws:
PortalException
-
getOrganizationsAndUsers
public static List<Object> getOrganizationsAndUsers(long companyId, long parentOrganizationId, int status, int start, int end, OrderByComparator<?> orderByComparator) Returns all the organizations and users belonging to the parent organization.- Parameters:
companyId- the primary key of the organization and user's companyparentOrganizationId- the primary key of the organization and user's parent organizationstatus- the user's workflow statusstart- the lower bound of the range of organizations and users to returnend- the upper bound of the range of organizations and users to return (not inclusive)orderByComparator- the comparator to order the organizations and users (optionallynull)- Returns:
- the organizations and users belonging to the parent organization
-
getOrganizationsAndUsersCount
public static int getOrganizationsAndUsersCount(long companyId, long parentOrganizationId, int status) Returns the number of organizations and users belonging to the parent organization.- Parameters:
companyId- the primary key of the organization and user's companyparentOrganizationId- the primary key of the organization and user's parent organizationstatus- the user's workflow status- Returns:
- the number of organizations and users belonging to the parent organization
-
getOrganizationsCount
public static int getOrganizationsCount()Returns the number of organizations.- Returns:
- the number of organizations
-
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 organization's companyparentOrganizationId- the primary key of the organization's parent organization- Returns:
- the number of organizations belonging to the parent organization
-
getOrganizationsCount
-
getOrganizationsCount
-
getOSGiServiceIdentifier
Returns the OSGi service identifier.- Returns:
- the OSGi service identifier
-
getParentOrganizations
Returns the parent organizations in order by closest ancestor. The list starts with the organization itself.- Parameters:
organizationId- the primary key of the organization- Returns:
- the parent organizations in order by closest ancestor
- Throws:
PortalException
-
getPersistedModel
- Throws:
PortalException
-
getSuborganizations
Returns the suborganizations of the organizations.- Parameters:
organizations- the organizations from which to get suborganizations- Returns:
- the suborganizations of the organizations
-
getSuborganizations
Returns the suborganizations of the organization.- Parameters:
companyId- the primary key of the organization's companyorganizationId- the primary key of the organization- Returns:
- the suborganizations of the organization
-
getSuborganizationsCount
public static int getSuborganizationsCount(long companyId, long organizationId) Returns the count of suborganizations of the organization.- Parameters:
companyId- the primary key of the organization's companyorganizationId- the primary key of the organization- Returns:
- the count of suborganizations of the organization
-
getSubsetOrganizations
public static List<Organization> getSubsetOrganizations(List<Organization> allOrganizations, List<Organization> availableOrganizations) Returns the intersection ofallOrganizationsandavailableOrganizations.- Parameters:
allOrganizations- the organizations to check for availabilityavailableOrganizations- the available organizations- Returns:
- the intersection of
allOrganizationsandavailableOrganizations
-
getTypes
-
getUserOrganizationIds
public static long[] getUserOrganizationIds(long userId, boolean includeAdministrative) throws PortalException Returns all the IDs of organizations with which the user is explicitly associated, optionally including the IDs of organizations that the user administers or owns.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 to it.
- Parameters:
userId- the primary key of the userincludeAdministrative- whether to include the IDs of organizations that the user administers or owns, even if he's not a member of the organizations- Returns:
- the IDs of organizations with which the user is explicitly associated, optionally including the IDs of organizations that the user administers or owns
- Throws:
PortalException
-
getUserOrganizations
-
getUserOrganizations
public static List<Organization> getUserOrganizations(long userId, boolean includeAdministrative) throws PortalException Returns all the organizations with which the user is explicitly associated, optionally including the organizations that the user administers or owns.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 userincludeAdministrative- whether to include the IDs of organizations that the user administers or owns, even if he's not a member of the organizations- Returns:
- the organizations with which the user is explicitly associated, optionally including the organizations that the user administers or owns
- Throws:
PortalException
-
getUserOrganizations
-
getUserOrganizations
public static List<Organization> getUserOrganizations(long userId, int start, int end, OrderByComparator<Organization> orderByComparator) -
getUserOrganizationsCount
public static int getUserOrganizationsCount(long userId) -
getUserPrimaryKeys
public static long[] getUserPrimaryKeys(long organizationId) Returns the userIds of the users associated with the organization.- Parameters:
organizationId- the organizationId of the organization- Returns:
- long[] the userIds of users associated with the organization
-
hasGroupOrganization
public static boolean hasGroupOrganization(long groupId, long organizationId) -
hasGroupOrganizations
public static boolean hasGroupOrganizations(long groupId) -
hasPasswordPolicyOrganization
public static boolean hasPasswordPolicyOrganization(long passwordPolicyId, long organizationId) Returnstrueif the password policy has been assigned to the organization.- Parameters:
passwordPolicyId- the primary key of the password policyorganizationId- the primary key of the organization- Returns:
trueif the password policy has been assigned to the organization;falseotherwise
-
hasUserOrganization
public static boolean hasUserOrganization(long userId, long organizationId) -
hasUserOrganization
public static boolean hasUserOrganization(long userId, long organizationId, boolean inheritSuborganizations, boolean includeSpecifiedOrganization) throws PortalException Returnstrueif the user is a member of the organization, optionally focusing on suborganizations or the specified organization. This method is usually called to determine if the user has view access to a resource belonging to the organization.-
If
inheritSuborganizations=: the method checks whether the user belongs to the organization specified byfalseorganizationId. The parameterincludeSpecifiedOrganizationis ignored. -
The parameter
includeSpecifiedOrganizationis ignored unlessinheritSuborganizationsis alsotrue. -
If
inheritSuborganizations=andtrueincludeSpecifiedOrganization=: the method checks whether the user belongs to one of the child organizations of the one specified byfalseorganizationId. -
If
inheritSuborganizations=andtrueincludeSpecifiedOrganization=: the method checks whether the user belongs to the organization specified bytrueorganizationIdor any of its child organizations.
- Parameters:
userId- the primary key of the organization's userorganizationId- the primary key of the organizationinheritSuborganizations- iftruesuborganizations are considered in the determinationincludeSpecifiedOrganization- iftruethe organization specified byorganizationIdis considered in the determination- Returns:
trueif the user has access to the organization;falseotherwise- Throws:
PortalException- See Also:
-
If
-
hasUserOrganizations
public static boolean hasUserOrganizations(long userId) -
isCountryEnabled
-
isCountryRequired
-
isRootable
-
rebuildTree
Rebuilds the organization's tree.Only call this method if the tree has become stale through operations other than normal CRUD. Under normal circumstances the tree is automatically rebuilt whenever necessary.
- Parameters:
companyId- the primary key of the organization's company- Throws:
PortalException
-
search
public static Hits search(long companyId, long parentOrganizationId, String keywords, LinkedHashMap<String, Object> params, int start, int end, Sort sort) Returns an ordered range of all the organizations that match the keywords, using the indexer. It is preferable to use this method instead of the non-indexed version whenever possible for performance reasons.Useful when paginating results. Returns a maximum of
end - startinstances.startandendare not primary keys, they are indexes in the result set. Thus,0refers to the first result in the set. Setting bothstartandendtoQueryUtil#ALL_POSwill return the full result set.- Parameters:
companyId- the primary key of the organization's companyparentOrganizationId- the primary key of the organization's parent organizationkeywords- the keywords (space separated), which may occur in the organization's name, street, city, zipcode, type, region or country (optionallynull)params- the finder parameters (optionallynull).start- the lower bound of the range of organizations to returnend- the upper bound of the range of organizations to return (not inclusive)sort- the field and direction by which to sort (optionallynull)- Returns:
- the matching organizations ordered by name
-
search
public static List<Organization> search(long companyId, long parentOrganizationId, String keywords, String type, Long regionId, Long countryId, LinkedHashMap<String, Object> params, int start, int end) Returns a name ordered range of all the organizations that match the keywords, type, region, and country, without using the indexer. It is preferable to use the indexed versionsearch(long, long, String, LinkedHashMap, int, int, Sort)instead of this method wherever possible for performance reasons.Useful when paginating results. Returns a maximum of
end - startinstances.startandendare not primary keys, they are indexes in the result set. Thus,0refers to the first result in the set. Setting bothstartandendtoQueryUtil#ALL_POSwill return the full result set.- Parameters:
companyId- the primary key of the organization's companyparentOrganizationId- the primary key of the organization's parent organizationkeywords- the keywords (space separated), which may occur in the organization's name, street, city, or zipcode (optionallynull)type- the organization's type (optionallynull)regionId- the primary key of the organization's region (optionallynull)countryId- the primary key of the organization's country (optionallynull)params- the finder params. For more information seeOrganizationFinderstart- the lower bound of the range of organizations to returnend- the upper bound of the range of organizations to return (not inclusive)- Returns:
- the matching organizations ordered by name
- See Also:
-
search
public static List<Organization> search(long companyId, long parentOrganizationId, String keywords, String type, Long regionId, Long countryId, LinkedHashMap<String, Object> params, int start, int end, OrderByComparator<Organization> orderByComparator) Returns an ordered range of all the organizations that match the keywords, type, region, and country, without using the indexer. It is preferable to use the indexed versionsearch(long, long, String, String, String, String, String, String, String, LinkedHashMap, boolean, int, int, Sort)instead of this method wherever possible for performance reasons.Useful when paginating results. Returns a maximum of
end - startinstances.startandendare not primary keys, they are indexes in the result set. Thus,0refers to the first result in the set. Setting bothstartandendtoQueryUtil#ALL_POSwill return the full result set.- Parameters:
companyId- the primary key of the organization's companyparentOrganizationId- the primary key of the organization's parent organizationkeywords- the keywords (space separated), which may occur in the organization's name, street, city, or zipcode (optionallynull)type- the organization's type (optionallynull)regionId- the primary key of the organization's region (optionallynull)countryId- the primary key of the organization's country (optionallynull)params- the finder params. For more information seeOrganizationFinderstart- the lower bound of the range of organizations to returnend- the upper bound of the range of organizations to return (not inclusive)orderByComparator- the comparator to order the organizations (optionallynull)- Returns:
- the matching organizations ordered by comparator
orderByComparator - See Also:
-
search
public static List<Organization> search(long companyId, long parentOrganizationId, String name, String type, String street, String city, String zip, Long regionId, Long countryId, LinkedHashMap<String, Object> params, boolean andOperator, int start, int end) Returns a name ordered range of all the organizations with the type, region, and country, and whose name, street, city, and zipcode match the keywords specified for them, without using the indexer. It is preferable to use the indexed versionsearch(long, long, String, String, String, String, String, String, String, LinkedHashMap, boolean, int, int, Sort)instead of this method wherever possible for performance reasons.Useful when paginating results. Returns a maximum of
end - startinstances.startandendare not primary keys, they are indexes in the result set. Thus,0refers to the first result in the set. Setting bothstartandendtoQueryUtil#ALL_POSwill return the full result set.- Parameters:
companyId- the primary key of the organization's companyparentOrganizationId- the primary key of the organization's parentname- the name keywords (space separated, optionallynull)type- the organization's type (optionallynull)street- the street keywords (optionallynull)city- the city keywords (optionallynull)zip- the zipcode keywords (optionallynull)regionId- the primary key of the organization's region (optionallynull)countryId- the primary key of the organization's country (optionallynull)params- the finder parameters (optionallynull). For more information seeOrganizationFinderandOperator- whether every field must match its keywords, or just one field. For example, "organizations with the name 'Employees' and city 'Chicago'" vs "organizations with the name 'Employees' or the city 'Chicago'".start- the lower bound of the range of organizations to returnend- the upper bound of the range of organizations to return (not inclusive)- Returns:
- the matching organizations ordered by name
- See Also:
-
search
public static List<Organization> search(long companyId, long parentOrganizationId, String name, String type, String street, String city, String zip, Long regionId, Long countryId, LinkedHashMap<String, Object> params, boolean andOperator, int start, int end, OrderByComparator<Organization> orderByComparator) Returns an ordered range of all the organizations with the type, region, and country, and whose name, street, city, and zipcode match the keywords specified for them, without using the indexer. It is preferable to use the indexed versionsearch(long, long, String, String, String, String, String, String, String, LinkedHashMap, boolean, int, int, Sort)instead of this method wherever possible for performance reasons.Useful when paginating results. Returns a maximum of
end - startinstances.startandendare not primary keys, they are indexes in the result set. Thus,0refers to the first result in the set. Setting bothstartandendtoQueryUtil#ALL_POSwill return the full result set.- Parameters:
companyId- the primary key of the organization's companyparentOrganizationId- the primary key of the organization's parent organizationname- the name keywords (space separated, optionallynull)type- the organization's type (optionallynull)street- the street keywords (optionallynull)city- the city keywords (optionallynull)zip- the zipcode keywords (optionallynull)regionId- the primary key of the organization's region (optionallynull)countryId- the primary key of the organization's country (optionallynull)params- the finder parameters (optionallynull). For more information seeOrganizationFinderandOperator- whether every field must match its keywords, or just one field. For example, "organizations with the name 'Employees' and city 'Chicago'" vs "organizations with the name 'Employees' or the city 'Chicago'".start- the lower bound of the range of organizations to returnend- the upper bound of the range of organizations to return (not inclusive)orderByComparator- the comparator to order the organizations (optionallynull)- Returns:
- the matching organizations ordered by comparator
orderByComparator - See Also:
-
search
public static Hits search(long companyId, long parentOrganizationId, String name, String type, String street, String city, String zip, String region, String country, LinkedHashMap<String, Object> params, boolean andSearch, int start, int end, Sort sort) Returns an ordered range of all the organizations whose name, type, or location fields match the keywords specified for them, using the indexer. It is preferable to use this method instead of the non-indexed version whenever possible for performance reasons.Useful when paginating results. Returns a maximum of
end - startinstances.startandendare not primary keys, they are indexes in the result set. Thus,0refers to the first result in the set. Setting bothstartandendtoQueryUtil#ALL_POSwill return the full result set.- Parameters:
companyId- the primary key of the organization's companyparentOrganizationId- the primary key of the organization's parent organizationname- the name keywords (space separated, optionallynull)type- the type keywords (optionallynull)street- the street keywords (optionallynull)city- the city keywords (optionallynull)zip- the zipcode keywords (optionallynull)region- the region keywords (optionallynull)country- the country keywords (optionallynull)params- the finder parameters (optionallynull).andSearch- whether every field must match its keywords or just one fieldstart- the lower bound of the range of organizations to returnend- the upper bound of the range of organizations to return (not inclusive)sort- the field and direction by which to sort (optionallynull)- Returns:
- the matching organizations ordered by
sort
-
searchCount
public static int searchCount(long companyId, long parentOrganizationId, String keywords, String type, Long regionId, Long countryId, LinkedHashMap<String, Object> params) Returns the number of organizations that match the keywords, type, region, and country.- Parameters:
companyId- the primary key of the organization's companyparentOrganizationId- the primary key of the organization's parent organizationkeywords- the keywords (space separated), which may occur in the organization's name, street, city, or zipcode (optionallynull)type- the organization's type (optionallynull)regionId- the primary key of the organization's region (optionallynull)countryId- the primary key of the organization's country (optionallynull)params- the finder parameters (optionallynull). For more information seeOrganizationFinder- Returns:
- the number of matching organizations
- See Also:
-
searchCount
public static int searchCount(long companyId, long parentOrganizationId, String name, String type, String street, String city, String zip, Long regionId, Long countryId, LinkedHashMap<String, Object> params, boolean andOperator) Returns the number of organizations with the type, region, and country, and whose name, street, city, and zipcode match the keywords specified for them.- Parameters:
companyId- the primary key of the organization's companyparentOrganizationId- the primary key of the organization's parent organizationname- the name keywords (space separated, optionallynull)type- the organization's type (optionallynull)street- the street keywords (optionallynull)city- the city keywords (optionallynull)zip- the zipcode keywords (optionallynull)regionId- the primary key of the organization's region (optionallynull)countryId- the primary key of the organization's country (optionallynull)params- the finder parameters (optionallynull). For more information seeOrganizationFinderandOperator- whether every field must match its keywords, or just one field. For example, "organizations with the name 'Employees' and city 'Chicago'" vs "organizations with the name 'Employees' or the city 'Chicago'".- Returns:
- the number of matching organizations
- See Also:
-
searchOrganizations
public static BaseModelSearchResult<Organization> searchOrganizations(long companyId, long parentOrganizationId, String keywords, LinkedHashMap<String, Object> params, int start, int end, Sort sort) throws PortalException- Throws:
PortalException
-
searchOrganizations
public static BaseModelSearchResult<Organization> searchOrganizations(long companyId, long parentOrganizationId, String name, String type, String street, String city, String zip, String region, String country, LinkedHashMap<String, Object> params, boolean andSearch, int start, int end, Sort sort) throws PortalException- Throws:
PortalException
-
searchOrganizationsAndUsers
public static Hits searchOrganizationsAndUsers(long companyId, long parentOrganizationId, String keywords, int status, LinkedHashMap<String, Object> params, int start, int end, Sort[] sorts) throws PortalExceptionReturns the organizations and users that match the keywords specified for them and belong to the parent organization.- Parameters:
companyId- the primary key of the organization and user's companyparentOrganizationId- the primary key of the organization and user's parent organizationkeywords- the keywords (space separated), which may occur in the organization's name, type, or location fields or user's first name, middle name, last name, screen name, email address, or address fieldsstatus- user's workflow statusparams- the finder parameters (optionallynull).start- the lower bound of the range of organizations and users to returnend- the upper bound of the range of organizations and users to return (not inclusive)- Returns:
- the matching organizations and users
- Throws:
PortalException
-
searchOrganizationsAndUsersCount
public static int searchOrganizationsAndUsersCount(long companyId, long parentOrganizationId, String keywords, int status, LinkedHashMap<String, Object> params) throws PortalExceptionReturns the number of organizations and users that match the keywords specified for them and belong to the parent organization.- Parameters:
companyId- the primary key of the organization and user's companyparentOrganizationId- the primary key of the organization and user's parent organizationkeywords- the keywords (space separated), which may occur in the organization's name, type, or location fields or user's first name, middle name, last name, screen name, email address, or address fieldsstatus- user's workflow statusparams- the finder parameters (optionallynull).- Returns:
- the number of matching organizations and users
- Throws:
PortalException
-
setGroupOrganizations
public static void setGroupOrganizations(long groupId, long[] organizationIds) -
setUserOrganizations
public static void setUserOrganizations(long userId, long[] organizationIds) -
unsetGroupOrganizations
public static void unsetGroupOrganizations(long groupId, long[] organizationIds) Removes the organizations from the group.- Parameters:
groupId- the primary key of the grouporganizationIds- the primary keys of the organizations
-
unsetPasswordPolicyOrganizations
public static void unsetPasswordPolicyOrganizations(long passwordPolicyId, long[] organizationIds) Removes the organizations from the password policy.- Parameters:
passwordPolicyId- the primary key of the password policyorganizationIds- the primary keys of the organizations
-
updateAsset
public static void updateAsset(long userId, Organization organization, long[] assetCategoryIds, String[] assetTagNames) throws PortalException Updates the organization's asset with the new asset categories and tag names, removing and adding asset categories and tag names as necessary.- Parameters:
userId- the primary key of the userorganization- the organizationassetCategoryIds- the primary keys of the asset categoriesassetTagNames- the asset tag names- Throws:
PortalException
-
updateLogo
- Throws:
PortalException
-
updateOrganization
Updates the organization in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.Important: Inspect OrganizationLocalServiceImpl for overloaded versions of the method. If provided, use these entry points to the API, as the implementation logic may require the additional parameters defined there.
- Parameters:
organization- the organization- Returns:
- the organization that was updated
-
updateOrganization
public static Organization updateOrganization(String externalReferenceCode, long companyId, long organizationId, long parentOrganizationId, String name, String type, long regionId, long countryId, long statusListTypeId, String comments, boolean hasLogo, byte[] logoBytes, boolean site, ServiceContext serviceContext) throws PortalException Updates the organization.- Parameters:
companyId- the primary key of the organization's companyorganizationId- the primary key of the organizationparentOrganizationId- the primary key of 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 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
-