Class EmailNotifier
- java.lang.Object
-
- lumis.portal.activitystream.notifier.email.EmailNotifier
-
- All Implemented Interfaces:
IActivityUserNotifier
@StableMinor(version="14.2", sinceVersion="8.2") public class EmailNotifier extends Object implements IActivityUserNotifier
Notifies users of the activity by sending an e-mail to the address set onUserConfig.getEmail()
.- Since:
- 8.2.0
- Version:
- $Revision: 24985 $ $Date: 2022-05-02 23:04:30 -0300 (Mon, 02 May 2022) $
-
-
Constructor Summary
Constructors Constructor Description EmailNotifier()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected IMultipleMail
createMail(ActivityDocument.IActivity activity, Collection<UserConfig> users, Locale emailLocale)
Creates anIMultipleMail
from theActivityDocument.IActivity
.protected String
getEmailBody(ActivityDocument.IActivity activity, Locale locale)
Generate an e-mail body for the activity.
The default implementation gets the localized STR_EMAIL_HTML_BODY, and runs the EL evaluator to return the complete body HTML.protected Collection<IMailDestination>
getEmailDestinations(ActivityDocument.IActivity activity, Collection<UserConfig> users)
Generate a list of email destinations to be added to an email of the activity.
the default implementation adds all users that have an email to the list.protected String
getEmailSubject(ActivityDocument.IActivity activity, Locale locale)
Generate an e-mail subject for the activity.
The default implementation gets the localized STR_EMAIL_SUBJECT, and runs the EL evaluator to return the complete subject.protected Locale
getLocaleForEmail(ActivityDocument.IActivity activity)
Returns the locale to localize the emailvoid
notify(ActivityDocument activityDocument, Collection<UserConfig> users)
Sends a notification tousers
about the activity that has occurred.
-
-
-
Method Detail
-
notify
public void notify(ActivityDocument activityDocument, Collection<UserConfig> users) throws PortalException
Description copied from interface:IActivityUserNotifier
Sends a notification tousers
about the activity that has occurred.- Specified by:
notify
in interfaceIActivityUserNotifier
- Parameters:
activityDocument
- the document of the activity that has occurred.users
- the users to receive the notification.- Throws:
PortalException
-
createMail
protected IMultipleMail createMail(ActivityDocument.IActivity activity, Collection<UserConfig> users, Locale emailLocale) throws PortalException
Creates anIMultipleMail
from theActivityDocument.IActivity
.
The default implementation requests a newIMultipleMail
from theISendMailManager
, and sets the subject by callinggetEmailSubject(IActivity, Locale)
, the body by callinggetEmailBody(IActivity, Locale)
and the source component is set to "Activity Stream E-Mail Notifier".- Parameters:
activity
- the activity to generate the notification e-mail forusers
- the users that should receive the email.emailLocale
- the Locale to for e-mail localization.- Returns:
- a
IMultipleMail
with all informations set. - Throws:
PortalException
- Since:
- 8.2.0
-
getEmailSubject
protected String getEmailSubject(ActivityDocument.IActivity activity, Locale locale) throws PortalException
Generate an e-mail subject for the activity.
The default implementation gets the localized STR_EMAIL_SUBJECT, and runs the EL evaluator to return the complete subject.- Parameters:
activity
- The activity to use when creating the subjectlocale
- The locale for string localization- Returns:
- The subject for an email
- Throws:
PortalException
- Since:
- 8.2.0
-
getEmailBody
protected String getEmailBody(ActivityDocument.IActivity activity, Locale locale) throws PortalException
Generate an e-mail body for the activity.
The default implementation gets the localized STR_EMAIL_HTML_BODY, and runs the EL evaluator to return the complete body HTML.- Parameters:
activity
- The activity to use when creating the bodylocale
- The locale for string localization- Returns:
- A HTML for the e-mail body.
- Throws:
PortalException
- Since:
- 8.2.0
-
getLocaleForEmail
protected Locale getLocaleForEmail(ActivityDocument.IActivity activity) throws PortalException
Returns the locale to localize the email- Parameters:
activity
- the activity that will have the email generated- Returns:
- a locale
- Throws:
PortalException
- Since:
- 8.2.0
-
getEmailDestinations
protected Collection<IMailDestination> getEmailDestinations(ActivityDocument.IActivity activity, Collection<UserConfig> users) throws PortalException
Generate a list of email destinations to be added to an email of the activity.
the default implementation adds all users that have an email to the list.- Parameters:
activity
- the activity for the destinationusers
- the list of users to add to the destination- Returns:
- a list of email destinations
- Throws:
PortalException
- Since:
- 8.2.0
-
-