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 (except
isNewsletter(com.day.cq.wcm.api.Page) must be
called with a newsletter page, or else they will throw a NewsletterException.-
Method Summary
Modifier and TypeMethodDescriptionvoidMarks a newsletter as approved.voiddisapprove(Page newsletter) Revokes the approval of a newsletter.longgetLastModified(Page newsletter) Returns the date of the last modification of a newsletter.String[]getLinkedDeliveries(Page newsletter) Returns an array with currently linked deliveries.getPlainText(Page newsletter) Gets the plain text variant of the specified newsletter (if available).getSubject(Page newsletter) Gets a suitable subject for the specified newsletter.booleanisApproved(Page newsletter) Checks if a newsletter is approved.booleanReturns true if the newsletter is linked to the specified delivery.booleanisModifiedSince(Page newsletter, long timestamp) Checks if a newsletter has been modified after a specified date.booleanisNewsletter(Page page) Checks if the specified page is a newsletter, i.e.Links a newsletter with an Adobe Campaign delivery.voidLocks a newsletter to the currently active session.voidmarkAsSent(Page newsletter, String deliveryId) Marks a newsletter as sent by a delivery.voidReplicates a newsletter and all its referenced resources to the publish instance(s).voidUnlinks a newsletter from an Adobe Campaign delivery.voidUnlocks a newsletter.
-
Method Details
-
isNewsletter
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
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
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
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
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
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
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
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
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;
nullif no text variant is available - Throws:
NewsletterException
-
isApproved
Checks if a newsletter is approved.- Parameters:
newsletter- A newsletter page- Returns:
- true if the specified newsletter is approved, false otherwise
- Throws:
NewsletterException
-
approve
Marks a newsletter as approved.- Parameters:
newsletter- A newsletter page to approve- Throws:
NewsletterException- if the newsletter has already been approvedPersistenceException
-
disapprove
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, 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
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
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
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
-