Liferay 7.0-ce-b4

com.liferay.portal.service.impl
Class OrganizationLocalServiceImpl

java.lang.Object
  extended by com.liferay.portal.service.BaseLocalServiceImpl
      extended by com.liferay.portal.service.base.OrganizationLocalServiceBaseImpl
          extended by com.liferay.portal.service.impl.OrganizationLocalServiceImpl
All Implemented Interfaces:
IdentifiableOSGiService, BaseLocalService, OrganizationLocalService, PersistedModelLocalService

public class OrganizationLocalServiceImpl
extends OrganizationLocalServiceBaseImpl

Provides the local service for accessing, adding, deleting, and updating organizations.


Field Summary
 
Fields inherited from class com.liferay.portal.service.base.OrganizationLocalServiceBaseImpl
addressLocalService, addressPersistence, assetCategoryFinder, assetCategoryLocalService, assetCategoryPersistence, assetEntryFinder, assetEntryLocalService, assetEntryPersistence, assetTagFinder, assetTagLocalService, assetTagPersistence, companyLocalService, companyPersistence, counterLocalService, countryPersistence, emailAddressLocalService, emailAddressPersistence, expandoRowLocalService, expandoRowPersistence, groupFinder, groupLocalService, groupPersistence, listTypeLocalService, listTypePersistence, organizationFinder, organizationLocalService, organizationPersistence, passwordPolicyFinder, passwordPolicyLocalService, passwordPolicyPersistence, passwordPolicyRelLocalService, passwordPolicyRelPersistence, persistedModelLocalServiceRegistry, phoneLocalService, phonePersistence, regionPersistence, resourceLocalService, roleFinder, roleLocalService, rolePersistence, userFinder, userGroupRoleFinder, userGroupRoleLocalService, userGroupRolePersistence, userLocalService, userPersistence, websiteLocalService, websitePersistence
 
Constructor Summary
OrganizationLocalServiceImpl()
           
 
Method Summary
 void addGroupOrganizations(long groupId, long[] organizationIds)
          Adds the organizations to the group.
 Organization addOrganization(long userId, long parentOrganizationId, String name, boolean site)
          Adds an organization.
 Organization addOrganization(long userId, long parentOrganizationId, String name, String type, boolean recursable, long regionId, long countryId, long statusId, String comments, boolean site, ServiceContext serviceContext)
          Deprecated. As of 6.2.0, replaced by #addOrganization(long, long, String, String, long, long, int, String, boolean, ServiceContext)
 Organization addOrganization(long userId, long parentOrganizationId, String name, String type, long regionId, long countryId, long statusId, String comments, boolean site, ServiceContext serviceContext)
          Adds an organization.
 void addOrganizationResources(long userId, Organization organization)
          Adds a resource for each type of permission available on the organization.
 void addPasswordPolicyOrganizations(long passwordPolicyId, long[] organizationIds)
          Assigns the password policy to the organizations, removing any other currently assigned password policies.
protected  void addSuborganizations(List<Organization> allSuborganizations, List<Organization> organizations)
           
protected  SearchContext buildSearchContext(long companyId, long parentOrganizationId, String name, String type, String street, String city, String zip, Long regionId, Long countryId, LinkedHashMap<String,Object> params, boolean andSearch, int start, int end, Sort sort)
           
protected  SearchContext buildSearchContext(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)
           
 void deleteLogo(long organizationId)
          Deletes the organization's logo.
 Organization deleteOrganization(long organizationId)
          Deletes the organization.
 Organization deleteOrganization(Organization organization)
          Deletes the organization.
 Organization fetchOrganization(long companyId, String name)
          Returns the organization with the name.
 List<Organization> getGroupUserOrganizations(long groupId, long userId)
           
 List<Organization> getNoAssetOrganizations()
           
 Organization getOrganization(long companyId, String name)
          Returns the organization with the name.
 long getOrganizationId(long companyId, String name)
          Returns the primary key of the organization with the name.
 List<Organization> getOrganizations(long[] organizationIds)
          Returns the organizations with the primary keys.
 List<Organization> getOrganizations(long userId, int start, int end, OrderByComparator<Organization> obc)
           
 List<Organization> getOrganizations(long companyId, long parentOrganizationId)
          Returns all the organizations belonging to the parent organization.
 List<Organization> getOrganizations(long companyId, long parentOrganizationId, int start, int end)
          Returns a range of all the organizations belonging to the parent organization.
 int getOrganizationsCount(long companyId, long parentOrganizationId)
          Returns the number of organizations belonging to the parent organization.
