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
Nested ClassesModifier and TypeClassDescriptionstatic final record
Record for an user input from a non-authenticated userstatic final record
A section of unauthenticated user inputsstatic final record
Record for an user inputstatic final record
A section of user inputs -
Method Summary
Modifier and TypeMethodDescriptionaddMessage
(String message) Add a new messageaddMessage
(I18nizableText message) Add a new messageaddUnauthenticatedUserInput
(List<StandardMailBodyHelper.MailBodyBuilder.UnauthenticatedUserInput> unauthenticatedUserInputs) Add users inputs from non-authenticated usersaddUnauthenticatedUserInput
(List<StandardMailBodyHelper.MailBodyBuilder.UnauthenticatedUserInput> unauthenticatedUserInputs, I18nizableText userInputHeader) Add users inputs from non-authenticated usersAdd user inputsaddUserInputs
(List<StandardMailBodyHelper.MailBodyBuilder.UserInput> userInputs, I18nizableText userInputHeader) Add user inputsbuild()
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 titlewithUnauthenticatedUserInputs
(List<StandardMailBodyHelper.MailBodyBuilder.UnauthenticatedUserInput> unauthenticatedUserInputs) Add an user input from a non-authenticated userwithUnauthenticatedUserInputs
(List<StandardMailBodyHelper.MailBodyBuilder.UnauthenticatedUserInput> unauthenticatedUserInputs, I18nizableText userInputHeader) Add users inputs from non-authenticated usersSet the user actionwithUserInputs
(List<StandardMailBodyHelper.MailBodyBuilder.UserInput> userInputs, 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
-
withUserInputs
public StandardMailBodyHelper.MailBodyBuilder withUserInputs(List<StandardMailBodyHelper.MailBodyBuilder.UserInput> userInputs) Set the user action- Parameters:
userInputs
- the users actions such as comments- Returns:
- this builder
-
withUserInputs
public StandardMailBodyHelper.MailBodyBuilder withUserInputs(List<StandardMailBodyHelper.MailBodyBuilder.UserInput> userInputs, I18nizableText userInputHeader) Set the user action- Parameters:
userInputs
- the users actions such as commentsuserInputHeader
- The header text for user input- Returns:
- this builder
-
addUserInputs
public StandardMailBodyHelper.MailBodyBuilder addUserInputs(List<StandardMailBodyHelper.MailBodyBuilder.UserInput> userInputs) Add user inputs- Parameters:
userInputs
- the users inputs such as comments- Returns:
- this builder
-
addUserInputs
public StandardMailBodyHelper.MailBodyBuilder addUserInputs(List<StandardMailBodyHelper.MailBodyBuilder.UserInput> userInputs, I18nizableText userInputHeader) Add user inputs- Parameters:
userInputs
- the users inputs such as commentsuserInputHeader
- The header text for user input- Returns:
- this builder
-
withUnauthenticatedUserInputs
public StandardMailBodyHelper.MailBodyBuilder withUnauthenticatedUserInputs(List<StandardMailBodyHelper.MailBodyBuilder.UnauthenticatedUserInput> unauthenticatedUserInputs) Add an user input from a non-authenticated user- Parameters:
unauthenticatedUserInputs
- the inputs such as comments- Returns:
- this builder
-
withUnauthenticatedUserInputs
public StandardMailBodyHelper.MailBodyBuilder withUnauthenticatedUserInputs(List<StandardMailBodyHelper.MailBodyBuilder.UnauthenticatedUserInput> unauthenticatedUserInputs, I18nizableText userInputHeader) Add users inputs from non-authenticated users- Parameters:
unauthenticatedUserInputs
- the inputs such as commentsuserInputHeader
- The header text for user input as String orI18nizableText
- Returns:
- this builder
-
addUnauthenticatedUserInput
public StandardMailBodyHelper.MailBodyBuilder addUnauthenticatedUserInput(List<StandardMailBodyHelper.MailBodyBuilder.UnauthenticatedUserInput> unauthenticatedUserInputs) Add users inputs from non-authenticated users- Parameters:
unauthenticatedUserInputs
- the inputs such as comments- Returns:
- this builder
-
addUnauthenticatedUserInput
public StandardMailBodyHelper.MailBodyBuilder addUnauthenticatedUserInput(List<StandardMailBodyHelper.MailBodyBuilder.UnauthenticatedUserInput> unauthenticatedUserInputs, I18nizableText userInputHeader) Add users inputs from non-authenticated users- Parameters:
unauthenticatedUserInputs
- the inputs such as commentsuserInputHeader
- The header text for user input as String orI18nizableText
- 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
-