Class EmailNotifier
- java.lang.Object
-
- lumis.portal.activitystream.notifier.email.EmailNotifier
-
- All Implemented Interfaces:
IActivityUserNotifier
@StableMinor(version="16.0", sinceVersion="8.2") public class EmailNotifier extends java.lang.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: 25808 $ $Date: 2023-07-04 15:20:55 -0300 (Tue, 04 Jul 2023) $
-
-
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, java.util.Collection<UserConfig> users, java.util.Locale emailLocale)
Creates anIMultipleMail
from theActivityDocument.IActivity
.protected java.lang.String
getEmailBody(ActivityDocument.IActivity activity, java.util.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 java.util.Collection<IMailDestination>
getEmailDestinations(ActivityDocument.IActivity activity, java.util.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 java.lang.String
getEmailSubject(ActivityDocument.IActivity activity, java.util.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 java.util.Locale
getLocaleForEmail(ActivityDocument.IActivity activity)
Returns the locale to localize the emailvoid
notify(ActivityDocument activityDocument, java.util.Collection<UserConfig> users)
Sends a notification tousers
about the activity that has occurred.
-
-
-
Method Detail
-
notify
public void notify(ActivityDocument activityDocument, java.util.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, java.util.Collection<UserConfig> users, java.util.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 java.lang.String getEmailSubject(ActivityDocument.IActivity activity, java.util.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 java.lang.String getEmailBody(ActivityDocument.IActivity activity, java.util.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 java.util.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 java.util.Collection<IMailDestination> getEmailDestinations(ActivityDocument.IActivity activity, java.util.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
-
-