protected  long getParentOrganizationId(long companyId, long parentOrganizationId)
           
 List<Organization> getParentOrganizations(long organizationId)
          Returns the parent organizations in order by closest ancestor.
protected  long[] getReindexOrganizationIds(Organization organization)
           
 List<Organization> getSuborganizations(List<Organization> organizations)
          Returns the suborganizations of the organizations.
 List<Organization> getSuborganizations(long companyId, long organizationId)
          Returns the suborganizations of the organization.
 int getSuborganizationsCount(long companyId, long organizationId)
          Returns the count of suborganizations of the organization.
 List<Organization> getSubsetOrganizations(List<Organization> allOrganizations, List<Organization> availableOrganizations)
          Returns the intersection of allOrganizations and availableOrganizations.
 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.
 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.
 boolean hasPasswordPolicyOrganization(long passwordPolicyId, long organizationId)
          Returns true if the password policy has been assigned to the organization.
 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.
protected  boolean isOrganizationGroup(long organizationId, long groupId)
           
protected  boolean isParentOrganization(long parentOrganizationId, long organizationId)
           
protected  boolean isUseCustomSQL(LinkedHashMap<String,Object> params)
           
 void rebuildTree(long companyId)
          Rebuilds the organization's tree.
 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.
 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.
 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> obc)
          Returns an ordered range of all the organizations that match the keywords, type, region, and country, without using the indexer.
 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.
 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> obc)
          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.
 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.
 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.
 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.
 BaseModelSearchResult<Organization> searchOrganizations(long companyId, long parentOrganizationId, String keywords, LinkedHashMap<String,Object> params, int start, int end, Sort sort)
           
 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)
           
 void setGroupOrganizations(long groupId, long[] organizationIds)
          Sets the organizations in the group, removing and adding organizations to the group as necessary.
 void unsetGroupOrganizations(long groupId, long[] organizationIds)
          Removes the organizations from the group.
 void unsetPasswordPolicyOrganizations(long passwordPolicyId, long[] organizationIds)
          Removes the organizations from the password policy.
 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.
 Organization updateOrganization(long companyId, long organizationId, long parentOrganizationId, String name, String type, boolean recursable, long regionId, long countryId, long statusId, String comments, boolean site, ServiceContext serviceContext)
          Deprecated. As of 6.2.0, replaced by #updateOrganization(long, long, long, String, String, long, long, int, String, boolean, byte[], boolean, ServiceContext)
 Organization updateOrganization(long companyId, long organizationId, long parentOrganizationId, String name, String type, long regionId, long countryId, long statusId, String comments, boolean logo, byte[] logoBytes, boolean site, ServiceContext serviceContext)
          Updates the organization.
 Organization updateOrganization(long companyId, long organizationId, long parentOrganizationId, String name, String type, long regionId, long countryId, long statusId, String comments, boolean site, ServiceContext serviceContext)
          Deprecated. As of 7.0.0, replaced by #updateOrganization(long, long, long, String, String, long, long, int, String, boolean, byte[], boolean, ServiceContext)
protected  void validate(long companyId, long organizationId, long parentOrganizationId, String name, String type, long countryId, long statusId)
           
