Liferay 7.0-ce-b4

com.liferay.portal.service.impl
Class UserGroupLocalServiceImpl

java.lang.Object
  extended by com.liferay.portal.service.BaseLocalServiceImpl
      extended by com.liferay.portal.service.base.UserGroupLocalServiceBaseImpl
          extended by com.liferay.portal.service.impl.UserGroupLocalServiceImpl
All Implemented Interfaces:
IdentifiableOSGiService, BaseLocalService, PersistedModelLocalService, UserGroupLocalService

public class UserGroupLocalServiceImpl
extends UserGroupLocalServiceBaseImpl

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


Field Summary
 
Fields inherited from class com.liferay.portal.service.base.UserGroupLocalServiceBaseImpl
counterLocalService, expandoRowLocalService, expandoRowPersistence, exportImportConfigurationLocalService, exportImportConfigurationPersistence, exportImportLocalService, groupFinder, groupLocalService, groupPersistence, layoutFinder, layoutLocalService, layoutPersistence, persistedModelLocalServiceRegistry, resourceLocalService, teamFinder, teamLocalService, teamPersistence, userFinder, userGroupFinder, userGroupGroupRoleFinder, userGroupGroupRoleLocalService, userGroupGroupRolePersistence, userGroupLocalService, userGroupPersistence, userLocalService, userPersistence
 
Constructor Summary
UserGroupLocalServiceImpl()
           
 
Method Summary
 void addGroupUserGroups(long groupId, long[] userGroupIds)
          Adds the user groups to the group.
 void addTeamUserGroups(long teamId, long[] userGroupIds)
          Adds the user groups to the team.
 UserGroup addUserGroup(long userId, long companyId, String name, String description)
          Deprecated. As of 6.2.0, replaced by addUserGroup(long, long, String, String, ServiceContext)
 UserGroup addUserGroup(long userId, long companyId, String name, String description, ServiceContext serviceContext)
          Adds a user group.
protected  SearchContext buildSearchContext(long companyId, String name, String description, LinkedHashMap<String,Object> params, boolean andSearch, int start, int end, Sort sort)
           
 void clearUserUserGroups(long userId)
          Clears all associations between the user and its user groups and clears the permissions cache.
 void copyUserGroupLayouts(long[] userGroupIds, long userId)
          Deprecated. As of 6.1.0
 void copyUserGroupLayouts(long userGroupId, long userId)
          Deprecated. As of 6.2.0
 void copyUserGroupLayouts(long userGroupId, long[] userIds)
          Deprecated. As of 6.1.0
 UserGroup deleteUserGroup(long userGroupId)
          Deletes the user group.
 UserGroup deleteUserGroup(UserGroup userGroup)
          Deletes the user group.
 void deleteUserGroups(long companyId)
           
protected  File[] exportLayouts(long userGroupId, Map<String,String[]> parameterMap)
           
 UserGroup fetchUserGroup(long companyId, String name)
           
 List<UserGroup> getGroupUserUserGroups(long groupId, long userId)
           
protected  Map<String,String[]> getLayoutTemplatesParameters()
           
 UserGroup getUserGroup(long companyId, String name)
          Returns the user group with the name.
 List<UserGroup> getUserGroups(long companyId)
          Returns all the user groups belonging to the company.
 List<UserGroup> getUserGroups(long[] userGroupIds)
          Returns all the user groups with the primary keys.
protected  void importLayouts(long userId, Map<String,String[]> parameterMap, File privateLayoutsFile, File publicLayoutsFile)
           
