Package org.ametys.core.ui.mail
Class StandardMailBodyHelper.MailBodyBuilder
java.lang.Object
org.ametys.core.ui.mail.StandardMailBodyHelper.MailBodyBuilder
- Enclosing class:
- StandardMailBodyHelper
Implements the builder pattern for creating and sending emails.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
Record for an user input from a non-authenticated userstatic final record
Record for an user input -
Method Summary
Modifier and TypeMethodDescriptionaddMessage
(String message) Add a new messageaddMessage
(I18nizableText message) Add a new messageaddUnauthenticatedUserInput
(StandardMailBodyHelper.MailBodyBuilder.UnauthenticatedUserInput unauthenticatedUserInput) Add an user input from a non-authenticated userAdd an user inputbuild()
Build the body of the email as HTMLtoJson()
Get the JSON representation of the email ingredientswithDetails
(I18nizableText detailsTitle, String detailsText, boolean technical) Set details or additional information to display in the mailwithDetails
(I18nizableText detailsTitle, I18nizableText detailsText, boolean technical) Set details or additional information to display in the mailwithFooterBottomText
(String footerText) Set the text to display at footer bottom such as "Autogenerated email.withFooterBottomText
(I18nizableText footerText) Set the text to display at footer bottom such as "Autogenerated email.withFooterLink
(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
(String message) Set the main messagewithMessage
(I18nizableText message) Set the main messageSet the titlewithTitle
(I18nizableText title) Set the titlewithUnauthenticatedUserInput
(StandardMailBodyHelper.MailBodyBuilder.UnauthenticatedUserInput unauthenticatedUserInput) Add an user input from a non-authenticated userwithUnauthenticatedUserInput
(StandardMailBodyHelper.MailBodyBuilder.UnauthenticatedUserInput unauthenticatedUserInput, I18nizableText userInputHeader) Add an user input from a non-authenticated userSet the user actionwithUserInput
(StandardMailBodyHelper.MailBodyBuilder.UserInput userInput, I18nizableText userInputHeader) Set the user actionwithUserInputHeader
(I18nizableText userInputHeader) Set the user action
-
Method Details
-
withLanguage
Set the language- Parameters:
lang
- the language- Returns:
- this builder
-
withTitle
Set the title- Parameters:
title
- the title asI18nizableText
- Returns:
- this builder
-
withTitle
Set the title- Parameters:
title
- the title as String- Returns:
- this builder
-
withMessage
Set the main message- Parameters:
message
- the message 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 asI18nizableText
- Returns:
- this builder
-
addMessage
Add a new message- Parameters:
message
- the message as String- Returns:
- this builder
-
withLink
Add a main link to be displayed as a button- Parameters:
linkUrl
- the link urllinkText
- the link text- Returns:
- this builder
-
withUserInputHeader
Set the user action- Parameters:
userInputHeader
- The header text for user input(s)- Returns:
- this builder
-
withUserInput
public StandardMailBodyHelper.MailBodyBuilder withUserInput(StandardMailBodyHelper.MailBodyBuilder.UserInput userInput) Set the user action- Parameters:
userInput
- the user action such as a comment- Returns:
- this builder
-
withUserInput
public StandardMailBodyHelper.MailBodyBuilder withUserInput(StandardMailBodyHelper.MailBodyBuilder.UserInput userInput, I18nizableText userInputHeader) Set the user action- Parameters:
userInput
- the user action such as a commentuserInputHeader
- The header text for user input- Returns:
- this builder
-
addUserInput
public StandardMailBodyHelper.MailBodyBuilder addUserInput(StandardMailBodyHelper.MailBodyBuilder.UserInput userInput) Add an user input- Parameters:
userInput
- the user input such as a comment- Returns:
- this builder
-
withUnauthenticatedUserInput
public StandardMailBodyHelper.MailBodyBuilder withUnauthenticatedUserInput(StandardMailBodyHelper.MailBodyBuilder.UnauthenticatedUserInput unauthenticatedUserInput, I18nizableText userInputHeader) Add an user input from a non-authenticated user- Parameters:
unauthenticatedUserInput
- the input such as a commentuserInputHeader
- The header text for user input as String orI18nizableText
- Returns:
- this builder
-
withUnauthenticatedUserInput
public StandardMailBodyHelper.MailBodyBuilder withUnauthenticatedUserInput(StandardMailBodyHelper.MailBodyBuilder.UnauthenticatedUserInput unauthenticatedUserInput) Add an user input from a non-authenticated user- Parameters:
unauthenticatedUserInput
- the input such as a comment- Returns:
- this builder
-
addUnauthenticatedUserInput
public StandardMailBodyHelper.MailBodyBuilder addUnauthenticatedUserInput(StandardMailBodyHelper.MailBodyBuilder.UnauthenticatedUserInput unauthenticatedUserInput) Add an user input from a non-authenticated user- Parameters:
unauthenticatedUserInput
- the input such as a comment- Returns:
- this builder
-
withDetails
public StandardMailBodyHelper.MailBodyBuilder withDetails(I18nizableText detailsTitle, String detailsText, boolean technical) Set details or additional information to display in the mail- Parameters:
detailsTitle
- the details titledetailsText
- the details texttechnical
- true if details are technical details (such as an error stack trace, script result, ...)- Returns:
- this builder
-
withDetails
public StandardMailBodyHelper.MailBodyBuilder withDetails(I18nizableText detailsTitle, I18nizableText detailsText, boolean technical) Set details or additional information to display in the mail- Parameters:
detailsTitle
- the details titledetailsText
- the details texttechnical
- true if details are technical details (such as an error stack trace, script result, ...)- 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
-