protected  void validate(long companyId, long parentOrganizationId, String name, String type, long countryId, long statusId)
           
 
Methods inherited from class com.liferay.portal.service.base.OrganizationLocalServiceBaseImpl
addGroupOrganization, addGroupOrganization, addGroupOrganizations, addOrganization, addUserOrganization, addUserOrganization, addUserOrganizations, addUserOrganizations, afterPropertiesSet, clearGroupOrganizations, clearUserOrganizations, createOrganization, deleteGroupOrganization, deleteGroupOrganization, deleteGroupOrganizations, deleteGroupOrganizations, deletePersistedModel, deleteUserOrganization, deleteUserOrganization, deleteUserOrganizations, deleteUserOrganizations, destroy, dynamicQuery, dynamicQuery, dynamicQuery, dynamicQuery, dynamicQueryCount, dynamicQueryCount, fetchOrganization, fetchOrganizationByUuidAndCompanyId, getActionableDynamicQuery, getAddressLocalService, getAddressPersistence, getAssetCategoryFinder, getAssetCategoryLocalService, getAssetCategoryPersistence, getAssetEntryFinder, getAssetEntryLocalService, getAssetEntryPersistence, getAssetTagFinder, getAssetTagLocalService, getAssetTagPersistence, getCompanyLocalService, getCompanyPersistence, getCounterLocalService, getCountryPersistence, getEmailAddressLocalService, getEmailAddressPersistence, getExpandoRowLocalService, getExpandoRowPersistence, getExportActionableDynamicQuery, getGroupFinder, getGroupLocalService, getGroupOrganizations, getGroupOrganizations, getGroupOrganizations, getGroupOrganizationsCount, getGroupPersistence, getGroupPrimaryKeys, getIndexableActionableDynamicQuery, getListTypeLocalService, getListTypePersistence, getModelClass, getModelClassName, getOrganization, getOrganizationByUuidAndCompanyId, getOrganizationFinder, getOrganizationLocalService, getOrganizationPersistence, getOrganizations, getOrganizationsCount, getOSGiServiceIdentifier, getPasswordPolicyFinder, getPasswordPolicyLocalService, getPasswordPolicyPersistence, getPasswordPolicyRelLocalService, getPasswordPolicyRelPersistence, getPersistedModel, getPhoneLocalService, getPhonePersistence, getRegionPersistence, getResourceLocalService, getRoleFinder, getRoleLocalService, getRolePersistence, getUserFinder, getUserGroupRoleFinder, getUserGroupRoleLocalService, getUserGroupRolePersistence, getUserLocalService, getUserOrganizations, getUserOrganizations, getUserOrganizations, getUserOrganizationsCount, getUserPersistence, getUserPrimaryKeys, getWebsiteLocalService, getWebsitePersistence, hasGroupOrganization, hasGroupOrganizations, hasUserOrganization, hasUserOrganizations, initActionableDynamicQuery, runSQL, setAddressLocalService, setAddressPersistence, setAssetCategoryFinder, setAssetCategoryLocalService, setAssetCategoryPersistence, setAssetEntryFinder, setAssetEntryLocalService, setAssetEntryPersistence, setAssetTagFinder, setAssetTagLocalService, setAssetTagPersistence, setCompanyLocalService, setCompanyPersistence, setCounterLocalService, setCountryPersistence, setEmailAddressLocalService, setEmailAddressPersistence, setExpandoRowLocalService, setExpandoRowPersistence, setGroupFinder, setGroupLocalService, setGroupPersistence, setListTypeLocalService, setListTypePersistence, setOrganizationFinder, setOrganizationLocalService, setOrganizationPersistence, setPasswordPolicyFinder, setPasswordPolicyLocalService, setPasswordPolicyPersistence, setPasswordPolicyRelLocalService, setPasswordPolicyRelPersistence, setPhoneLocalService, setPhonePersistence, setRegionPersistence, setResourceLocalService, setRoleFinder, setRoleLocalService, setRolePersistence, setUserFinder, setUserGroupRoleFinder, setUserGroupRoleLocalService, setUserGroupRolePersistence, setUserLocalService, setUserOrganizations, setUserPersistence, setWebsiteLocalService, setWebsitePersistence, updateOrganization
 
Methods inherited from class com.liferay.portal.service.BaseLocalServiceImpl
getClassLoader, getLocalizationMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OrganizationLocalServiceImpl

public OrganizationLocalServiceImpl()
Method Detail

addGroupOrganizations

public void addGroupOrganizations(long groupId,
                                  long[] organizationIds)
Adds the organizations to the group.

Specified by:
addGroupOrganizations in interface OrganizationLocalService
Overrides:
addGroupOrganizations in class OrganizationLocalServiceBaseImpl
Parameters:
groupId - the primary key of the group
organizationIds - the primary keys of the organizations

addOrganization

