Package org.ametys.plugins.forms.helper
Class FormMailHelper
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.forms.helper.FormMailHelper
- All Implemented Interfaces:
LogEnabled
,Component
,Contextualizable
,Serviceable
public class FormMailHelper
extends AbstractLogEnabled
implements Serviceable, Component, Contextualizable
The helper for form mail dialog
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The type of limitation for the mail -
Field Summary
Modifier and TypeFieldDescriptionprotected Context
The contextprotected static final String
Pattern for adding entry in acknowledgement of receipt if present in bodyprotected FormAdminMailsHelper
The form admin mail helperprotected FormDAO
The analyse of files for virus helperprotected I18nUtils
I18n Utilsprotected AmetysObjectResolver
Ametys object resolver.protected SourceResolver
The source resolver.protected UserManager
The user managerstatic final String
The request key to ignore rightstatic final String
The param key for read restriction enablestatic final String
The value for entry user in the receiver comboboxstatic final String
The empty value in the receiver comboboxstatic final String
Avalon ROLE. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<SendMailHelper.NamedStream>
Get the files of a user input.protected String
_getFormURI
(Form form, String language) Get the form page URIvoid
contextualize
(Context context) String[]
getAdminEmails
(Form form, FormEntry entry) Get all the email addresses from manual entry and/or a form fieldGet the fields with email regex constraint so they can be used as receivers address for form admin mailgetAvailableReceiverFields
(String formId) Get the fields with email regex constraint so they can be used as receivers address for form receipt mailgetMail
(String resource, FormEntry entry, Map<String, Object> additionalParameters, boolean withReadingRestriction) Get a mail pipeline's content.getQuestionWithMail
(String formId) Get the list of questions which return a mailgetReceiver
(FormEntry entry, Optional<String> receiverPath) Get the receiver from the entryvoid
sendEmailsForAdmin
(Form form, FormEntry entry, String[] adminEmails) Send the notification emails.void
sendInvitationMails
(Form form, List<User> users, String message) Send invitation mails to the usersvoid
sendLimitationReachedMailForAdmin
(FormEntry entry, String[] adminEmails, FormMailHelper.LimitationMailType limitationType) Send limitation mail when the limit is reachedvoid
sendOutOfQueueMail
(Form form, FormEntry entry) Send mail when the form entry if out of the queuevoid
sendReceiptEmail
(Form form, FormEntry entry) Send the receipt email.void
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon ROLE. -
READ_RESTRICTION_ENABLE
The param key for read restriction enable- See Also:
-
RECEIVER_COMBOBOX_ENTRY_USER_VALUE
The value for entry user in the receiver combobox- See Also:
-
RECEIVER_COMBOBOX_INPUT_ONLY
The empty value in the receiver combobox- See Also:
-
IGNORE_RIGHT_KEY
The request key to ignore right- See Also:
-
_FORM_ENTRY_PATTERN
Pattern for adding entry in acknowledgement of receipt if present in body- See Also:
-
_resolver
Ametys object resolver. -
_i18nUtils
I18n Utils -
_userManager
The user manager -
_sourceResolver
The source resolver. -
_context
The context -
_formDAO
The analyse of files for virus helper -
_formAdminMailsHelper
The form admin mail helper
-
-
Constructor Details
-
FormMailHelper
public FormMailHelper()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
getAvailableAdminReceiverFields
Get the fields with email regex constraint so they can be used as receivers address for form admin mail- Parameters:
formId
- Id of the form- Returns:
- a map of the form question, key is the question id,value is the question title
-
getAvailableReceiverFields
Get the fields with email regex constraint so they can be used as receivers address for form receipt mail- Parameters:
formId
- Id of the form- Returns:
- a map of the form question, key is the question id,value is the question title
-
getQuestionWithMail
Get the list of questions which return a mail- Parameters:
formId
- the form id- Returns:
- the list of questions
-
getAdminEmails
Get all the email addresses from manual entry and/or a form field- Parameters:
form
- the formentry
- the last entry- Returns:
- an array of all the admin emails
-
getReceiver
Get the receiver from the entry- Parameters:
entry
- the entryreceiverPath
- the path to get receiver- Returns:
- the receiver from the entry
-
sendEmailsForAdmin
Send the notification emails.- Parameters:
form
- the form.entry
- the user input.adminEmails
- list of email address where to send the notification
-
sendLimitationReachedMailForAdmin
public void sendLimitationReachedMailForAdmin(FormEntry entry, String[] adminEmails, FormMailHelper.LimitationMailType limitationType) Send limitation mail when the limit is reached- Parameters:
entry
- the form entryadminEmails
- list of email address where to send the notificationlimitationType
- the type of limitation
-
sendReceiptEmail
Send the receipt email.- Parameters:
form
- the form.entry
- the current entry
-
sendOutOfQueueMail
Send mail when the form entry if out of the queue- Parameters:
form
- the formentry
- the form entry
-
sendInvitationMails
Send invitation mails to the users- Parameters:
form
- the formusers
- the users to receive the mailmessage
- the invitation message
-
_getFormURI
Get the form page URI- Parameters:
form
- the formlanguage
- the language- Returns:
- the form page URI
-
getMail
public String getMail(String resource, FormEntry entry, Map<String, Object> additionalParameters, boolean withReadingRestriction) throws IOExceptionGet a mail pipeline's content.- Parameters:
resource
- the mail resource pipelineentry
- the user input.additionalParameters
- the additional parameterswithReadingRestriction
-true
to enable reading restriction for form data in the mail- Returns:
- the mail content.
- Throws:
IOException
- if an error occurs.
-
_getFiles
Get the files of a user input.- Parameters:
form
- The current formentry
- The current entry- Returns:
- the files submitted by the user.
-