Class UserGroupServiceUtil

Object
com.liferay.portal.kernel.service.UserGroupServiceUtil

public class UserGroupServiceUtil extends Object
Provides the remote service utility for UserGroup. This utility wraps com.liferay.portal.service.impl.UserGroupServiceImpl and is an access point for service operations in application layer code running on a remote server. Methods of this service are expected to have security checks based on the propagated JAAS credentials because this service can be accessed remotely.
Author:
Brian Wing Shun Chan
See Also:
{$generated.description}
  • Constructor Details

    • UserGroupServiceUtil

      public UserGroupServiceUtil()
  • Method Details

    • addGroupUserGroups

      public static void addGroupUserGroups(long groupId, long[] userGroupIds) throws PortalException
      Adds the user groups to the group.
      Parameters:
      groupId - the primary key of the group
      userGroupIds - the primary keys of the user groups
      Throws:
      PortalException
    • addOrUpdateUserGroup

      public static UserGroup addOrUpdateUserGroup(String externalReferenceCode, String name, String description, ServiceContext serviceContext) throws PortalException
      Throws:
      PortalException
    • addTeamUserGroups

      public static void addTeamUserGroups(long teamId, long[] userGroupIds) throws PortalException
      Adds the user groups to the team
      Parameters:
      teamId - the primary key of the team
      userGroupIds - the primary keys of the user groups
      Throws:
      PortalException
    • addUserGroup

      public static UserGroup addUserGroup(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.

      Parameters:
      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
    • deleteUserGroup

      public static void deleteUserGroup(long userGroupId) throws PortalException
      Deletes the user group.
      Parameters:
      userGroupId - the primary key of the user group
      Throws:
      PortalException
    • fetchUserGroup

      public static UserGroup fetchUserGroup(long userGroupId) throws PortalException
      Fetches the user group with the primary key.
      Parameters:
      userGroupId - the primary key of the user group
      Returns:
      the user group with the primary key
      Throws:
      PortalException
    • fetchUserGroupByExternalReferenceCode

      public static UserGroup fetchUserGroupByExternalReferenceCode(long companyId, String externalReferenceCode) throws PortalException
      Throws:
      PortalException
    • getGtUserGroups

      public static List<UserGroup> getGtUserGroups(long gtUserGroupId, long companyId, long parentUserGroupId, int size)
    • getOSGiServiceIdentifier

      public static String getOSGiServiceIdentifier()
      Returns the OSGi service identifier.
      Returns:
      the OSGi service identifier
    • getUserGroup

      public static UserGroup getUserGroup(long userGroupId) throws PortalException
      Returns the user group with the primary key.
      Parameters:
      userGroupId - the primary key of the user group
      Returns:
      the user group with the primary key
      Throws:
      PortalException
    • getUserGroup

      public static UserGroup getUserGroup(String name) throws PortalException
      Returns the user group with the name.
      Parameters:
      name - the user group's name
      Returns:
      the user group with the name
      Throws:
      PortalException
    • getUserGroupByExternalReferenceCode

      public static UserGroup getUserGroupByExternalReferenceCode(String externalReferenceCode, long companyId) throws PortalException
      Throws:
      PortalException
    • getUserGroups

      public static List<UserGroup> getUserGroups(long companyId) throws PortalException
      Throws:
      PortalException
    • getUserGroups

      public static List<UserGroup> getUserGroups(long companyId, String name, int start, int end)
    • getUserGroupsCount

      public static int getUserGroupsCount(long companyId, String name)
    • getUserUserGroups

      public static List<UserGroup> getUserUserGroups(long userId) throws PortalException
      Returns all the user groups to which the user belongs.
      Parameters:
      userId - the primary key of the user
      Returns:
      the user groups to which the user belongs
      Throws:
      PortalException
    • search

      public static List<UserGroup> search(long companyId, String keywords, LinkedHashMap<String,Object> params, int start, int end, OrderByComparator<UserGroup> orderByComparator)
      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)
      orderByComparator - the comparator to order the user groups (optionally null)
      Returns:
      the matching user groups ordered by comparator orderByComparator
      See Also:
    • search

      public static List<UserGroup> search(long companyId, String name, String description, LinkedHashMap<String,Object> params, boolean andOperator, int start, int end, OrderByComparator<UserGroup> orderByComparator)
      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)
      orderByComparator - the comparator to order the user groups (optionally null)
      Returns:
      the matching user groups ordered by comparator orderByComparator
      See Also:
    • searchCount

      public static 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:
    • searchCount

      public static 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:
    • unsetGroupUserGroups

      public static void unsetGroupUserGroups(long groupId, long[] userGroupIds) throws PortalException
      Removes the user groups from the group.
      Parameters:
      groupId - the primary key of the group
      userGroupIds - the primary keys of the user groups
      Throws:
      PortalException
    • unsetTeamUserGroups

      public static void unsetTeamUserGroups(long teamId, long[] userGroupIds) throws PortalException
      Removes the user groups from the team.
      Parameters:
      teamId - the primary key of the team
      userGroupIds - the primary keys of the user groups
      Throws:
      PortalException
    • updateExternalReferenceCode

      public static UserGroup updateExternalReferenceCode(UserGroup userGroup, String externalReferenceCode) throws PortalException
      Throws:
      PortalException
    • updateUserGroup

      public static UserGroup updateUserGroup(long userGroupId, String name, String description, ServiceContext serviceContext) throws PortalException
      Updates the user group.
      Parameters:
      userGroupId - the primary key of the user group
      name - the user group's name
      description - the 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
    • getService

      public static UserGroupService getService()
    • setService

      public static void setService(UserGroupService service)