protected  boolean isUseCustomSQL(LinkedHashMap<String,Object> params)
           
 List<UserGroup> search(long companyId, String keywords, LinkedHashMap<String,Object> params, int start, int end, OrderByComparator<UserGroup> obc)
          Returns an ordered range of all the user groups that match the keywords.
 Hits search(long companyId, String keywords, LinkedHashMap<String,Object> params, int start, int end, Sort sort)
          Returns an ordered range of all the user groups that match the keywords, using the indexer.
 List<UserGroup> search(long companyId, String name, String description, LinkedHashMap<String,Object> params, boolean andOperator, int start, int end, OrderByComparator<UserGroup> obc)
          Returns an ordered range of all the user groups that match the name and description.
 Hits search(long companyId, String name, String description, LinkedHashMap<String,Object> params, boolean andSearch, int start, int end, Sort sort)
          Returns an ordered range of all the user groups that match the name and description.
 int searchCount(long companyId, String keywords, LinkedHashMap<String,Object> params)
          Returns the number of user groups that match the keywords
 int searchCount(long companyId, String name, String description, LinkedHashMap<String,Object> params, boolean andOperator)
          Returns the number of user groups that match the name and description.
 BaseModelSearchResult<UserGroup> searchUserGroups(long companyId, String keywords, LinkedHashMap<String,Object> params, int start, int end, Sort sort)
           
 BaseModelSearchResult<UserGroup> searchUserGroups(long companyId, String name, String description, LinkedHashMap<String,Object> params, boolean andSearch, int start, int end, Sort sort)
           
 void setUserUserGroups(long userId, long[] userGroupIds)
          Sets the user groups associated with the user copying the user group layouts and removing and adding user group associations for the user as necessary.
 void unsetGroupUserGroups(long groupId, long[] userGroupIds)
          Removes the user groups from the group.
 void unsetTeamUserGroups(long teamId, long[] userGroupIds)
          Removes the user groups from the team.
 UserGroup updateUserGroup(long companyId, long userGroupId, String name, String description)
          Deprecated. As of 6.2.0, replaced by updateUserGroup(long, long, String, String, ServiceContext)
 UserGroup updateUserGroup(long companyId, long userGroupId, String name, String description, ServiceContext serviceContext)
          Updates the user group.
protected  void validate(long userGroupId, long companyId, String name)
           
 
Methods inherited from class com.liferay.portal.service.base.UserGroupLocalServiceBaseImpl
addGroupUserGroup, addGroupUserGroup, addGroupUserGroups, addTeamUserGroup, addTeamUserGroup, addTeamUserGroups, addUserGroup, addUserUserGroup, addUserUserGroup, addUserUserGroups, addUserUserGroups, afterPropertiesSet, clearGroupUserGroups, clearTeamUserGroups, createUserGroup, deleteGroupUserGroup, deleteGroupUserGroup, deleteGroupUserGroups, deleteGroupUserGroups, deletePersistedModel, deleteTeamUserGroup, deleteTeamUserGroup, deleteTeamUserGroups, deleteTeamUserGroups, deleteUserUserGroup, deleteUserUserGroup, deleteUserUserGroups, deleteUserUserGroups, destroy, dynamicQuery, dynamicQuery, dynamicQuery, dynamicQuery, dynamicQueryCount, dynamicQueryCount, fetchUserGroup, fetchUserGroupByUuidAndCompanyId, getActionableDynamicQuery, getCounterLocalService, getExpandoRowLocalService, getExpandoRowPersistence, getExportActionableDynamicQuery, getExportImportConfigurationLocalService, getExportImportConfigurationPersistence, getExportImportLocalService, getGroupFinder, getGroupLocalService, getGroupPersistence, getGroupPrimaryKeys, getGroupUserGroups, getGroupUserGroups, getGroupUserGroups, getGroupUserGroupsCount, getIndexableActionableDynamicQuery, getLayoutFinder, getLayoutLocalService, getLayoutPersistence, getModelClass, getModelClassName, getOSGiServiceIdentifier, getPersistedModel, getResourceLocalService, getTeamFinder, getTeamLocalService, getTeamPersistence, getTeamPrimaryKeys, getTeamUserGroups, getTeamUserGroups, getTeamUserGroups, getTeamUserGroupsCount, getUserFinder, getUserGroup, getUserGroupByUuidAndCompanyId, getUserGroupFinder, getUserGroupGroupRoleFinder, getUserGroupGroupRoleLocalService, getUserGroupGroupRolePersistence, getUserGroupLocalService, getUserGroupPersistence, getUserGroups, getUserGroupsCount, getUserLocalService, getUserPersistence, getUserPrimaryKeys, getUserUserGroups, getUserUserGroups, getUserUserGroups, getUserUserGroupsCount, hasGroupUserGroup, hasGroupUserGroups, hasTeamUserGroup, hasTeamUserGroups, hasUserUserGroup, hasUserUserGroups, initActionableDynamicQuery, runSQL, setCounterLocalService, setExpandoRowLocalService, setExpandoRowPersistence, setExportImportConfigurationLocalService, setExportImportConfigurationPersistence, setExportImportLocalService, setGroupFinder, setGroupLocalService, setGroupPersistence, setGroupUserGroups, setLayoutFinder, setLayoutLocalService, setLayoutPersistence, setResourceLocalService, setTeamFinder, setTeamLocalService, setTeamPersistence, setTeamUserGroups, setUserFinder, setUserGroupFinder, setUserGroupGroupRoleFinder, setUserGroupGroupRoleLocalService, setUserGroupGroupRolePersistence, setUserGroupLocalService, setUserGroupPersistence, setUserLocalService, setUserPersistence, updateUserGroup
 
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

