Interface FavoriteService


public interface FavoriteService
  • Field Details

  • Method Details

    • createFavorite

      void createFavorite(Favorite favorite) throws org.exoplatform.commons.ObjectAlreadyExistsException
      Create a new Favorite for corresponding object identified by its type/id for a user
      Parameters:
      favorite - Favorite object that has to define: - objectType object type, can be of any type: activity, comment, notes... - objectId object technical unique identifier - userIdentityId Identity technical identifier of the user
      Throws:
      org.exoplatform.commons.ObjectAlreadyExistsException - when the favorite already exists
    • getFavoriteItemsByCreator

      List<MetadataItem> getFavoriteItemsByCreator(long creatorId, long offset, long limit)
      Retrieves the favorite items attached to a given MetadataItem creatorId
      Parameters:
      creatorId - MetadataItem creatorId
      offset - offset of ids to retrieve
      limit - limit of ids to retrieve
      Returns:
      List of linked MetadataItem
    • getFavoriteItemsByCreatorAndType

      List<MetadataItem> getFavoriteItemsByCreatorAndType(String objectType, long creatorId, long offset, long limit)
      Retrieves the favorite items attached to a given MetadataItem creatorId and MetadataObject type
      Parameters:
      objectType - MetadataObject type
      creatorId - MetadataItem creatorId
      offset - offset of ids to retrieve
      limit - limit of ids to retrieve
      Returns:
      List of linked MetadataItem
    • getFavoriteItemsByCreatorAndTypeAndSpaceId

      default List<MetadataItem> getFavoriteItemsByCreatorAndTypeAndSpaceId(String objectType, long creatorId, long spaceId, long offset, long limit)
      Retrieves the favorite items attached to a given MetadataItem creatorId and MetadataObject type and MetadataObject spaceId
      Parameters:
      objectType - MetadataObject type
      creatorId - MetadataItem creatorId
      spaceId - MetadataItem spaceId
      offset - offset of ids to retrieve
      limit - limit of ids to retrieve
      Returns:
      List of linked MetadataItem
    • getFavoriteItemsSize

      int getFavoriteItemsSize(long creatorId)
      Count the favorite items attached to a given MetadataItem creatorId
      Parameters:
      creatorId - MetadataItem creatorId
      Returns:
      integer
    • getFavoriteItemsSize

      int getFavoriteItemsSize(String objectType, long creatorId)
      Count the favorite items attached to a given MetadataItem creatorId and Object Type
      Parameters:
      objectType - MetadataObject type
      creatorId - MetadataItem creatorId
      Returns:
      integer
    • isFavorite

      boolean isFavorite(Favorite favorite)
      Check if an object identified by its type/id for a user has favorite metadata or not
      Parameters:
      favorite - Favorite object that has to define: - objectType object type, can be of any type: activity, comment, notes... - objectId object technical unique identifier - userIdentityId Identity technical identifier of the user
    • deleteFavorite

      void deleteFavorite(Favorite favorite) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Deletes an existing Favorite for corresponding object identified by its type/id for a user
      Parameters:
      favorite - Favorite object that has to define: - objectType object type, can be of any type: activity, comment, notes... - objectId object technical unique identifier - userIdentityId Identity technical identifier of the user
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the favorite doesn't exists
    • canCreateFavorite

      default boolean canCreateFavorite(org.exoplatform.services.security.Identity userIdentity, String entityType, String entityId)
      Checks whether the user can mark an entity as favorite
      Parameters:
      userIdentity - user identity
      entityType - object type, can be of any type: activity, comment, notes...
      entityId - object technical unique identifier
      Returns:
      true if the user can mark entity as favorite, else false.
    • addFavoriteACLPlugin

      default void addFavoriteACLPlugin(FavoriteACLPlugin favoriteACLPlugin)
      Add a favorite ACL plugins
    • setFavoriteAsLastAccessed

      default void setFavoriteAsLastAccessed(String entityType, String entityId, long userIdentityId) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Set an existing favorite item as last item accessed by a user
      Parameters:
      entityType -
      entityId - object technical unique identifier
      userIdentityId - Identity technical identifier of the user
      entityType - object type, can be of any type: activity, comment, notes...
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - when the favorite doesn't exists