com.day.cq.mcm.api.newsletter
Interface NewsletterService


public interface NewsletterService

The newsletter service can be used to send newsletters or to retrieve information about the subscribers.

Since:
5.4

Method Summary
 void bounced(Authorizable authorizable, String bouncedMailPath, Session session)
          Marks a newsletter bounce.
 NewsLetter buildNewsletter(Page page)
          Builds a Newsletter from the given Page.
 NewsLetter buildNewsletter(Resource resource, URI contentUri)
          Builds a Newsletter and take the URI to retrieve the content.
 MailingList createMailingList(String groupName, Session session)
          Build a MailingList for the given group-name
 MailingList createTestMailingList(SlingHttpServletRequest request)
          Create a MailingList for testing.
 boolean hasNewsletterBounced(Authorizable authorizable, Session session)
          Tests if the authorizable's newsletter bounce counter exceeded.
 void processBounceCounter(Authorizable authorizable, boolean increase, Session session)
          Process the authorizable's bounce counter.
 MailingStatus sendNewsletter(NewsLetter newsletter)
          Send the newsletter.
 

Method Detail

sendNewsletter

MailingStatus sendNewsletter(NewsLetter newsletter)
                             throws RepositoryException
Send the newsletter.

Parameters:
newsletter - The newsletter
Returns:
truefalse otherwise.
Throws:
AccessControlException - if the Session lacks the privilege to send
RepositoryException - in case of error accessing the Repository

buildNewsletter

NewsLetter buildNewsletter(Page page)
                           throws RepositoryException
Builds a Newsletter from the given Page.
The Page is considered to represent the content of the Newsletter
Its up to the implementation what are the preconditions on processing the Page.

Parameters:
page - containing the data of the Newsletter
Returns:
the Newsletter build maybe null if the Resource is not suited to build a Newsletter
Throws:
RepositoryException - in case of Exception accessing the Repository

buildNewsletter

NewsLetter buildNewsletter(Resource resource,
                           URI contentUri)
                           throws RepositoryException
Builds a Newsletter and take the URI to retrieve the content.

Parameters:
resource - to build Newsletter of
contentUri - to take as host information to be shown in sent Newsletter
Returns:
the Newsletter build
Throws:
RepositoryException - in case of error accessing the Repository
See Also:
buildNewsletter(Page)

createMailingList

MailingList createMailingList(String groupName,
                              Session session)
                              throws NoSuchAuthorizableException,
                                     RepositoryException
Build a MailingList for the given group-name

Parameters:
groupName - to build a MailingList for
session - to retrieve the List
Returns:
the List build
Throws:
NoSuchAuthorizableException - if the group-name is not found
RepositoryException - in case of error accessing the Repository

createTestMailingList

MailingList createTestMailingList(SlingHttpServletRequest request)
                                  throws RepositoryException
Create a MailingList for testing. The aim is to have a Profile to use for personalization and a User to an e-mail address to send the mail to. The Address has to be given with the RequestParameter NewsletterHelper.PARAM_TEST_TO or defaults to the Request's User's Profile.getPrimaryMail() primary Mail} (e.g. ResourceResolver.adaptTo(User.class)). The Profile has to be given by the RequestParameter named NewsletterHelper.PARAM_TEST_PROFILE and the Id as value.

Parameters:
request - to read the input from
Returns:
a MailingList with on Recipient or null if parameters are not set
Throws:
RepositoryException - in case of error accessing the Repository

bounced

void bounced(Authorizable authorizable,
             String bouncedMailPath,
             Session session)
             throws RepositoryException
Marks a newsletter bounce.

Parameters:
authorizable - The authorizable to mark the newsletter bounce for.
bouncedMailPath - Path to the mail that bounced.
session - The JCR Session to use.
Throws:
RepositoryException

hasNewsletterBounced

boolean hasNewsletterBounced(Authorizable authorizable,
                             Session session)
                             throws RepositoryException
Tests if the authorizable's newsletter bounce counter exceeded.

Parameters:
authorizable - The authorizable to test for.
session - The JCR session to use.
Returns:
Throws:
RepositoryException

processBounceCounter

void processBounceCounter(Authorizable authorizable,
                          boolean increase,
                          Session session)
                          throws RepositoryException
Process the authorizable's bounce counter.

Parameters:
authorizable - The authorizable to process the bounce counter of.
increase - If true increase the bounce counter, decrease otherwise.
session - The JCR Session to use.
Throws:
RepositoryException


Copyright © 2011-2013 Adobe Systems Incorporated. All Rights Reserved.