Package org.ametys.web.mail
Class ReportActivitiesMailBodyHelper.MailBodyBuilder
java.lang.Object
org.ametys.web.mail.ReportActivitiesMailBodyHelper.MailBodyBuilder
- Enclosing class:
- ReportActivitiesMailBodyHelper
Implements the builder pattern for creating and sending emails.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
Record for an activity -
Method Summary
Modifier and TypeMethodDescriptionAdd an activityaddMessage
(Object message) Add a new messagebuild()
Build the body of the email as HTMLtoJson()
Get the JSON representation of the email ingredientsSet the activitieswithFooterLink
(String linkUrl, I18nizableText linkText) Add a link to be displayed on footerwithFooterLink
(String linkUrl, I18nizableText linkText, String imgPluginName, String imgPath) Add a link to be displayed on footerwithLanguage
(String lang) Set the languagewithLink
(String linkUrl, I18nizableText linkText) Add a main link to be displayed as a buttonwithMessage
(Object message) Set the main messageSet the title
-
Method Details
-
withLanguage
Set the language- Parameters:
lang
- the language- Returns:
- this builder
-
withTitle
Set the title- Parameters:
title
- the title as String orI18nizableText
- Returns:
- this builder
-
withMessage
Set the main message- Parameters:
message
- the message as String orI18nizableText
- Returns:
- this builder
-
addMessage
Add a new message- Parameters:
message
- the message as String orI18nizableText
- Returns:
- this builder
-
withActivities
public ReportActivitiesMailBodyHelper.MailBodyBuilder withActivities(List<ReportActivitiesMailBodyHelper.MailBodyBuilder.Activity> activities) Set the activities- Parameters:
activities
- the activities- Returns:
- this builder
-
addActivity
public ReportActivitiesMailBodyHelper.MailBodyBuilder addActivity(ReportActivitiesMailBodyHelper.MailBodyBuilder.Activity activity) Add an activity- Parameters:
activity
- the activity- Returns:
- this builder
-
withLink
public ReportActivitiesMailBodyHelper.MailBodyBuilder withLink(String linkUrl, I18nizableText linkText) Add a main link to be displayed as a button- Parameters:
linkUrl
- the link urllinkText
- the link text- Returns:
- this builder
-
build
Build the body of the email as HTML- Returns:
- the HTML body
- Throws:
IOException
- if an error occurred when building the email
-
toJson
Get the JSON representation of the email ingredients- Returns:
- the JSON ingredients
-