public 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 organization
parentOrganizationId - the primary key of the organization's parent organization
name - the organization's name
site - whether the organization is to be associated with a main site
Returns:
the organization
Throws:
PortalException

addOrganization

@Deprecated
public Organization addOrganization(long userId,
                                               long parentOrganizationId,
                                               String name,
                                               String type,
                                               boolean recursable,
                                               long regionId,
                                               long countryId,
                                               long statusId,
                                               String comments,
                                               boolean site,
                                               ServiceContext serviceContext)
                             throws PortalException
Deprecated. As of 6.2.0, replaced by #addOrganization(long, long, String, String, long, long, int, String, boolean, ServiceContext)

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 organization
parentOrganizationId - the primary key of the organization's parent organization
name - the organization's name
type - the organization's type
recursable - whether the permissions of the organization are to be inherited by its suborganizations
regionId - the primary key of the organization's region
countryId - the primary key of the organization's country
statusId - the organization's workflow status
comments - the comments about the organization
site - whether the organization is to be associated with a main site
serviceContext - the service context to be applied (optionally null). Can set asset category IDs, asset tag names, and expando bridge attributes for the organization.
Returns:
the organization
Throws:
PortalException

addOrganization

public Organization addOrganization(long userId,
                                    long parentOrganizationId,
                                    String name,
                                    String type,
                                    long regionId,
                                    long countryId,
                                    long statusId,
                                    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 organization
parentOrganizationId - the primary key of the organization's parent organization
name - the organization's name
type - the organization's type
regionId - the primary key of the organization's region
countryId - the primary key of the organization's country
statusId - the organization's workflow status
comments - the comments about the organization
site - whether the organization is to be associated with a main site
serviceContext - the service context to be applied (optionally null). Can set asset category IDs, asset tag names, and expando bridge attributes for the organization.
Returns:
the organization
Throws:
PortalException

addOrganizationResources

public 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 organization
organization - the organization
Throws:
PortalException

addPasswordPolicyOrganizations

public 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 policy
organizationIds - the primary keys of the organizations

deleteLogo

public void deleteLogo(long organizationId)
                throws PortalException
Deletes the organization's logo.

Parameters:
organizationId - the primary key of the organization
Throws:
PortalException

deleteOrganization

public Organization deleteOrganization(long organizationId)
                                throws PortalException
Deletes the organization. The organization's associated resources and assets are also deleted.

Specified by:
deleteOrganization in interface OrganizationLocalService
Overrides:
deleteOrganization in class OrganizationLocalServiceBaseImpl
Parameters:
organizationId - the primary key of the organization
Returns:
the deleted organization
Throws:
PortalException - if a organization with the primary key could not be found

deleteOrganization

@SystemEvent(type=1)
public Organization deleteOrganization(Organization organization)
                                throws PortalException
Deletes the organization. The organization's associated resources and assets are also deleted.

Specified by:
deleteOrganization in interface OrganizationLocalService
Overrides:
deleteOrganization in class OrganizationLocalServiceBaseImpl
Parameters:
organization - the organization
Returns:
the deleted organization
Throws:
PortalException

fetchOrganization

public Organization fetchOrganization(long companyId,
                                      String name)
Returns the organization with the name.

Parameters:
companyId - the primary key of the organization's company
name - the organization's name
Returns:
the organization with the name, or null if no organization could be found

getGroupUserOrganizations

public List<Organization> getGroupUserOrganizations(long groupId,
                                                    long userId)
                                             throws PortalException
Throws:
PortalException

getNoAssetOrganizations

public List<Organization> getNoAssetOrganizations()

getOrganization

public Organization getOrganization(long companyId,
                                    String name)
                             throws PortalException
Returns the organization with the name.

Parameters:
companyId - the primary key of the organization's company
name - the organization's name
Returns:
the organization with the name
Throws:
PortalException

getOrganizationId

public long getOrganizationId(long companyId,
                              String name)
Returns the primary key of the organization with the name.

Parameters:
companyId - the primary key of the organization's company
name - the organization's name
Returns:
the primary key of the organization with the name, or 0 if the organization could not be found

getOrganizations

public List<Organization> getOrganizations(long userId,
                                           int start,
                                           int end,
                                           OrderByComparator<Organization> obc)
                                    throws PortalException
Throws:
PortalException

getOrganizations

public List<Organization> getOrganizations(long companyId,
                                           long parentOrganizationId)
Returns all the organizations belonging to the parent organization.

Parameters:
companyId - the primary key of the organization's company
parentOrganizationId - the primary key of the organization's parent organization
Returns:
the organizations belonging to the parent organization

getOrganizations

public List<Organization> getOrganizations(long companyId,
                                           long parentOrganizationId,
                                           int start,
                                           int end)
Returns a range of all the organizations belonging to the parent organization.

Useful when paginating results. Returns a maximum of end - start instances. start 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.

Parameters:
companyId - the primary key of the organization's company
parentOrganizationId - the primary key of the organization's parent organization
start - the lower bound of the range of organizations to return
end - the upper bound of the range of organizations to return (not inclusive)
Returns:
the range of organizations belonging to the parent organization
See Also:
OrganizationPersistence.findByC_P( long, long, int, int)

getOrganizations

public List<Organization> getOrganizations(long[] organizationIds)
                                    throws PortalException
Returns the organizations with the primary keys.

Parameters:
organizationIds - the primary keys of the organizations
Returns:
the organizations with the primary keys
Throws:
PortalException

getOrganizationsCount

public 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 company
parentOrganizationId - the primary key of the organization's parent organization
Returns:
the number of organizations belonging to the parent organization

getParentOrganizations

public List<Organization> getParentOrganizations(long organizationId)
                                          throws PortalException
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

getSuborganizations

public List<Organization> getSuborganizations(List<Organization> organizations)
Returns the suborganizations of the organizations.

Parameters:
organizations - the organizations from which to get suborganizations
Returns:
the suborganizations of the organizations

getSuborganizations

public List<Organization> getSuborganizations(long companyId,
                                              long organizationId)
Returns the suborganizations of the organization.

Parameters:
companyId - the primary key of the organization's company
organizationId - the primary key of the organization
Returns:
the suborganizations of the organization

getSuborganizationsCount

public int getSuborganizationsCount(long companyId,
                                    long organizationId)
Returns the count of suborganizations of the organization.

Parameters:
companyId - the primary key of the organization's company
organizationId - the primary key of the organization
Returns:
the count of suborganizations of the organization

getSubsetOrganizations

public List<Organization> getSubsetOrganizations(List<Organization> allOrganizations,
                                                 List<Organization> availableOrganizations)
Returns the intersection of allOrganizations and availableOrganizations.

Parameters:
allOrganizations - the organizations to check for availability
availableOrganizations - the available organizations
Returns:
the intersection of allOrganizations and availableOrganizations

getUserOrganizationIds

public 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 user
includeAdministrative - 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

public 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 user
includeAdministrative - 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

hasPasswordPolicyOrganization

public boolean hasPasswordPolicyOrganization(long passwordPolicyId,
                                             long organizationId)
Returns true if the password policy has been assigned to the organization.

Parameters:
passwordPolicyId - the primary key of the password policy
organizationId - the primary key of the organization
Returns:
true if the password policy has been assigned to the organization; false otherwise

hasUserOrganization

public boolean hasUserOrganization(long userId,
                                   long organizationId,
                                   boolean inheritSuborganizations,
                                   boolean includeSpecifiedOrganization)
                            throws PortalException
Returns 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.
  1. If inheritSuborganizations=false: the method checks whether the user belongs to the organization specified by organizationId. The parameter includeSpecifiedOrganization is ignored.
  2. The parameter includeSpecifiedOrganization is ignored unless inheritSuborganizations is also true.
  3. If inheritSuborganizations=true and includeSpecifiedOrganization=false: the method checks whether the user belongs to one of the child organizations of the one specified by organizationId.
  4. If inheritSuborganizations=true and includeSpecifiedOrganization=true: the method checks whether the user belongs to the organization specified by organizationId or any of its child organizations.

Parameters:
userId - the primary key of the organization's user
organizationId - the primary key of the organization
inheritSuborganizations - if true suborganizations are considered in the determination
includeSpecifiedOrganization - if true the organization specified by organizationId is considered in the determination
Returns:
true if the user has access to the organization; false otherwise
Throws:
PortalException
See Also:
OrganizationFinder

rebuildTree

public void rebuildTree(long companyId)
                 throws PortalException
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 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 - 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.

Parameters:
companyId - the primary key of the organization's company
parentOrganizationId - the primary key of the organization's parent organization
keywords - 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). For more information see OrganizationIndexer
start - the lower bound of the range of organizations to return
end - the upper bound of the range of organizations to return (not inclusive)
sort - the field and direction by which to sort (optionally null)
Returns:
the matching organizations ordered by name
See Also:
OrganizationIndexer

