Class NewsletterService
java.lang.Object
fr.paris.lutece.plugins.newsletter.service.NewsletterService
- All Implemented Interfaces:
Serializable
The newsletter service
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcopyExistingNewsletter(NewsLetter newsletter, fr.paris.lutece.portal.business.user.AdminUser user, Locale locale) Copy existing newsletter without its subscribers.generateNewsletterHtmlCode(NewsLetter newsletter, int nTemplateNewsLetterId, String strBaseUrl, fr.paris.lutece.portal.business.user.AdminUser user, Locale locale) Generate the html code of the newsletter according to the document and newsletter templatesgetImageFolderPath(String strBaseUrl) Get the url of the image folder used by templatesbyte[]getSubscribersCsvExport(int nNewsletterId) Fetches the list of subscribers on a specific newsletterGet the absolute path to the unsecured folder where files should be savedGet the unsecured image folder inside the unsecured foldergetUnsubscriptionKey(String strEmail) Get the unsubscription key associated with the given email address.booleanCheck the property in property file to know if url must be absolutes or relativesbooleanDetermine if mails must be sent in MHTMLvoidmodifySectionNumber(int nOldSectionNumber, int nNewSectionNumber, int nTemplateId) Modify the number of sections of a newsletter templatevoidremoveSubscriberFromNewsletter(Subscriber subscriber, int nNewsletterId, fr.paris.lutece.portal.service.plugin.Plugin plugin) Remove a known suscriber from a newslettervoidsendMail(NewsLetter newsletter, String strObject, String strBaseUrl, fr.paris.lutece.util.html.HtmlTemplate templateNewsletter, Collection<Subscriber> listSubscribers) Send the newsletter to a list of subscribersbooleanCheck if images of the newsletter should be transfered on an unsecured webapp or not
-
Field Details
-
BEAN_NAME
Name of the bean of this service- See Also:
-
-
Constructor Details
-
NewsletterService
public NewsletterService()
-
-
Method Details
-
sendMail
public void sendMail(NewsLetter newsletter, String strObject, String strBaseUrl, fr.paris.lutece.util.html.HtmlTemplate templateNewsletter, Collection<Subscriber> listSubscribers) Send the newsletter to a list of subscribers- Parameters:
newsletter- The newsletter to sendstrObject- The email objectstrBaseUrl- The baseUrl (can be prod url)templateNewsletter- The generated templatelistSubscribers- The list of subscribers (date and id can be null, only email is used)
-
isAbsoluteUrl
public boolean isAbsoluteUrl()Check the property in property file to know if url must be absolutes or relatives- Returns:
- true if absolute or false else
-
isMhtmlActivated
public boolean isMhtmlActivated()Determine if mails must be sent in MHTML- Returns:
- true whether MHTML is needed
-
getSubscribersCsvExport
public byte[] getSubscribersCsvExport(int nNewsletterId) Fetches the list of subscribers on a specific newsletter- Parameters:
nNewsletterId- The id of the newsletter- Returns:
- The byte representation of the list of subscribers
-
removeSubscriberFromNewsletter
public void removeSubscriberFromNewsletter(Subscriber subscriber, int nNewsletterId, fr.paris.lutece.portal.service.plugin.Plugin plugin) Remove a known suscriber from a newsletter- Parameters:
subscriber- the subscriber to removenNewsletterId- the newsletter id from which to remove the subscriberplugin- The plugin object
-
generateNewsletterHtmlCode
public String generateNewsletterHtmlCode(NewsLetter newsletter, int nTemplateNewsLetterId, String strBaseUrl, fr.paris.lutece.portal.business.user.AdminUser user, Locale locale) Generate the html code of the newsletter according to the document and newsletter templates- Parameters:
newsletter- the newsletter to generate the HTML ofnTemplateNewsLetterId- the newsletter template idstrBaseUrl- The base url of the portaluser- the current userlocale- The locale- Returns:
- the html code for the newsletter content of null if no template available
-
getImageFolderPath
Get the url of the image folder used by templates- Parameters:
strBaseUrl- The base url- Returns:
- The absolute url of the folder containing images of templates.
-
useUnsecuredImages
public boolean useUnsecuredImages()Check if images of the newsletter should be transfered on an unsecured webapp or not- Returns:
- True if images of the newsletter should be transfered on an unsecured webapp, false otherwise
-
getUnsecuredImagefolder
Get the unsecured image folder inside the unsecured folder- Returns:
- The unsecured image folder inside the unsecured folder
-
getUnsecuredFolderPath
Get the absolute path to the unsecured folder where files should be saved- Returns:
- The absolute path to the unsecured folder where files should be saved, or the webapp path if none is defined
-
getUnsubscriptionKey
Get the unsubscription key associated with the given email address.- Parameters:
strEmail- The email to get the unsubscription key of.- Returns:
- The unsubscription key of the email
-
modifySectionNumber
public void modifySectionNumber(int nOldSectionNumber, int nNewSectionNumber, int nTemplateId) Modify the number of sections of a newsletter template- Parameters:
nOldSectionNumber- The old number of sectionsnNewSectionNumber- The new number of sectionsnTemplateId- The id of the template
-
copyExistingNewsletter
public void copyExistingNewsletter(NewsLetter newsletter, fr.paris.lutece.portal.business.user.AdminUser user, Locale locale) Copy existing newsletter without its subscribers.- Parameters:
newsletter- newsletter to copyuser- the current userlocale- The locale
-