public class NewsletterService extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static String |
BEAN_NAME
Name of the bean of this service
|
Constructor and Description |
---|
NewsletterService() |
Modifier and Type | Method and Description |
---|---|
void |
copyExistingNewsletter(NewsLetter newsletter,
fr.paris.lutece.portal.business.user.AdminUser user,
Locale locale)
Copy existing newsletter without its subscribers.
|
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
|
String |
getImageFolderPath(String strBaseUrl)
Get the url of the image folder used by templates
|
static NewsletterService |
getService()
Returns the instance of the singleton
|
byte[] |
getSubscribersCsvExport(int nNewsletterId)
Fetches the list of subscribers on a specific newsletter
|
String |
getUnsecuredFolderPath()
Get the absolute path to the unsecured folder where files should be
saved
|
String |
getUnsecuredImagefolder()
Get the unsecured image folder inside the unsecured folder
|
String |
getUnsecuredWebappUrl()
Get the absolute url to the unsecured webapp.
|
String |
getUnsubscriptionKey(String strEmail)
Get the unsubscription key associated with the given email address.
|
boolean |
isAbsoluteUrl()
Check the property in property file to know if url must be absolutes or
relatives
|
boolean |
isMhtmlActivated()
Determine if mails must be sent in MHTML
|
void |
modifySectionNumber(int nOldSectionNumber,
int nNewSectionNumber,
int nTemplateId)
Modify the number of sections of a newsletter template
|
void |
removeSubscriberFromNewsletter(Subscriber subscriber,
int nNewsletterId,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Remove a known suscriber from a newsletter
|
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
|
boolean |
useUnsecuredImages()
Check if images of the newsletter should be transfered on an unsecured
webapp or not
|
public static final String BEAN_NAME
public static NewsletterService getService()
public void sendMail(NewsLetter newsletter, String strObject, String strBaseUrl, fr.paris.lutece.util.html.HtmlTemplate templateNewsletter, Collection<Subscriber> listSubscribers)
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)public boolean isAbsoluteUrl()
public boolean isMhtmlActivated()
public byte[] getSubscribersCsvExport(int nNewsletterId)
nNewsletterId
- The id of the newsletterpublic void removeSubscriberFromNewsletter(Subscriber subscriber, int nNewsletterId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
subscriber
- the subscriber to removenNewsletterId
- the newsletter id from which to remove the
subscriberplugin
- The plugin objectpublic String generateNewsletterHtmlCode(NewsLetter newsletter, int nTemplateNewsLetterId, String strBaseUrl, fr.paris.lutece.portal.business.user.AdminUser user, Locale locale)
newsletter
- the newsletter to generate the HTML ofnTemplateNewsLetterId
- the newsletter template idstrBaseUrl
- The base url of the portaluser
- the current userlocale
- The localepublic String getImageFolderPath(String strBaseUrl)
strBaseUrl
- The base urlpublic boolean useUnsecuredImages()
public String getUnsecuredImagefolder()
public String getUnsecuredFolderPath()
public String getUnsecuredWebappUrl()
public String getUnsubscriptionKey(String strEmail)
strEmail
- The email to get the unsubscription key of.public void modifySectionNumber(int nOldSectionNumber, int nNewSectionNumber, int nTemplateId)
nOldSectionNumber
- The old number of sectionsnNewSectionNumber
- The new number of sectionsnTemplateId
- The id of the templatepublic void copyExistingNewsletter(NewsLetter newsletter, fr.paris.lutece.portal.business.user.AdminUser user, Locale locale)
newsletter
- newsletter to copyuser
- the current userlocale
- The localeCopyright © 2019 City of Paris. All rights reserved.