search

public 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 version 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.

Parameters:
companyId - the primary key of the organization's company
parentOrganizationId - the primary key of the organization's parent organization
keywords - 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 return
end - the upper bound of the range of organizations to return (not inclusive)
Returns:
the matching organizations ordered by name
See Also:
OrganizationFinder

search

public 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> obc)
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 version 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.

Parameters:
companyId - the primary key of the organization's company
parentOrganizationId - the primary key of the organization's parent organization
keywords - 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 return
end - the upper bound of the range of organizations to return (not inclusive)
obc - the comparator to order the organizations (optionally null)
Returns:
the matching organizations ordered by comparator obc
See Also:
OrganizationFinder

search

public 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 version 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.

Parameters:
companyId - the primary key of the organization's company
parentOrganizationId - the primary key of the organization's parent
name - 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 return
end - the upper bound of the range of organizations to return (not inclusive)
Returns:
the matching organizations ordered by name
See Also:
OrganizationFinder

search

public 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> obc)
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 version 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.

Parameters:
companyId - the primary key of the organization's company
parentOrganizationId - the primary key of the organization's parent organization
name - 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 return
end - the upper bound of the range of organizations to return (not inclusive)
obc - the comparator to order the organizations (optionally null)
Returns:
the matching organizations ordered by comparator obc
See Also:
OrganizationFinder

