Class SubscribersDAO

All Implemented Interfaces:
LogEnabled, PluginAware, Component, Configurable, Contextualizable, Serviceable, ThreadSafe

public class SubscribersDAO extends AbstractMyBatisDAO implements ThreadSafe
DAO for accessing newsletters subscribers.
  • Field Details

    • ROLE

      public static final String ROLE
      The Avalon role name.
  • Constructor Details

  • Method Details

    • getSubscribers

      Get the whole list for subscribers
      Returns:
      The list for subscribers
    • getSubscribers

      Get the whole list for subscribers
      Parameters:
      sorts - The sorts list
      Returns:
      The list for subscribers
    • getSubscribers

      public List<Subscriber> getSubscribers(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<Subscriber> getSubscribers(String siteName, String categoryId, List<Map<String,Object>> sorts, int offset, int limit)
      Get the subscribers to a newsletter category
      Parameters:
      siteName - The site name
      categoryId - The newsletter category's id
      sorts - The sorts list
      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
    • getSubscriberByToken

      Get a subscriber by his token
      Parameters:
      token - The user token
      Returns:
      the subscribers
    • getSubscriptions

      public List<Subscriber> getSubscriptions(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.