UserGroupLocalServiceImpl

public UserGroupLocalServiceImpl()
Method Detail

addGroupUserGroups

public void addGroupUserGroups(long groupId,
                               long[] userGroupIds)
Adds the user groups to the group.

Specified by:
addGroupUserGroups in interface UserGroupLocalService
Overrides:
addGroupUserGroups in class UserGroupLocalServiceBaseImpl
Parameters:
groupId - the primary key of the group
userGroupIds - the primary keys of the user groups

addTeamUserGroups

public void addTeamUserGroups(long teamId,
                              long[] userGroupIds)
Adds the user groups to the team.

Specified by:
addTeamUserGroups in interface UserGroupLocalService
Overrides:
addTeamUserGroups in class UserGroupLocalServiceBaseImpl
Parameters:
teamId - the primary key of the team
userGroupIds - the primary keys of the user groups

addUserGroup

@Deprecated
public UserGroup addUserGroup(long userId,
                                         long companyId,
                                         String name,
                                         String description)
                       throws PortalException
Deprecated. As of 6.2.0, replaced by addUserGroup(long, long, String, String, ServiceContext)

Adds a user group.

This method handles the creation and bookkeeping of the user group, including its resources, metadata, and internal data structures. It is not necessary to make subsequent calls to setup default groups and resources for the user group.

Parameters:
userId - the primary key of the user
companyId - the primary key of the user group's company
name - the user group's name
description - the user group's description
Returns:
the user group
Throws:
PortalException

addUserGroup

public UserGroup addUserGroup(long userId,
                              long companyId,
                              String name,
                              String description,
                              ServiceContext serviceContext)
                       throws PortalException
Adds a user group.

This method handles the creation and bookkeeping of the user group, including its resources, metadata, and internal data structures. It is not necessary to make subsequent calls to setup default groups and resources for the user group.

Parameters:
userId - the primary key of the user
companyId - the primary key of the user group's company
name - the user group's name
description - the user group's description
serviceContext - the service context to be applied (optionally null). Can set expando bridge attributes for the user group.
Returns:
the user group
Throws:
PortalException

clearUserUserGroups

public void clearUserUserGroups(long userId)
Clears all associations between the user and its user groups and clears the permissions cache.

Specified by:
clearUserUserGroups in interface UserGroupLocalService
Overrides:
clearUserUserGroups in class UserGroupLocalServiceBaseImpl
Parameters:
userId - the primary key of the user

copyUserGroupLayouts

@Deprecated
public void copyUserGroupLayouts(long userGroupId,
                                            long userId)
                          throws PortalException
Deprecated. As of 6.2.0

Copies the user group's layout to the user.

Parameters:
userGroupId - the primary key of the user group
userId - the primary key of the user
Throws:
PortalException

copyUserGroupLayouts

@Deprecated
public void copyUserGroupLayouts(long userGroupId,
                                            long[] userIds)
                          throws PortalException
Deprecated. As of 6.1.0

Copies the user group's layouts to the users who are not already members of the user group.

Parameters:
userGroupId - the primary key of the user group
userIds - the primary keys of the users
Throws:
PortalException

copyUserGroupLayouts

@Deprecated
public void copyUserGroupLayouts(long[] userGroupIds,
                                            long userId)
                          throws PortalException
Deprecated. As of 6.1.0

Copies the user groups' layouts to the user.

Parameters:
userGroupIds - the primary keys of the user groups
userId - the primary key of the user
Throws:
PortalException

deleteUserGroup

public UserGroup deleteUserGroup(long userGroupId)
                          throws PortalException
Deletes the user group.

Specified by:
deleteUserGroup in interface UserGroupLocalService
Overrides:
deleteUserGroup in class UserGroupLocalServiceBaseImpl
Parameters:
userGroupId - the primary key of the user group
Returns:
the deleted user group
Throws:
PortalException - if a user group with the primary key could not be found

