public class SubscribersDAO extends AbstractMyBatisDAO implements ThreadSafe
Modifier and Type | Field and Description |
---|---|
static String |
ROLE
The Avalon role name.
|
_manager
Constructor and Description |
---|
SubscribersDAO() |
Modifier and Type | Method and Description |
---|---|
void |
empty(String categoryId,
String siteName)
Empty a category's subscribers.
|
Subscriber |
getSubscriber(String email,
String siteName,
String categoryId)
Get a subscriber to a newsletter category
|
Subscriber |
getSubscriberByToken(String token)
Get a subscriber by his token
|
List<Subscriber> |
getSubscribers()
Get the whole list for subscribers
|
List<Subscriber> |
getSubscribers(String siteName,
String categoryId)
Get the subscribers to a newsletter category
|
List<Subscriber> |
getSubscribers(String siteName,
String categoryId,
int offset,
int limit)
Get the subscribers to a newsletter category
|
int |
getSubscribersCount(String siteName,
String categoryId)
Get the subscribers count for a newsletter category
|
List<Subscriber> |
getSubscriptions(String email,
String siteName)
Get the list of subscriptions for a given email and site name.
|
void |
modifySubscriptions(Collection<Subscriber> newSubscribers,
Collection<String> removeSubscriptions)
Insert several subscriptions to newsletters.
|
void |
subscribe(Collection<Subscriber> subscribers)
Insert several subscriptions to newsletters.
|
void |
subscribe(Subscriber subscriber)
Subscribes to the newsletter
|
void |
unsubscribe(String token)
Unsubscribes to the newsletter
|
void |
unsubscribe(String email,
String siteName)
Remove all subscriptions for a subscriber in a given site.
|
_configureDatasource, _getDataSourceId, _getMyBatisConfiguration, configure, contextualize, getSession, getSession, reload, service, setPluginInfo
getLogger, setLogger
public SubscribersDAO()
public List<Subscriber> getSubscribers()
public List<Subscriber> getSubscribers(String siteName, String categoryId)
siteName
- The site namecategoryId
- The newsletter category's idpublic List<Subscriber> getSubscribers(String siteName, String categoryId, int offset, int limit)
siteName
- The site namecategoryId
- The newsletter category's idoffset
- The number of results to ignore.limit
- The maximum number of results to return.public int getSubscribersCount(String siteName, String categoryId)
siteName
- The site namecategoryId
- The newsletter category's idpublic Subscriber getSubscriber(String email, String siteName, String categoryId)
email
- The subscriber emailsiteName
- The site namecategoryId
- The newsletter category's idpublic Subscriber getSubscriberByToken(String token)
token
- The user tokenpublic List<Subscriber> getSubscriptions(String email, String siteName)
email
- the email.siteName
- the site name.public void subscribe(Subscriber subscriber)
subscriber
- The subscriberpublic void subscribe(Collection<Subscriber> subscribers)
subscribers
- a list of subscribers.public void modifySubscriptions(Collection<Subscriber> newSubscribers, Collection<String> removeSubscriptions)
newSubscribers
- the collection of subscribers to insert.removeSubscriptions
- the collection of subscription tokens to remove.public void unsubscribe(String token)
token
- The unique tokenpublic void empty(String categoryId, String siteName)
categoryId
- the category to empty.siteName
- the site name.public void unsubscribe(String email, String siteName)
email
- the category to empty.siteName
- the site name.