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
Nested ClassesModifier and TypeClassDescriptionstatic enumThe type of limitation for the mail -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ContextThe contextprotected static final StringPattern for adding entry in acknowledgement of receipt if present in bodyprotected FormDAOThe analyse of files for virus helperprotected I18nUtilsI18n Utilsprotected AmetysObjectResolverAmetys object resolver.protected SourceResolverThe source resolver.protected UserManagerThe user managerstatic final StringThe request key to ignore rightstatic final StringThe param key for read restriction enablestatic final StringThe value for entry user in the receiver comboboxstatic final StringAvalon ROLE. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<SendMailHelper.NamedStream>Get the files of a user input.voidcontextualize(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 entryvoidsendEmailsForAdmin(Form form, FormEntry entry, String[] adminEmails) Send the notification emails.voidsendLimitationReachedMailForAdmin(FormEntry entry, String[] adminEmails, FormMailHelper.LimitationMailType limitationType) Send limitation mail when the limit is reachedvoidsendOutOfQueueMail(Form form, FormEntry entry) Send mail when the form entry if out of the queuevoidsendReceiptEmail(Form form, FormEntry entry) Send the receipt email.voidservice(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:
servicein interfaceServiceable- Throws:
ServiceException
-
contextualize
- Specified by:
contextualizein 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-trueto 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.
-