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 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
Avalon ROLE. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<SendMailHelper.NamedStream>
Get the files of a user input.void
contextualize
(Context context) getAvailableReceiverFields
(String formId) Get the fields with email regex constraint so they can be used as receivers address for form 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
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:
-
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
-
-
Constructor Details
-
FormMailHelper
public FormMailHelper()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
getAvailableReceiverFields
Get the fields with email regex constraint so they can be used as receivers address for form 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
-
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
-
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.
-