public class OrganizationLocalServiceUtil
extends Object
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.OrganizationLocalService
Constructor and Description |
---|
OrganizationLocalServiceUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addGroupOrganization(long groupId,
long organizationId) |
static void |
addGroupOrganization(long groupId,
Organization organization) |
static void |
addGroupOrganizations(long groupId,
List<Organization> organizations) |
static void |
addGroupOrganizations(long groupId,
long[] organizationIds) |
static Organization |
addOrganization(long userId,
long parentOrganizationId,
String name,
boolean site)
Adds an organization.
|
static Organization |
addOrganization(long userId,
long parentOrganizationId,
String name,
String type,
long regionId,
long countryId,
long statusListTypeId,
String comments,
boolean site,
ServiceContext serviceContext)
Adds an organization.
|
static Organization |
addOrganization(Organization organization)
Adds the organization to the database.
|
static void |
addOrganizationResources(long userId,
Organization organization)
Adds a resource for each type of permission available on the
organization.
|
static User |
addOrganizationUserByEmailAddress(String emailAddress,
long organizationId,
ServiceContext serviceContext) |
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) |
static void |
addPasswordPolicyOrganizations(long passwordPolicyId,
long[] organizationIds)
Assigns the password policy to the organizations, removing any other
currently assigned password policies.
|
static void |
addUserOrganization(long userId,
long organizationId) |
static void |
addUserOrganization(long userId,
Organization organization) |
static void |
addUserOrganizationByEmailAddress(String emailAddress,
long organizationId) |
static void |
addUserOrganizations(long userId,
List<Organization> organizations) |
static void |
addUserOrganizations(long userId,
long[] organizationIds) |
static void |
clearGroupOrganizations(long groupId) |
static void |
clearUserOrganizations(long userId) |
static Organization |
createOrganization(long organizationId)
Creates a new organization with the primary key.
|
static PersistedModel |
createPersistedModel(Serializable primaryKeyObj) |
static void |
deleteGroupOrganization(long groupId,
long organizationId) |
static void |
deleteGroupOrganization(long groupId,
Organization organization) |
static void |
deleteGroupOrganizations(long groupId,
List<Organization> organizations) |
static void |
deleteGroupOrganizations(long groupId,
long[] organizationIds) |
static void |
deleteLogo(long organizationId)
Deletes the organization's logo.
|
static Organization |
deleteOrganization(long organizationId)
Deletes the organization with the primary key from the database.
|
static Organization |
deleteOrganization(Organization organization)
Deletes the organization from the database.
|
static PersistedModel |
deletePersistedModel(PersistedModel persistedModel) |
static void |
deleteUserOrganization(long userId,
long organizationId) |
static void |
deleteUserOrganization(long userId,
Organization organization) |
static void |
deleteUserOrganizationByEmailAddress(String emailAddress,
long organizationId) |
static void |
deleteUserOrganizations(long userId,
List<Organization> organizations) |
static void |
deleteUserOrganizations(long userId,
long[] organizationIds) |
static <T> T |
dslQuery(com.liferay.petra.sql.dsl.query.DSLQuery dslQuery) |
static int |
dslQueryCount(com.liferay.petra.sql.dsl.query.DSLQuery dslQuery) |
static DynamicQuery |
dynamicQuery() |
static <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 long |
dynamicQueryCount(DynamicQuery dynamicQuery)
Returns the number of rows matching the dynamic query.
|
static long |
dynamicQueryCount(DynamicQuery dynamicQuery,
Projection projection)
Returns the number of rows matching the dynamic query.
|
static Organization |
fetchOrganization(long organizationId) |
static Organization |
fetchOrganization(long companyId,
String name)
Returns the organization with the name.
|
static Organization |
fetchOrganizationByExternalReferenceCode(String externalReferenceCode,
long companyId) |
static Organization |
fetchOrganizationByUuidAndCompanyId(String uuid,
long companyId)
Returns the organization with the matching UUID and company.
|
static ActionableDynamicQuery |
getActionableDynamicQuery() |
static String[] |
getChildrenTypes(String type) |
static ExportActionableDynamicQuery |
getExportActionableDynamicQuery(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 int |
getGroupOrganizationsCount(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 IndexableActionableDynamicQuery |
getIndexableActionableDynamicQuery() |
static List<Organization> |
getNoAssetOrganizations() |
static Organization |
getOrganization(long organizationId)
Returns the organization with the primary key.
|
static Organization |
getOrganization(long companyId,
String name)
Returns the organization with the name.
|
static Organization |
getOrganizationByExternalReferenceCode(String externalReferenceCode,
long companyId) |
static Organization |
getOrganizationByUuidAndCompanyId(String uuid,
long companyId)
Returns the organization with the matching UUID and company.
|
static long |
getOrganizationId(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) |
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.
|
static int |
getOrganizationsAndUsersCount(long companyId,
long parentOrganizationId,
int status)
Returns the number of organizations and users belonging to the parent
organization.
|
static int |
getOrganizationsCount()
Returns the number of organizations.
|
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 int |
getOrganizationsCount(long companyId,
String name) |
static String |
getOSGiServiceIdentifier()
Returns the OSGi service identifier.
|
static List<Organization> |
getParentOrganizations(long organizationId)
Returns the parent organizations in order by closest ancestor.
|
static PersistedModel |
getPersistedModel(Serializable primaryKeyObj) |
static OrganizationLocalService |
getService() |
static List<Organization> |
getSuborganizations(List<Organization> organizations)
Returns the suborganizations of the organizations.
|
static List<Organization> |
getSuborganizations(long companyId,
long organizationId)
Returns the suborganizations of the organization.
|
static int |
getSuborganizationsCount(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 of
allOrganizations and
availableOrganizations . |
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 int |
getUserOrganizationsCount(long userId) |
static long[] |
getUserPrimaryKeys(long organizationId)
Returns the userIds of the users associated with the organization.
|
static boolean |
hasGroupOrganization(long groupId,
long organizationId) |
static boolean |
hasGroupOrganizations(long groupId) |
static boolean |
hasPasswordPolicyOrganization(long passwordPolicyId,
long organizationId)
Returns
true if the password policy has been assigned to the
organization. |
static boolean |
hasUserOrganization(long userId,
long organizationId) |
static boolean |
hasUserOrganization(long userId,
long organizationId,
boolean inheritSuborganizations,
boolean includeSpecifiedOrganization)
Returns
true if the user is a member of the organization,
optionally focusing on suborganizations or the specified organization. |
static boolean |
hasUserOrganizations(long userId) |
static boolean |
isCountryEnabled(String type) |
static boolean |
isCountryRequired(String type) |
static boolean |
isRootable(String type) |
static void |
rebuildTree(long companyId)
Rebuilds the organization's tree.
|
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.
|
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 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.
|
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.
|
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.
|
static BaseModelSearchResult<Organization> |
searchOrganizations(long companyId,
long parentOrganizationId,
String keywords,
LinkedHashMap<String,Object> params,
int start,
int end,
Sort sort) |
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 Hits |
searchOrganizationsAndUsers(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 int |
searchOrganizationsAndUsersCount(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 void |
setGroupOrganizations(long groupId,
long[] organizationIds) |
static void |
setUserOrganizations(long userId,
long[] organizationIds) |
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 void |
updateAsset(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 Organization |
updateLogo(long organizationId,
byte[] logoBytes) |
static Organization |
updateOrganization(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.
|
static Organization |
updateOrganization(Organization organization)
Updates the organization in the database or adds it if it does not yet exist.
|
public static void addGroupOrganization(long groupId, long organizationId)
public static void addGroupOrganization(long groupId, Organization organization)
public static void addGroupOrganizations(long groupId, List<Organization> organizations)
public static void addGroupOrganizations(long groupId, long[] organizationIds)
public static Organization addOrganization(long userId, long parentOrganizationId, String name, boolean site) throws PortalException
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)
.
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
sitePortalException
public static Organization addOrganization(long userId, long parentOrganizationId, String name, String type, long regionId, long countryId, long statusListTypeId, String comments, boolean site, ServiceContext serviceContext) throws PortalException
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)
.
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 (optionally
null
). Can set asset category IDs, asset tag names,
and expando bridge attributes for the organization.PortalException
public static Organization addOrganization(Organization organization)
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.
organization
- the organizationpublic static void addOrganizationResources(long userId, Organization organization) throws PortalException
userId
- the primary key of the creator/owner of the organizationorganization
- the organizationPortalException
public static User addOrganizationUserByEmailAddress(String emailAddress, long organizationId, ServiceContext serviceContext) throws PortalException
PortalException
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
PortalException
public static void addPasswordPolicyOrganizations(long passwordPolicyId, long[] organizationIds)
passwordPolicyId
- the primary key of the password policyorganizationIds
- the primary keys of the organizationspublic static void addUserOrganization(long userId, long organizationId)
public static void addUserOrganization(long userId, Organization organization)
public static void addUserOrganizationByEmailAddress(String emailAddress, long organizationId) throws PortalException
PortalException
public static void addUserOrganizations(long userId, List<Organization> organizations)
public static void addUserOrganizations(long userId, long[] organizationIds)
public static void clearGroupOrganizations(long groupId)
public static void clearUserOrganizations(long userId)
public static Organization createOrganization(long organizationId)
organizationId
- the primary key for the new organizationpublic static PersistedModel createPersistedModel(Serializable primaryKeyObj) throws PortalException
PortalException
public static void deleteGroupOrganization(long groupId, long organizationId)
public static void deleteGroupOrganization(long groupId, Organization organization)
public static void deleteGroupOrganizations(long groupId, List<Organization> organizations)
public static void deleteGroupOrganizations(long groupId, long[] organizationIds)
public static void deleteLogo(long organizationId) throws PortalException
organizationId
- the primary key of the organizationPortalException
public static Organization deleteOrganization(long organizationId) throws PortalException
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.
organizationId
- the primary key of the organizationPortalException
- if a organization with the primary key could not be foundpublic static Organization deleteOrganization(Organization organization) throws PortalException
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.
organization
- the organizationPortalException
public static PersistedModel deletePersistedModel(PersistedModel persistedModel) throws PortalException
PortalException
public static void deleteUserOrganization(long userId, long organizationId)
public static void deleteUserOrganization(long userId, Organization organization)
public static void deleteUserOrganizationByEmailAddress(String emailAddress, long organizationId) throws PortalException
PortalException
public static void deleteUserOrganizations(long userId, List<Organization> organizations)
public static void deleteUserOrganizations(long userId, long[] organizationIds)
public static <T> T dslQuery(com.liferay.petra.sql.dsl.query.DSLQuery dslQuery)
public static int dslQueryCount(com.liferay.petra.sql.dsl.query.DSLQuery dslQuery)
public static DynamicQuery dynamicQuery()
public static <T> List<T> dynamicQuery(DynamicQuery dynamicQuery)
dynamicQuery
- the dynamic querypublic static <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from com.liferay.portal.model.impl.OrganizationModelImpl
.
dynamicQuery
- the dynamic querystart
- the lower bound of the range of model instancesend
- the upper bound of the range of model instances (not inclusive)public static <T> List<T> dynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator<T> orderByComparator)
Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from com.liferay.portal.model.impl.OrganizationModelImpl
.
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 (optionally null
)public static long dynamicQueryCount(DynamicQuery dynamicQuery)
dynamicQuery
- the dynamic querypublic static long dynamicQueryCount(DynamicQuery dynamicQuery, Projection projection)
dynamicQuery
- the dynamic queryprojection
- the projection to apply to the querypublic static Organization fetchOrganization(long organizationId)
public static Organization fetchOrganization(long companyId, String name)
companyId
- the primary key of the organization's companyname
- the organization's namenull
if no
organization could be foundpublic static Organization fetchOrganizationByExternalReferenceCode(String externalReferenceCode, long companyId)
public static Organization fetchOrganizationByUuidAndCompanyId(String uuid, long companyId)
uuid
- the organization's UUIDcompanyId
- the primary key of the companynull
if a matching organization could not be foundpublic static ActionableDynamicQuery getActionableDynamicQuery()
public static String[] getChildrenTypes(String type)
public static ExportActionableDynamicQuery getExportActionableDynamicQuery(PortletDataContext portletDataContext)
public static List<Organization> getGroupOrganizations(long groupId)
public static List<Organization> getGroupOrganizations(long groupId, int start, int end)
public static List<Organization> getGroupOrganizations(long groupId, int start, int end, OrderByComparator<Organization> orderByComparator)
public static int getGroupOrganizationsCount(long groupId)
public static long[] getGroupPrimaryKeys(long organizationId)
organizationId
- the organizationId of the organizationpublic static List<Organization> getGroupUserOrganizations(long groupId, long userId) throws PortalException
PortalException
public static IndexableActionableDynamicQuery getIndexableActionableDynamicQuery()
public static List<Organization> getNoAssetOrganizations()
public static Organization getOrganization(long organizationId) throws PortalException
organizationId
- the primary key of the organizationPortalException
- if a organization with the primary key could not be foundpublic static Organization getOrganization(long companyId, String name) throws PortalException
companyId
- the primary key of the organization's companyname
- the organization's namePortalException
public static Organization getOrganizationByExternalReferenceCode(String externalReferenceCode, long companyId) throws PortalException
PortalException
public static Organization getOrganizationByUuidAndCompanyId(String uuid, long companyId) throws PortalException
uuid
- the organization's UUIDcompanyId
- the primary key of the companyPortalException
- if a matching organization could not be foundpublic static long getOrganizationId(long companyId, String name)
companyId
- the primary key of the organization's companyname
- the organization's name0
if the organization could not be foundpublic static List<Organization> getOrganizations(int start, int end)
Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from com.liferay.portal.model.impl.OrganizationModelImpl
.
start
- the lower bound of the range of organizationsend
- the upper bound of the range of organizations (not inclusive)public static List<Organization> getOrganizations(long userId, int start, int end, OrderByComparator<Organization> orderByComparator) throws PortalException
PortalException
public static List<Organization> getOrganizations(long companyId, long parentOrganizationId)
companyId
- the primary key of the organization's companyparentOrganizationId
- the primary key of the organization's parent
organizationpublic static List<Organization> getOrganizations(long companyId, long parentOrganizationId, int start, int end)
Useful when paginating results. Returns a maximum of end -
start
instances. start
and end
are not
primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full
result set.
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)OrganizationPersistence.findByC_P(
long, long, int, int)
public static List<Organization> getOrganizations(long companyId, long parentOrganizationId, String name, int start, int end)
public static List<Organization> getOrganizations(long companyId, String treePath)
public static List<Organization> getOrganizations(long companyId, String name, int start, int end, OrderByComparator<Organization> orderByComparator)
public static List<Organization> getOrganizations(long[] organizationIds) throws PortalException
organizationIds
- the primary keys of the organizationsPortalException
public static List<Object> getOrganizationsAndUsers(long companyId, long parentOrganizationId, int status, int start, int end, OrderByComparator<?> orderByComparator)
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 (optionally null
)public static int getOrganizationsAndUsersCount(long companyId, long parentOrganizationId, int status)
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 statuspublic static int getOrganizationsCount()
public static int getOrganizationsCount(long companyId, long parentOrganizationId)
companyId
- the primary key of the organization's companyparentOrganizationId
- the primary key of the organization's parent
organizationpublic static int getOrganizationsCount(long companyId, long parentOrganizationId, String name)
public static int getOrganizationsCount(long companyId, String name)
public static String getOSGiServiceIdentifier()
public static List<Organization> getParentOrganizations(long organizationId) throws PortalException
organizationId
- the primary key of the organizationPortalException
public static PersistedModel getPersistedModel(Serializable primaryKeyObj) throws PortalException
PortalException
public static List<Organization> getSuborganizations(List<Organization> organizations)
organizations
- the organizations from which to get
suborganizationspublic static List<Organization> getSuborganizations(long companyId, long organizationId)
companyId
- the primary key of the organization's companyorganizationId
- the primary key of the organizationpublic static int getSuborganizationsCount(long companyId, long organizationId)
companyId
- the primary key of the organization's companyorganizationId
- the primary key of the organizationpublic static List<Organization> getSubsetOrganizations(List<Organization> allOrganizations, List<Organization> availableOrganizations)
allOrganizations
and
availableOrganizations
.allOrganizations
- the organizations to check for availabilityavailableOrganizations
- the available organizationsallOrganizations
and
availableOrganizations
public static String[] getTypes()
public static long[] getUserOrganizationIds(long userId, boolean includeAdministrative) throws PortalException
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.
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 organizationsPortalException
public static List<Organization> getUserOrganizations(long userId)
public static List<Organization> getUserOrganizations(long userId, boolean includeAdministrative) throws PortalException
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.
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 organizationsPortalException
public static List<Organization> getUserOrganizations(long userId, int start, int end)
public static List<Organization> getUserOrganizations(long userId, int start, int end, OrderByComparator<Organization> orderByComparator)
public static int getUserOrganizationsCount(long userId)
public static long[] getUserPrimaryKeys(long organizationId)
organizationId
- the organizationId of the organizationpublic static boolean hasGroupOrganization(long groupId, long organizationId)
public static boolean hasGroupOrganizations(long groupId)
public static boolean hasPasswordPolicyOrganization(long passwordPolicyId, long organizationId)
true
if the password policy has been assigned to the
organization.passwordPolicyId
- the primary key of the password policyorganizationId
- the primary key of the organizationtrue
if the password policy has been assigned to the
organization; false
otherwisepublic static boolean hasUserOrganization(long userId, long organizationId)
public static boolean hasUserOrganization(long userId, long organizationId, boolean inheritSuborganizations, boolean includeSpecifiedOrganization) throws PortalException
true
if 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.
inheritSuborganizations=false
:
the method checks whether the user belongs to the organization specified
by organizationId
. The parameter
includeSpecifiedOrganization
is ignored.
includeSpecifiedOrganization
is
ignored unless inheritSuborganizations
is also
true
.
inheritSuborganizations=true
and
includeSpecifiedOrganization=false
: the method
checks
whether the user belongs to one of the child organizations of the one
specified by organizationId
.
inheritSuborganizations=true
and
includeSpecifiedOrganization=true
: the method
checks whether
the user belongs to the organization specified by
organizationId
or any of
its child organizations.
userId
- the primary key of the organization's userorganizationId
- the primary key of the organizationinheritSuborganizations
- if true
suborganizations are
considered in the determinationincludeSpecifiedOrganization
- if true
the
organization specified by organizationId
is
considered in the determinationtrue
if the user has access to the organization;
false
otherwisePortalException
OrganizationFinder
public static boolean hasUserOrganizations(long userId)
public static boolean isCountryEnabled(String type)
public static boolean isCountryRequired(String type)
public static boolean isRootable(String type)
public static void rebuildTree(long companyId) throws PortalException
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.
companyId
- the primary key of the organization's companyPortalException
public static Hits search(long companyId, long parentOrganizationId, String keywords, LinkedHashMap<String,Object> params, int start, int end, Sort sort)
Useful when paginating results. Returns a maximum of end -
start
instances. start
and end
are not
primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full
result set.
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 (optionally null
)params
- the finder parameters (optionally null
).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 (optionally
null
)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)
search(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 -
start
instances. start
and end
are not
primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full
result set.
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 (optionally
null
)type
- the organization's type (optionally null
)regionId
- the primary key of the organization's region (optionally
null
)countryId
- the primary key of the organization's country
(optionally null
)params
- the finder params. For more information see OrganizationFinder
start
- the lower bound of the range of organizations to returnend
- the upper bound of the range of organizations to return (not
inclusive)OrganizationFinder
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)
search(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 -
start
instances. start
and end
are not
primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full
result set.
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 (optionally
null
)type
- the organization's type (optionally null
)regionId
- the primary key of the organization's region (optionally
null
)countryId
- the primary key of the organization's country
(optionally null
)params
- the finder params. For more information see OrganizationFinder
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
(optionally null
)orderByComparator
OrganizationFinder
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)
search(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 -
start
instances. start
and end
are not
primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full
result set.
companyId
- the primary key of the organization's companyparentOrganizationId
- the primary key of the organization's parentname
- the name keywords (space separated, optionally
null
)type
- the organization's type (optionally null
)street
- the street keywords (optionally null
)city
- the city keywords (optionally null
)zip
- the zipcode keywords (optionally null
)regionId
- the primary key of the organization's region (optionally
null
)countryId
- the primary key of the organization's country
(optionally null
)params
- the finder parameters (optionally null
). For
more information see OrganizationFinder
andOperator
- 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)OrganizationFinder
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)
search(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 -
start
instances. start
and end
are not
primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full
result set.
companyId
- the primary key of the organization's companyparentOrganizationId
- the primary key of the organization's parent
organizationname
- the name keywords (space separated, optionally
null
)type
- the organization's type (optionally null
)street
- the street keywords (optionally null
)city
- the city keywords (optionally null
)zip
- the zipcode keywords (optionally null
)regionId
- the primary key of the organization's region (optionally
null
)countryId
- the primary key of the organization's country
(optionally null
)params
- the finder parameters (optionally null
). For
more information see OrganizationFinder
andOperator
- 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
(optionally null
)orderByComparator
OrganizationFinder
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)
Useful when paginating results. Returns a maximum of end -
start
instances. start
and end
are not
primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full
result set.
companyId
- the primary key of the organization's companyparentOrganizationId
- the primary key of the organization's parent
organizationname
- the name keywords (space separated, optionally
null
)type
- the type keywords (optionally null
)street
- the street keywords (optionally null
)city
- the city keywords (optionally null
)zip
- the zipcode keywords (optionally null
)region
- the region keywords (optionally null
)country
- the country keywords (optionally null
)params
- the finder parameters (optionally null
).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 (optionally
null
)sort
public static int searchCount(long companyId, long parentOrganizationId, String keywords, String type, Long regionId, Long countryId, LinkedHashMap<String,Object> params)
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 (optionally
null
)type
- the organization's type (optionally null
)regionId
- the primary key of the organization's region (optionally
null
)countryId
- the primary key of the organization's country
(optionally null
)params
- the finder parameters (optionally null
). For
more information see OrganizationFinder
OrganizationFinder
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)
companyId
- the primary key of the organization's companyparentOrganizationId
- the primary key of the organization's parent
organizationname
- the name keywords (space separated, optionally
null
)type
- the organization's type (optionally null
)street
- the street keywords (optionally null
)city
- the city keywords (optionally null
)zip
- the zipcode keywords (optionally null
)regionId
- the primary key of the organization's region (optionally
null
)countryId
- the primary key of the organization's country
(optionally null
)params
- the finder parameters (optionally null
). For
more information see OrganizationFinder
andOperator
- 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'".OrganizationFinder
public static BaseModelSearchResult<Organization> searchOrganizations(long companyId, long parentOrganizationId, String keywords, LinkedHashMap<String,Object> params, int start, int end, Sort sort) throws PortalException
PortalException
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
PortalException
public static Hits searchOrganizationsAndUsers(long companyId, long parentOrganizationId, String keywords, int status, LinkedHashMap<String,Object> params, int start, int end, Sort[] sorts) throws PortalException
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 (optionally null
).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)PortalException
public static int searchOrganizationsAndUsersCount(long companyId, long parentOrganizationId, String keywords, int status, LinkedHashMap<String,Object> params) throws PortalException
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 (optionally null
).PortalException
public static void setGroupOrganizations(long groupId, long[] organizationIds)
public static void setUserOrganizations(long userId, long[] organizationIds)
public static void unsetGroupOrganizations(long groupId, long[] organizationIds)
groupId
- the primary key of the grouporganizationIds
- the primary keys of the organizationspublic static void unsetPasswordPolicyOrganizations(long passwordPolicyId, long[] organizationIds)
passwordPolicyId
- the primary key of the password policyorganizationIds
- the primary keys of the organizationspublic static void updateAsset(long userId, Organization organization, long[] assetCategoryIds, String[] assetTagNames) throws PortalException
userId
- the primary key of the userorganization
- the organizationassetCategoryIds
- the primary keys of the asset categoriesassetTagNames
- the asset tag namesPortalException
public static Organization updateLogo(long organizationId, byte[] logoBytes) throws PortalException
PortalException
public static Organization updateOrganization(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
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 (optionally
null
). Can set asset category IDs and asset tag
names for the organization, and merge expando bridge attributes
for the organization.PortalException
public static Organization updateOrganization(Organization organization)
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.
organization
- the organizationpublic static OrganizationLocalService getService()