Interface SubscribeService

All Known Implementing Classes:
SubscribeServiceImpl

public interface SubscribeService
Service interface class for the Subscription object. The implementation of this class is responsible for all business logic calls for the Subscription object and is autowired by spring Class defining methods for sending new item e-mail alerts to users
Author:
kevinvandevelde at atmire.com
  • Method Details

    • findAll

      List<Subscription> findAll(Context context, String resourceType, Integer limit, Integer offset) throws Exception
      Subscribe an e-person to a collection. An e-mail will be sent every day a new item appears in the collection.
      Parameters:
      context - DSpace context
      limit - Number of subscriptions to return
      offset - Offset number
      Returns:
      list of Subscription objects
      Throws:
      SQLException - An exception that provides information on a database access error or other errors.
      Exception
    • subscribe

      Subscription subscribe(Context context, EPerson eperson, DSpaceObject dSpaceObject, List<SubscriptionParameter> subscriptionParameters, String subscriptionType) throws SQLException, AuthorizeException
      Subscribe an EPerson to a dSpaceObject (Collection or Community). An e-mail will be sent every day a new item appears in the Collection or Community.
      Parameters:
      context - DSpace context object
      eperson - EPerson to subscribe
      dSpaceObject - DSpaceObject to subscribe
      subscriptionParameters - list of @SubscriptionParameter
      subscriptionType - Currently supported only "content"
      Returns:
      Throws:
      SQLException - An exception that provides information on a database access error or other errors.
      AuthorizeException - Exception indicating the current user of the context does not have permission to perform a particular action.
    • unsubscribe

      void unsubscribe(Context context, EPerson eperson, DSpaceObject dSpaceObject) throws SQLException, AuthorizeException
      Unsubscribe an e-person to a collection. Passing in null for the collection unsubscribes the e-person from all collections they are subscribed to.
      Parameters:
      context - DSpace context
      eperson - EPerson to unsubscribe
      dSpaceObject - DSpaceObject to unsubscribe from
      Throws:
      SQLException - An exception that provides information on a database access error or other errors.
      AuthorizeException - Exception indicating the current user of the context does not have permission to perform a particular action.
    • findSubscriptionsByEPerson

      List<Subscription> findSubscriptionsByEPerson(Context context, EPerson eperson, Integer limit, Integer offset) throws SQLException
      Find out which collections an e-person is subscribed to
      Parameters:
      context - DSpace context
      eperson - EPerson
      limit - Number of subscriptions to return
      offset - Offset number
      Returns:
      array of collections e-person is subscribed to
      Throws:
      SQLException - An exception that provides information on a database access error or other errors.
    • findSubscriptionsByEPersonAndDso

      List<Subscription> findSubscriptionsByEPersonAndDso(Context context, EPerson eperson, DSpaceObject dSpaceObject, Integer limit, Integer offset) throws SQLException
      Find out which collections an e-person is subscribed to and related with dso
      Parameters:
      context - DSpace context
      eperson - EPerson
      dSpaceObject - DSpaceObject
      limit - Number of subscriptions to return
      offset - Offset number
      Returns:
      array of collections e-person is subscribed to and related with dso
      Throws:
      SQLException - An exception that provides information on a database access error or other errors.
    • findAvailableSubscriptions

      List<Collection> findAvailableSubscriptions(Context context) throws SQLException
      Find out which collections the currently logged in e-person can subscribe to
      Parameters:
      context - DSpace context
      Returns:
      array of collections the currently logged in e-person can subscribe to
      Throws:
      SQLException - An exception that provides information on a database access error or other errors.
    • findAvailableSubscriptions

      List<Collection> findAvailableSubscriptions(Context context, EPerson eperson) throws SQLException
      Find out which collections an e-person can subscribe to
      Parameters:
      context - DSpace context
      eperson - EPerson
      Returns:
      array of collections e-person can subscribe to
      Throws:
      SQLException - An exception that provides information on a database access error or other errors.
    • isSubscribed

      boolean isSubscribed(Context context, EPerson eperson, DSpaceObject dSpaceObject) throws SQLException
      Is that e-person subscribed to that collection?
      Parameters:
      context - DSpace context
      eperson - find out if this e-person is subscribed
      dSpaceObject - find out if subscribed to this dSpaceObject
      Returns:
      true if they are subscribed
      Throws:
      SQLException - An exception that provides information on a database access error or other errors.
    • deleteByDspaceObject

      void deleteByDspaceObject(Context context, DSpaceObject dSpaceObject) throws SQLException
      Delete subscription by collection.
      Parameters:
      context - DSpace context
      dSpaceObject - find out if subscribed to this dSpaceObject
      Throws:
      SQLException - An exception that provides information on a database access error or other errors.
    • deleteByEPerson

      void deleteByEPerson(Context context, EPerson ePerson) throws SQLException
      Delete subscription by eperson (subscriber).
      Parameters:
      context - DSpace context
      ePerson - find out if this e-person is subscribed
      Throws:
      SQLException - An exception that provides information on a database access error or other errors.
    • findById

      Subscription findById(Context context, int id) throws SQLException
      Finds a subscription by id
      Parameters:
      context - DSpace context
      id - the id of subscription to be searched
      Throws:
      SQLException - An exception that provides information on a database access error or other errors.
    • updateSubscription

      Subscription updateSubscription(Context context, Integer id, String subscriptionType, List<SubscriptionParameter> subscriptionParameterList) throws SQLException
      Updates a subscription by id
      Parameters:
      context - DSpace context
      id - Integer id
      subscriptionParameterList - List subscriptionParameterList
      subscriptionType - type
      Throws:
      SQLException - An exception that provides information on a database access error or other errors.
    • addSubscriptionParameter

      Subscription addSubscriptionParameter(Context context, Integer id, SubscriptionParameter subscriptionParameter) throws SQLException
      Adds a parameter to a subscription
      Parameters:
      context - DSpace context
      id - Integer id
      subscriptionParameter - SubscriptionParameter subscriptionParameter
      Throws:
      SQLException - An exception that provides information on a database access error or other errors.
    • removeSubscriptionParameter

      Subscription removeSubscriptionParameter(Context context, Integer id, SubscriptionParameter subscriptionParam) throws SQLException
      Deletes a parameter from subscription
      Parameters:
      context - DSpace context
      id - Integer id
      subscriptionParam - SubscriptionParameter subscriptionParameter
      Throws:
      SQLException - An exception that provides information on a database access error or other errors.
    • deleteSubscription

      void deleteSubscription(Context context, Subscription subscription) throws SQLException
      Deletes a subscription
      Parameters:
      context - DSpace context
      subscription - The subscription to delete
      Throws:
      SQLException - An exception that provides information on a database access error or other errors.
    • findAllSubscriptionsBySubscriptionTypeAndFrequency

      List<Subscription> findAllSubscriptionsBySubscriptionTypeAndFrequency(Context context, String subscriptionType, String frequencyValue) throws SQLException
      Finds all subscriptions by subscriptionType and frequency
      Parameters:
      context - DSpace context
      subscriptionType - Could be "content" or "statistics". NOTE: in DSpace we have only "content"
      frequencyValue - Could be "D" stand for Day, "W" stand for Week, and "M" stand for Month
      Throws:
      SQLException - An exception that provides information on a database access error or other errors.
    • countAll

      Long countAll(Context context) throws SQLException
      Counts all subscriptions
      Parameters:
      context - DSpace context
      Throws:
      SQLException
    • countSubscriptionsByEPerson

      Long countSubscriptionsByEPerson(Context context, EPerson ePerson) throws SQLException
      Counts all subscriptions by ePerson
      Parameters:
      context - DSpace context
      ePerson - EPerson ePerson
      Throws:
      SQLException
    • countByEPersonAndDSO

      Long countByEPersonAndDSO(Context context, EPerson ePerson, DSpaceObject dSpaceObject) throws SQLException
      Counts all subscriptions by ePerson and DSO
      Parameters:
      context - DSpace context
      ePerson - EPerson ePerson
      dSpaceObject - DSpaceObject dSpaceObject
      Throws:
      SQLException