public class NewsletterDAO extends AbstractLogEnabled implements Serviceable, Component, Contextualizable
Modifier and Type | Field and Description |
---|---|
static String |
__NEWSLETTER_CONTENT_TYPE
Newsletter content type
|
static String |
__SEND_TESTING_RIGHT
Right to send a test newsletter
|
static String |
__TEST_UNIQUE_ID_METADATA
Metadata test-unique-id
|
private CategoryProviderExtensionPoint |
_categoryProviderEP |
private Context |
_context |
private CurrentUserProvider |
_currentUserProvider |
private RenderingContextHandler |
_renderingContextHandler |
private Repository |
_repository |
private AmetysObjectResolver |
_resolver |
private SiteManager |
_siteManager |
private SourceResolver |
_sourceResolver |
static String |
ROLE
The Avalon role
|
Constructor and Description |
---|
NewsletterDAO() |
Modifier and Type | Method and Description |
---|---|
private void |
_copyNode(Node parent,
Node nodeToCopy) |
private String |
_createDataHolderContentWithNodes(Site site,
WebContent realContent,
String uid,
NodeIterator realContentDataNodes) |
protected String |
_getBodyAsHtml(DefaultWebContent content,
String dataHolderId)
Get the newsletter HTML body
|
protected String |
_getBodyAsText(DefaultWebContent content,
String dataHolderId)
Get the newsletter text body
|
private Node |
_getOrCreateNode(Node node,
String name,
String type) |
protected String |
_getSubject(DefaultWebContent content)
Get the newsletter mail subject
|
private String |
_useDataHolderContent(Site site,
WebContent realContent,
String uid) |
void |
contextualize(Context context) |
Category |
getCategory(String categoryID)
Get a category
|
Map<String,Object> |
getNewsletterProperties(Content newsletter)
Gets newsletter's properties to JSON format
|
boolean |
isSent(String newsletterId)
Determines if the newsletter was already sent
|
void |
removeTestNewsletter(WebContent content,
Site site)
Remove the test newsletter if it exists in live workspace
|
void |
sendNewsletter(DefaultWebContent content,
Map<String,String> recipients)
Send the newsletter to the recipients
|
void |
sendNewsletter(DefaultWebContent content,
Map<String,String> recipients,
String dataHolderId)
Send the newsletter to the recipients
|
boolean |
sendTestNewsletter(String newsletterId,
String recipientEmail)
Send the newsletter to a single recipient, while ignoring the subscribers or the workflow state
|
void |
service(ServiceManager smanager) |
getLogger, setLogger
public static final String __SEND_TESTING_RIGHT
public static final String __NEWSLETTER_CONTENT_TYPE
public static final String __TEST_UNIQUE_ID_METADATA
private AmetysObjectResolver _resolver
private CurrentUserProvider _currentUserProvider
private RenderingContextHandler _renderingContextHandler
private SourceResolver _sourceResolver
private CategoryProviderExtensionPoint _categoryProviderEP
private SiteManager _siteManager
private Repository _repository
public NewsletterDAO()
public void service(ServiceManager smanager) throws ServiceException
service
in interface Serviceable
ServiceException
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public boolean isSent(String newsletterId)
newsletterId
- the id of newsletterpublic Map<String,Object> getNewsletterProperties(Content newsletter)
newsletter
- The newsletterpublic boolean sendTestNewsletter(String newsletterId, String recipientEmail) throws IllegalAccessException
newsletterId
- The newsletter idrecipientEmail
- The recipientIllegalAccessException
- If a user tried to send a newsletter with insufficient rightsprivate String _useDataHolderContent(Site site, WebContent realContent, String uid)
private String _createDataHolderContentWithNodes(Site site, WebContent realContent, String uid, NodeIterator realContentDataNodes) throws RepositoryException
RepositoryException
private Node _getOrCreateNode(Node node, String name, String type) throws RepositoryException
RepositoryException
private void _copyNode(Node parent, Node nodeToCopy) throws RepositoryException
RepositoryException
public void sendNewsletter(DefaultWebContent content, Map<String,String> recipients) throws IOException
content
- The newsletterrecipients
- The recipients of the newsletterIOException
- If an error occurredpublic void sendNewsletter(DefaultWebContent content, Map<String,String> recipients, String dataHolderId) throws IOException
content
- The newsletterrecipients
- The recipients of the newsletterdataHolderId
- The content to use as a data holder proxy for images. Can be nullIOException
- If an error occurredprotected String _getSubject(DefaultWebContent content)
content
- The contentprotected String _getBodyAsHtml(DefaultWebContent content, String dataHolderId) throws IOException
content
- The contentdataHolderId
- The data holder content to use as proxy imagesIOException
- if an I/O error occurredprotected String _getBodyAsText(DefaultWebContent content, String dataHolderId) throws IOException
content
- The contentdataHolderId
- The data holder content to use as proxy imagesIOException
- if an I/O error occurredpublic Category getCategory(String categoryID)
categoryID
- The category idpublic void removeTestNewsletter(WebContent content, Site site) throws RepositoryException
content
- The contentsite
- The site of the contentRepositoryException
- If an error occurred