deleteUserGroup

@SystemEvent(action=1,
             type=1)
public UserGroup deleteUserGroup(UserGroup userGroup)
                          throws PortalException
Deletes the user group.

Specified by:
deleteUserGroup in interface UserGroupLocalService
Overrides:
deleteUserGroup in class UserGroupLocalServiceBaseImpl
Parameters:
userGroup - the user group
Returns:
the deleted user group
Throws:
PortalException

deleteUserGroups

public void deleteUserGroups(long companyId)
                      throws PortalException
Throws:
PortalException

fetchUserGroup

public UserGroup fetchUserGroup(long companyId,
                                String name)

getGroupUserUserGroups

public List<UserGroup> getGroupUserUserGroups(long groupId,
                                              long userId)
                                       throws PortalException
Throws:
PortalException

getUserGroup

public UserGroup getUserGroup(long companyId,
                              String name)
                       throws PortalException
Returns the user group with the name.

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

getUserGroups

public List<UserGroup> getUserGroups(long companyId)
Returns all the user groups belonging to the company.

Parameters:
companyId - the primary key of the user groups' company
Returns:
the user groups belonging to the company

getUserGroups

public List<UserGroup> getUserGroups(long[] userGroupIds)
                              throws PortalException
Returns all the user groups with the primary keys.

Parameters:
userGroupIds - the primary keys of the user groups
Returns:
the user groups with the primary keys
Throws:
PortalException

search

public List<UserGroup> search(long companyId,
                              String keywords,
                              LinkedHashMap<String,Object> params,
                              int start,
                              int end,
                              OrderByComparator<UserGroup> obc)
Returns an ordered range of all the user groups that match the keywords.

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 user group's company
keywords - the keywords (space separated), which may occur in the user group's name or description (optionally null)
params - the finder params (optionally null). For more information see UserGroupFinder
start - the lower bound of the range of user groups to return
end - the upper bound of the range of user groups to return (not inclusive)
obc - the comparator to order the user groups (optionally null)
Returns:
the matching user groups ordered by comparator obc
See Also:
UserGroupFinder

search

public Hits search(long companyId,
                   String keywords,
                   LinkedHashMap<String,Object> params,
                   int start,
                   int end,
                   Sort sort)
Returns an ordered range of all the user groups 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 user group's company
keywords - the keywords (space separated), which may occur in the user group's name or description (optionally null)
params - the finder params (optionally null). For more information see com.liferay.portlet.usergroupsadmin.util.UserGroupIndexer
start - the lower bound of the range of user groups to return
end - the upper bound of the range of user groups to return (not inclusive)
sort - the field and direction by which to sort (optionally null)
Returns:
the matching user groups ordered by sort
See Also:
com.liferay.portlet.usergroupsadmin.util.UserGroupIndexer

search

public List<UserGroup> search(long companyId,
                              String name,
                              String description,
                              LinkedHashMap<String,Object> params,
                              boolean andOperator,
                              int start,
                              int end,
                              OrderByComparator<UserGroup> obc)
Returns an ordered range of all the user groups that match the name and description.

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 user group's company
name - the user group's name (optionally null)
description - the user group's description (optionally null)
params - the finder params (optionally null). For more information see UserGroupFinder
andOperator - whether every field must match its keywords or just one field
start - the lower bound of the range of user groups to return
end - the upper bound of the range of user groups to return (not inclusive)
obc - the comparator to order the user groups (optionally null)
Returns:
the matching user groups ordered by comparator obc
See Also:
UserGroupFinder

search

public Hits search(long companyId,
                   String name,
                   String description,
                   LinkedHashMap<String,Object> params,
                   boolean andSearch,
                   int start,
                   int end,
                   Sort sort)
Returns an ordered range of all the user groups that match the name and description. 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 user group's company
name - the user group's name (optionally null)
description - the user group's description (optionally null)
params - the finder params (optionally null). For more information see com.liferay.portlet.usergroupsadmin.util.UserGroupIndexer
andSearch - whether every field must match its keywords or just one field
start - the lower bound of the range of user groups to return
end - the upper bound of the range of user groups to return (not inclusive)
sort - the field and direction by which to sort (optionally null)
Returns:
the matching user groups ordered by sort
See Also:
UserGroupFinder

searchCount

