Interface SubscriptionDAO

  • All Superinterfaces:
    GenericDAO<Subscription>
    All Known Implementing Classes:
    SubscriptionDAOImpl

    public interface SubscriptionDAO
    extends GenericDAO<Subscription>
    Database Access Object interface class for the Subscription object. The implementation of this class is responsible for all database calls for the Subscription object and is autowired by spring This class should only be accessed from a single service and should never be exposed outside of the API
    Author:
    kevinvandevelde at atmire.com
    • Method Detail

      • deleteByDspaceObject

        void deleteByDspaceObject​(Context context,
                                  DSpaceObject dSpaceObject)
                           throws SQLException
        Delete all subscription of provided dSpaceObject
        Parameters:
        context - DSpace context object
        dSpaceObject - DSpace resource
        Throws:
        SQLException - If database error
      • findByEPerson

        List<Subscription> findByEPerson​(Context context,
                                         EPerson eperson,
                                         Integer limit,
                                         Integer offset)
                                  throws SQLException
        Return a paginated list of all subscriptions of the eperson
        Parameters:
        context - DSpace context object
        eperson - ePerson whose subscriptions want to find
        limit - Paging limit
        offset - The position of the first result to return
        Returns:
        Throws:
        SQLException - If database error
      • findByEPersonAndDso

        List<Subscription> findByEPersonAndDso​(Context context,
                                               EPerson eperson,
                                               DSpaceObject dSpaceObject,
                                               Integer limit,
                                               Integer offset)
                                        throws SQLException
        Return a paginated list of subscriptions related to a DSpaceObject belong to an ePerson
        Parameters:
        context - DSpace context object
        eperson - ePerson whose subscriptions want to find
        dSpaceObject - DSpaceObject of whom subscriptions want to find
        limit - Paging limit
        offset - The position of the first result to return
        Returns:
        Throws:
        SQLException - If database error
      • deleteByEPerson

        void deleteByEPerson​(Context context,
                             EPerson eperson)
                      throws SQLException
        Delete all subscription of provided ePerson
        Parameters:
        context - DSpace context object
        eperson - ePerson whose subscriptions want to delete
        Throws:
        SQLException - If database error
      • deleteByDSOAndEPerson

        void deleteByDSOAndEPerson​(Context context,
                                   DSpaceObject dSpaceObject,
                                   EPerson eperson)
                            throws SQLException
        Delete all subscriptions related to a DSpaceObject belong to an ePerson
        Parameters:
        context - DSpace context object
        dSpaceObject - DSpaceObject of whom subscriptions want to delete
        eperson - ePerson whose subscriptions want to delete
        Throws:
        SQLException - If database error
      • findAllOrderedByIDAndResourceType

        List<Subscription> findAllOrderedByIDAndResourceType​(Context context,
                                                             String resourceType,
                                                             Integer limit,
                                                             Integer offset)
                                                      throws SQLException
        Return a paginated list of all subscriptions ordered by ID and resourceType
        Parameters:
        context - DSpace context object
        resourceType - Could be Collection or Community
        limit - Paging limit
        offset - The position of the first result to return
        Returns:
        Throws:
        SQLException - If database error
      • findAllOrderedByDSO

        List<Subscription> findAllOrderedByDSO​(Context context,
                                               Integer limit,
                                               Integer offset)
                                        throws SQLException
        Return a paginated list of subscriptions ordered by DSpaceObject
        Parameters:
        context - DSpace context object
        limit - Paging limit
        offset - The position of the first result to return
        Returns:
        Throws:
        SQLException - If database error
      • findAllSubscriptionsBySubscriptionTypeAndFrequency

        List<Subscription> findAllSubscriptionsBySubscriptionTypeAndFrequency​(Context context,
                                                                              String subscriptionType,
                                                                              String frequencyValue)
                                                                       throws SQLException
        Return a list of all subscriptions by subscriptionType and frequency
        Parameters:
        context - DSpace context object
        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
        Returns:
        Throws:
        SQLException - If database error
      • countAll

        Long countAll​(Context context)
               throws SQLException
        Count all subscriptions
        Parameters:
        context - DSpace context object
        Returns:
        Total of all subscriptions
        Throws:
        SQLException - If database error
      • countAllByEPerson

        Long countAllByEPerson​(Context context,
                               EPerson ePerson)
                        throws SQLException
        Count all subscriptions belong to an ePerson
        Parameters:
        context - DSpace context object
        ePerson - ePerson whose subscriptions want count
        Returns:
        Total of all subscriptions belong to an ePerson
        Throws:
        SQLException - If database error
      • countAllByEPersonAndDso

        Long countAllByEPersonAndDso​(Context context,
                                     EPerson ePerson,
                                     DSpaceObject dSpaceObject)
                              throws SQLException
        Count all subscriptions related to a DSpaceObject belong to an ePerson
        Parameters:
        context - DSpace context object
        ePerson - ePerson whose subscriptions want count
        dSpaceObject - DSpaceObject of whom subscriptions want count
        Returns:
        Throws:
        SQLException - If database error