Class SocialRequestLocalServiceImpl

Object
com.liferay.portal.kernel.service.BaseLocalServiceImpl
com.liferay.portlet.social.service.base.SocialRequestLocalServiceBaseImpl
com.liferay.portlet.social.service.impl.SocialRequestLocalServiceImpl
All Implemented Interfaces:
com.liferay.portal.kernel.module.framework.service.IdentifiableOSGiService, com.liferay.portal.kernel.service.BaseLocalService, com.liferay.portal.kernel.service.change.tracking.CTService<com.liferay.social.kernel.model.SocialRequest>, com.liferay.portal.kernel.service.PersistedModelLocalService, com.liferay.social.kernel.service.SocialRequestLocalService

public class SocialRequestLocalServiceImpl extends SocialRequestLocalServiceBaseImpl
The social request local service responsible for handling social requests (e.g. friend requests).
Author:
Brian Wing Shun Chan
  • Constructor Details

    • SocialRequestLocalServiceImpl

      public SocialRequestLocalServiceImpl()
  • Method Details

    • addRequest

      public com.liferay.social.kernel.model.SocialRequest addRequest(long userId, long groupId, String className, long classPK, int type, String extraData, long receiverUserId) throws com.liferay.portal.kernel.exception.PortalException
      Adds a social request to the database.

      In order to add a social request, both the requesting user and the receiving user must be from the same company and neither of them can be the default user.

      Parameters:
      userId - the primary key of the requesting user
      groupId - the primary key of the group
      className - the class name of the asset that is the subject of the request
      classPK - the primary key of the asset that is the subject of the request
      type - the request's type
      extraData - the extra data regarding the request
      receiverUserId - the primary key of the user receiving the request
      Returns:
      the social request
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • deleteReceiverUserRequests

      public void deleteReceiverUserRequests(long receiverUserId)
      Removes all the social requests for the receiving user.
      Parameters:
      receiverUserId - the primary key of the receiving user
    • deleteRequest

      public void deleteRequest(long requestId) throws com.liferay.portal.kernel.exception.PortalException
      Removes the social request identified by its primary key from the database.
      Parameters:
      requestId - the primary key of the social request
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • deleteRequest

      public void deleteRequest(com.liferay.social.kernel.model.SocialRequest request)
      Removes the social request from the database.
      Parameters:
      request - the social request to be removed
    • deleteRequests

      public void deleteRequests(long className, long classPK)
    • deleteUserRequests

      public void deleteUserRequests(long userId)
      Removes all the social requests for the requesting user.
      Parameters:
      userId - the primary key of the requesting user
    • getReceiverUserRequests

      public List<com.liferay.social.kernel.model.SocialRequest> getReceiverUserRequests(long receiverUserId, int start, int end)
      Returns a range of all the social requests for the receiving user.

      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:
      receiverUserId - the primary key of the receiving user
      start - the lower bound of the range of results
      end - the upper bound of the range of results (not inclusive)
      Returns:
      the range of matching social requests
    • getReceiverUserRequests

      public List<com.liferay.social.kernel.model.SocialRequest> getReceiverUserRequests(long receiverUserId, int status, int start, int end)
      Returns a range of all the social requests with the given status for the receiving user.

      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:
      receiverUserId - the primary key of the receiving user
      status - the social request's status
      start - the lower bound of the range of results
      end - the upper bound of the range of results (not inclusive)
      Returns:
      the range of matching social requests
    • getReceiverUserRequestsCount

      public int getReceiverUserRequestsCount(long receiverUserId)
      Returns the number of social requests for the receiving user.
      Parameters:
      receiverUserId - the primary key of the receiving user
      Returns:
      the number of matching social requests
    • getReceiverUserRequestsCount

      public int getReceiverUserRequestsCount(long receiverUserId, int status)
      Returns the number of social requests with the given status for the receiving user.
      Parameters:
      receiverUserId - the primary key of the receiving user
      status - the social request's status
      Returns:
      the number of matching social requests
    • getUserRequests

      public List<com.liferay.social.kernel.model.SocialRequest> getUserRequests(long userId, int start, int end)
      Returns a range of all the social requests for the requesting user.

      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:
      userId - the primary key of the requesting user
      start - the lower bound of the range of results
      end - the upper bound of the range of results (not inclusive)
      Returns:
      the range of matching social requests
    • getUserRequests

      public List<com.liferay.social.kernel.model.SocialRequest> getUserRequests(long userId, int status, int start, int end)
      Returns a range of all the social requests with the given status for the requesting user.

      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:
      userId - the primary key of the requesting user
      status - the social request's status
      start - the lower bound of the range of results
      end - the upper bound of the range of results (not inclusive)
      Returns:
      the range of matching social requests
    • getUserRequestsCount

      public int getUserRequestsCount(long userId)
      Returns the number of social requests for the requesting user.
      Parameters:
      userId - the primary key of the requesting user
      Returns:
      the number of matching social requests
    • getUserRequestsCount

      public int getUserRequestsCount(long userId, int status)
      Returns the number of social requests with the given status for the requesting user.
      Parameters:
      userId - the primary key of the requesting user
      status - the social request's status
      Returns:
      the number of matching social request
    • hasRequest

      public boolean hasRequest(long userId, String className, long classPK, int type, int status)
      Returns true if a matching social requests exists in the database.
      Parameters:
      userId - the primary key of the requesting user
      className - the class name of the asset that is the subject of the request
      classPK - the primary key of the asset that is the subject of the request
      type - the request's type
      status - the social request's status
      Returns:
      true if the request exists; false otherwise
    • hasRequest

      public boolean hasRequest(long userId, String className, long classPK, int type, long receiverUserId, int status)
      Returns true if a matching social request exists in the database.
      Parameters:
      userId - the primary key of the requesting user
      className - the class name of the asset that is the subject of the request
      classPK - the primary key of the asset that is the subject of the request
      type - the request's type
      receiverUserId - the primary key of the receiving user
      status - the social request's status
      Returns:
      true if the social request exists; false otherwise
    • updateRequest

      public com.liferay.social.kernel.model.SocialRequest updateRequest(long requestId, int status, com.liferay.portal.kernel.theme.ThemeDisplay themeDisplay) throws com.liferay.portal.kernel.exception.PortalException
      Updates the social request replacing its status.

      If the status is updated to SocialRequestConstants.STATUS_CONFIRM then SocialRequestInterpreterLocalService.processConfirmation(SocialRequest, ThemeDisplay) is called. If the status is updated to SocialRequestConstants.STATUS_IGNORE then SocialRequestInterpreterLocalService.processRejection(SocialRequest, ThemeDisplay) is called.

      Parameters:
      requestId - the primary key of the social request
      status - the new status
      themeDisplay - the theme display
      Returns:
      the updated social request
      Throws:
      com.liferay.portal.kernel.exception.PortalException