Class SubscribersDAO

    • Field Detail

      • ROLE

        public static final String ROLE
        The Avalon role name.
    • Method Detail

      • getSubscribers

        public List<SubscribergetSubscribers​(String siteName,
                                               String categoryId)
        Get the subscribers to a newsletter category
        Parameters:
        siteName - The site name
        categoryId - The newsletter category's id
        Returns:
        the subscribers
      • getSubscribers

        public List<SubscribergetSubscribers​(String siteName,
                                               String categoryId,
                                               int offset,
                                               int limit)
        Get the subscribers to a newsletter category
        Parameters:
        siteName - The site name
        categoryId - The newsletter category's id
        offset - The number of results to ignore.
        limit - The maximum number of results to return.
        Returns:
        the subscribers
      • getSubscribersCount

        public int getSubscribersCount​(String siteName,
                                       String categoryId)
        Get the subscribers count for a newsletter category
        Parameters:
        siteName - The site name
        categoryId - The newsletter category's id
        Returns:
        the subscribers count
      • getSubscriber

        public Subscriber getSubscriber​(String email,
                                        String siteName,
                                        String categoryId)
        Get a subscriber to a newsletter category
        Parameters:
        email - The subscriber email
        siteName - The site name
        categoryId - The newsletter category's id
        Returns:
        the subscribers
      • getSubscriptions

        public List<SubscribergetSubscriptions​(String email,
                                                 String siteName)
        Get the list of subscriptions for a given email and site name.
        Parameters:
        email - the email.
        siteName - the site name.
        Returns:
        the list of subscriptions.
      • subscribe

        public void subscribe​(Subscriber subscriber)
        Subscribes to the newsletter
        Parameters:
        subscriber - The subscriber
      • subscribe

        public void subscribe​(Collection<Subscriber> subscribers)
        Insert several subscriptions to newsletters.
        Parameters:
        subscribers - a list of subscribers.
      • modifySubscriptions

        public void modifySubscriptions​(Collection<Subscriber> newSubscribers,
                                        Collection<String> removeSubscriptions)
        Insert several subscriptions to newsletters.
        Parameters:
        newSubscribers - the collection of subscribers to insert.
        removeSubscriptions - the collection of subscription tokens to remove.
      • unsubscribe

        public void unsubscribe​(String token)
        Unsubscribes to the newsletter
        Parameters:
        token - The unique token
      • empty

        public void empty​(String categoryId,
                          String siteName)
        Empty a category's subscribers.
        Parameters:
        categoryId - the category to empty.
        siteName - the site name.
      • unsubscribe

        public void unsubscribe​(String email,
                                String siteName)
        Remove all subscriptions for a subscriber in a given site.
        Parameters:
        email - the category to empty.
        siteName - the site name.