search

public 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 - 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.

Parameters:
companyId - the primary key of the organization's company
parentOrganizationId - the primary key of the organization's parent organization
name - 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). For more information see OrganizationIndexer.
andSearch - whether every field must match its keywords or just one field
start - the lower bound of the range of organizations to return
end - the upper bound of the range of organizations to return (not inclusive)
sort - the field and direction by which to sort (optionally null)
Returns:
the matching organizations ordered by sort
See Also:
OrganizationIndexer

searchCount

public 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 company
parentOrganizationId - the primary key of the organization's parent organization
keywords - 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
Returns:
the number of matching organizations
See Also:
OrganizationFinder

searchCount

public 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 company
parentOrganizationId - the primary key of the organization's parent organization
name - 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'".
Returns:
the number of matching organizations
See Also:
OrganizationFinder

searchOrganizations

public 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 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

setGroupOrganizations

public void setGroupOrganizations(long groupId,
                                  long[] organizationIds)
Sets the organizations in the group, removing and adding organizations to the group as necessary.

Specified by:
setGroupOrganizations in interface OrganizationLocalService
Overrides:
setGroupOrganizations in class OrganizationLocalServiceBaseImpl
Parameters:
groupId - the primary key of the group
organizationIds - the primary keys of the organizations

unsetGroupOrganizations

public void unsetGroupOrganizations(long groupId,
                                    long[] organizationIds)
Removes the organizations from the group.

Parameters:
groupId - the primary key of the group
organizationIds - the primary keys of the organizations

unsetPasswordPolicyOrganizations

public void unsetPasswordPolicyOrganizations(long passwordPolicyId,
                                             long[] organizationIds)
Removes the organizations from the password policy.

Parameters:
passwordPolicyId - the primary key of the password policy
organizationIds - the primary keys of the organizations

updateAsset

public 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 user
organization - the organization
assetCategoryIds - the primary keys of the asset categories
assetTagNames - the asset tag names
Throws:
PortalException

updateOrganization

@Deprecated
public Organization updateOrganization(long companyId,
                                                  long organizationId,
                                                  long parentOrganizationId,
                                                  String name,
                                                  String type,
                                                  boolean recursable,
                                                  long regionId,
                                                  long countryId,
                                                  long statusId,
                                                  String comments,
                                                  boolean site,
                                                  ServiceContext serviceContext)
                                throws PortalException