public int searchCount(long companyId,
                       String keywords,
                       LinkedHashMap<String,Object> params)
Returns the number of user groups that match the keywords

Parameters:
companyId - the primary key of the user group's company
keywords - the keywords (space separated), which may occur in the user group's name or description (optionally null)
params - the finder params (optionally null). For more information see UserGroupFinder
Returns:
the number of matching user groups
See Also:
UserGroupFinder

searchCount

public int searchCount(long companyId,
                       String name,
                       String description,
                       LinkedHashMap<String,Object> params,
                       boolean andOperator)
Returns the number of user groups that match the name and description.

Parameters:
companyId - the primary key of the user group's company
name - the user group's name (optionally null)
description - the user group's description (optionally null)
params - the finder params (optionally null). For more information see UserGroupFinder
andOperator - whether every field must match its keywords or just one field
Returns:
the number of matching user groups
See Also:
UserGroupFinder

searchUserGroups

public BaseModelSearchResult<UserGroup> searchUserGroups(long companyId,
                                                         String keywords,
                                                         LinkedHashMap<String,Object> params,
                                                         int start,
                                                         int end,
                                                         Sort sort)
                                                  throws PortalException
Throws:
PortalException

searchUserGroups

public BaseModelSearchResult<UserGroup> searchUserGroups(long companyId,
                                                         String name,
                                                         String description,
                                                         LinkedHashMap<String,Object> params,
                                                         boolean andSearch,
                                                         int start,
                                                         int end,
                                                         Sort sort)
                                                  throws PortalException
Throws:
PortalException

setUserUserGroups

public void setUserUserGroups(long userId,
                              long[] userGroupIds)
                       throws PortalException
Sets the user groups associated with the user copying the user group layouts and removing and adding user group associations for the user as necessary.

Specified by:
setUserUserGroups in interface UserGroupLocalService
Overrides:
setUserUserGroups in class UserGroupLocalServiceBaseImpl
Parameters:
userId - the primary key of the user
userGroupIds - the primary keys of the user groups
Throws:
PortalException

unsetGroupUserGroups

public void unsetGroupUserGroups(long groupId,
                                 long[] userGroupIds)
Removes the user groups from the group.

Parameters:
groupId - the primary key of the group
userGroupIds - the primary keys of the user groups

unsetTeamUserGroups

public void unsetTeamUserGroups(long teamId,
                                long[] userGroupIds)
Removes the user groups from the team.

Parameters:
teamId - the primary key of the team
userGroupIds - the primary keys of the user groups

updateUserGroup

@Deprecated
public UserGroup updateUserGroup(long companyId,
                                            long userGroupId,
                                            String name,
                                            String description)
                          throws PortalException
Deprecated. As of 6.2.0, replaced by updateUserGroup(long, long, String, String, ServiceContext)

Updates the user group.

Parameters:
companyId - the primary key of the user group's company
userGroupId - the primary key of the user group
name - the user group's name
description - the user group's description
Returns:
the user group
Throws:
PortalException

updateUserGroup

public UserGroup updateUserGroup(long companyId,
                                 long userGroupId,
                                 String name,
                                 String description,
                                 ServiceContext serviceContext)
                          throws PortalException
Updates the user group.

Parameters:
companyId - the primary key of the user group's company
userGroupId - the primary key of the user group
name - the user group's name
description - the user group's description
serviceContext - the service context to be applied (optionally null). Can set expando bridge attributes for the user group.
Returns:
the user group
Throws:
PortalException

buildSearchContext

protected SearchContext buildSearchContext(long companyId,
                                           String name,
                                           String description,
                                           LinkedHashMap<String,Object> params,
                                           boolean andSearch,
                                           int start,
                                           int end,
                                           Sort sort)

exportLayouts

protected File[] exportLayouts(long userGroupId,
                               Map<String,String[]> parameterMap)
                        throws PortalException
Throws:
PortalException

getLayoutTemplatesParameters

protected Map<String,String[]> getLayoutTemplatesParameters()

importLayouts

protected void importLayouts(long userId,
                             Map<String,String[]> parameterMap,
                             File privateLayoutsFile,
                             File publicLayoutsFile)
                      throws PortalException
Throws:
PortalException

isUseCustomSQL

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

validate

protected void validate(long userGroupId,
                        long companyId,
                        String name)
                 throws PortalException
Throws:
PortalException

Liferay 7.0-ce-b4