Package com.adobe.cq.mcm.campaign
Interface NewsletterManager
-
public interface NewsletterManager
Interface providing methods to interact with and modify Adobe Campaign newsletter pages. All methods (exceptisNewsletter(com.day.cq.wcm.api.Page)
must be called with a newsletter page, or else they will throw aNewsletterException
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
approve(Page newsletter)
Marks a newsletter as approved.void
disapprove(Page newsletter)
Revokes the approval of a newsletter.long
getLastModified(Page newsletter)
Returns the date of the last modification of a newsletter.java.lang.String[]
getLinkedDeliveries(Page newsletter)
Returns an array with currently linked deliveries.java.lang.String
getPlainText(Page newsletter)
Gets the plain text variant of the specified newsletter (if available).java.lang.String
getSubject(Page newsletter)
Gets a suitable subject for the specified newsletter.boolean
isApproved(Page newsletter)
Checks if a newsletter is approved.boolean
isLinked(Page newsletter, java.lang.String deliveryId)
Returns true if the newsletter is linked to the specified delivery.boolean
isModifiedSince(Page newsletter, long timestamp)
Checks if a newsletter has been modified after a specified date.boolean
isNewsletter(Page page)
Checks if the specified page is a newsletter, i.e.java.lang.String
link(Page newsletter, java.lang.String deliveryId)
Links a newsletter with an Adobe Campaign delivery.void
lock(Page newsletter, java.lang.String deliveryId)
Locks a newsletter to the currently active session.void
markAsSent(Page newsletter, java.lang.String deliveryId)
Marks a newsletter as sent by a delivery.void
publish(Page newsletter)
Replicates a newsletter and all its referenced resources to the publish instance(s).void
unlink(Page newsletter, java.lang.String deliveryId)
Unlinks a newsletter from an Adobe Campaign delivery.void
unlock(Page newsletter, java.lang.String deliveryId)
Unlocks a newsletter.
-
-
-
Method Detail
-
isNewsletter
boolean isNewsletter(Page page)
Checks if the specified page is a newsletter, i.e. if its resource type inherits from the base campaign newsletter component.- Parameters:
page
- A page- Returns:
- true if the specified page is a newsletter, false otherwise
-
isLinked
boolean isLinked(Page newsletter, java.lang.String deliveryId) throws NewsletterException
Returns true if the newsletter is linked to the specified delivery.- Parameters:
newsletter
- A newsletterdeliveryId
- A delivery id- Returns:
- true if the newsletter is linked to the specified delivery, false otherwise
- Throws:
NewsletterException
- if the specified page is not a newsletter
-
getLinkedDeliveries
java.lang.String[] getLinkedDeliveries(Page newsletter) throws NewsletterException
Returns an array with currently linked deliveries.- Parameters:
newsletter
- The newsletter page to check- Returns:
- An array with linked deliveries; empty array if no deliveries are linked
- Throws:
NewsletterException
- If the specified page is not a newsletter
-
link
java.lang.String link(Page newsletter, java.lang.String deliveryId) throws NewsletterException, PersistenceException
Links a newsletter with an Adobe Campaign delivery.- Parameters:
newsletter
- The newsletter page to linkdeliveryId
- The id of the delivery to link with the newsletter- Returns:
- The uuid identifying the newsletter
- Throws:
NewsletterException
- if the delivery is already linked with the newsletterPersistenceException
-
unlink
void unlink(Page newsletter, java.lang.String deliveryId) throws NewsletterException, PersistenceException
Unlinks a newsletter from an Adobe Campaign delivery.- Parameters:
newsletter
- The newsletter page to unlinkdeliveryId
- The id of the delivery to unlink the newsletter from- Throws:
NewsletterException
- if the newsletter is not linked to the delivery or if the delivery has been used to lock the newsletterPersistenceException
-
isModifiedSince
boolean isModifiedSince(Page newsletter, long timestamp) throws NewsletterException
Checks if a newsletter has been modified after a specified date.- Parameters:
newsletter
- A newsletter pagetimestamp
- The date to check against- Returns:
- true if the newsletter has been modified since, false otherwise
- Throws:
NewsletterException
-
getLastModified
long getLastModified(Page newsletter) throws NewsletterException
Returns the date of the last modification of a newsletter.- Parameters:
newsletter
- A newsletter page- Returns:
- The timestamp of the last modification of the specified newsletter
- Throws:
NewsletterException
-
getSubject
java.lang.String getSubject(Page newsletter) throws NewsletterException
Gets a suitable subject for the specified newsletter.- Parameters:
newsletter
- A newsletter page- Returns:
- The subject of the specified newsletter
- Throws:
NewsletterException
- if the subject could not be determined
-
getPlainText
java.lang.String getPlainText(Page newsletter) throws NewsletterException
Gets the plain text variant of the specified newsletter (if available).- Parameters:
newsletter
- A newsletter page- Returns:
- The plain text variant of the specified newsletter;
null
if no text variant is available - Throws:
NewsletterException
-
isApproved
boolean isApproved(Page newsletter) throws NewsletterException
Checks if a newsletter is approved.- Parameters:
newsletter
- A newsletter page- Returns:
- true if the specified newsletter is approved, false otherwise
- Throws:
NewsletterException
-
approve
void approve(Page newsletter) throws NewsletterException, PersistenceException
Marks a newsletter as approved.- Parameters:
newsletter
- A newsletter page to approve- Throws:
NewsletterException
- if the newsletter has already been approvedPersistenceException
-
disapprove
void disapprove(Page newsletter) throws NewsletterException, PersistenceException
Revokes the approval of a newsletter.- Parameters:
newsletter
- A newsletter page to disapprove- Throws:
NewsletterException
- if the newsletter is not currently approvedPersistenceException
-
markAsSent
void markAsSent(Page newsletter, java.lang.String deliveryId) throws NewsletterException, PersistenceException
Marks a newsletter as sent by a delivery.- Parameters:
newsletter
- A newsletter pagedeliveryId
- The delivery used to send the newsletter- Throws:
NewsletterException
- if the newsletter is not linked to the delivery or has already been marked as sentPersistenceException
-
lock
void lock(Page newsletter, java.lang.String deliveryId) throws NewsletterException
Locks a newsletter to the currently active session. The lock is associated to the specified delivery, meaning that the same delivery must be used to unlock the newsletter.- Parameters:
newsletter
- A newsletter page to lockdeliveryId
- The delivery requesting to lock the newsletter- Throws:
NewsletterException
- if the newsletter is already locked, not linked to the delivery or if an error occurred
-
unlock
void unlock(Page newsletter, java.lang.String deliveryId) throws NewsletterException
Unlocks a newsletter. Must be called with the same delivery that was used to lock the newsletter.- Parameters:
newsletter
- A newsletter page to unlockdeliveryId
- The delivery requesting to unlock the newsletter- Throws:
NewsletterException
- if the newsletter is not currently locked, was locked by another delivery or an error occurred
-
publish
void publish(Page newsletter) throws NewsletterException
Replicates a newsletter and all its referenced resources to the publish instance(s).- Parameters:
newsletter
- A newsletter page to publish- Throws:
NewsletterException
- if session is not authorized to replicate the newsletter or if the replication did not succeed
-
-