Deprecated. As of 6.2.0, replaced by #updateOrganization(long, long, long, String, String, long, long, int, String, boolean, byte[], boolean, ServiceContext)

Updates the organization.

Parameters:
companyId - the primary key of the organization's company
organizationId - the primary key of the organization
parentOrganizationId - the primary key of organization's parent organization
name - the organization's name
type - the organization's type
recursable - whether permissions of the organization are to be inherited by its suborganizations
regionId - the primary key of the organization's region
countryId - the primary key of the organization's country
statusId - the organization's workflow status
comments - the comments about the organization
site - whether the organization is to be associated with a main site
serviceContext - 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.
Returns:
the organization
Throws:
PortalException

updateOrganization

public Organization updateOrganization(long companyId,
                                       long organizationId,
                                       long parentOrganizationId,
                                       String name,
                                       String type,
                                       long regionId,
                                       long countryId,
                                       long statusId,
                                       String comments,
                                       boolean logo,
                                       byte[] logoBytes,
                                       boolean site,
                                       ServiceContext serviceContext)
                                throws PortalException
Updates the organization.

Parameters:
companyId - the primary key of the organization's company
organizationId - the primary key of the organization
parentOrganizationId - the primary key of organization's parent organization
name - the organization's name
type - the organization's type
regionId - the primary key of the organization's region
countryId - the primary key of the organization's country
statusId - the organization's workflow status
comments - the comments about the organization
logo - whether to update the ogranization's logo
logoBytes - the new logo image data
site - whether the organization is to be associated with a main site
serviceContext - 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.
Returns:
the organization
Throws:
PortalException

updateOrganization

@Deprecated
public Organization updateOrganization(long companyId,
                                                  long organizationId,
                                                  long parentOrganizationId,
                                                  String name,
                                                  String type,
                                                  long regionId,
                                                  long countryId,
                                                  long statusId,
                                                  String comments,
                                                  boolean site,
                                                  ServiceContext serviceContext)
                                throws PortalException
Deprecated. As of 7.0.0, replaced by #updateOrganization(long, long, long, String, String, long, long, int, String, boolean, byte[], boolean, ServiceContext)

Updates the organization.

Parameters:
companyId - the primary key of the organization's company
organizationId - the primary key of the organization
parentOrganizationId - the primary key of organization's parent organization
name - the organization's name
type - the organization's type
regionId - the primary key of the organization's region
countryId - the primary key of the organization's country
statusId - the organization's workflow status
comments - the comments about the organization
site - whether the organization is to be associated with a main site
serviceContext - 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.
Returns:
the organization
Throws:
PortalException

addSuborganizations

protected void addSuborganizations(List<Organization> allSuborganizations,
                                   List<Organization> organizations)

buildSearchContext

protected SearchContext buildSearchContext(long companyId,
                                           long parentOrganizationId,
                                           String name,
                                           String type,
                                           String street,
                                           String city,
                                           String zip,
                                           Long regionId,
                                           Long countryId,
                                           LinkedHashMap<String,Object> params,
                                           boolean andSearch,
                                           int start,
                                           int end,
                                           Sort sort)

buildSearchContext

protected SearchContext buildSearchContext(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)

getParentOrganizationId

protected long getParentOrganizationId(long companyId,
                                       long parentOrganizationId)

getReindexOrganizationIds

protected long[] getReindexOrganizationIds(Organization organization)
                                    throws PortalException
Throws:
PortalException

isOrganizationGroup

protected boolean isOrganizationGroup(long organizationId,
                                      long groupId)

isParentOrganization

protected boolean isParentOrganization(long parentOrganizationId,
                                       long organizationId)
                                throws PortalException
Throws:
PortalException

isUseCustomSQL

protected boolean isUseCustomSQL(LinkedHashMap<String,Object> params)

validate

protected void validate(long companyId,
                        long organizationId,
                        long parentOrganizationId,
                        String name,
                        String type,
                        long countryId,
                        long statusId)
                 throws PortalException
Throws:
PortalException

validate

protected void validate(long companyId,
                        long parentOrganizationId,
                        String name,
                        String type,
                        long countryId,
                        long statusId)
                 throws PortalException
Throws:
PortalException

Liferay 7.0-ce-b4