Package com.groiss.smartclient.mail
Interface MailActionsHandler
public interface MailActionsHandler
Handler for manipulating parts handled by email tab.
This interface is divided into parts for
- displaying the Compose window and
- sending mails.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
Possibility to add an additional <script> block to HTML's head elementdefault void
addSelectorForComposeWindow
(Element toSelect, Element ccSelect, Element bccSelect) Possibility to enrich the placeholder selectors for recipient types TO, CC and BCC with an own functionality.default void
afterMailSent
(String actionId, MessageTemplate mt, DMSDocForm email, boolean isSent, HttpServletRequest req) This method is called after the mail has been sent the the email object (parameter "email") has been created.default void
beforeMailSent
(String actionId, MessageTemplate mt, DMSFolder mailFolder, Pair<FormType, String> emailFtInfo, HttpServletRequest req) This method is called before the mail is sent and before the permission check is performed, if the user is able to create an email object (info available in parameter "emailFtInfo") and is able to store this object in appropriateDMSFolder
"mailFolder".default JSONArray
getMailListAsJson
(Persistent ctx, FormType emailFt) This method can be used for manipulating the mail list in the Mail tab.default void
initForComposeWindow
(String actionId, Persistent ctx, HttpServletRequest req) Method containing the initial data for compose windowmodifyDMSAttachments
(List<DMSObject> attachments, Message msg) Method to modify given list of DMS attachments that should be filled in Compose window.Method to modify given list ofFile
attachments that should be filled in Compose window.modifyMailBody
(Pair<String, String> mailBody, Message msg) Method to modify given mail body (text/plain and text/html) that should be filled in Compose window.default Map<Message.RecipientType,
String> modifyRecipients
(Map<Message.RecipientType, String> recipients, Message msg) Method to modify given recipients that should be filled in Compose window.default String
modifySenderAddress
(String sender) Method to modify given sender address that should be filled in Compose window.default String
modifySubject
(String subject, Message msg) Method to modify given subject that should be filled in Compose window.
-
Method Details
-
initForComposeWindow
Method containing the initial data for compose window- Parameters:
actionId
- the id of the action defined in GUI-XML in format<xml-id>.<node-id>
(e.g. in case of default action "compose" the id is "admin.composeSC")ctx
- either aProcessInstance
or aDMSFolder
where the new composed mail should be storedreq
- theHttpServletRequest
containing all data which are transferred from client to server
-
modifyRecipients
default Map<Message.RecipientType,String> modifyRecipients(Map<Message.RecipientType, String> recipients, Message msg) Method to modify given recipients that should be filled in Compose window.- Parameters:
recipients
- by default aHashMap
containing theMessage.RecipientType
as key and the appropriate recipient email addresses as string value.msg
- the referencedMessage
object; can benull
- Returns:
- a manipulated
Map
of recipients; the default implementation returns the value of parameter "recipients".
-
modifySubject
Method to modify given subject that should be filled in Compose window.- Parameters:
subject
- the subject which should modifiedmsg
- the referencedMessage
object; can benull
- Returns:
- a manipulated subject; the default implementation returns the value of parameter "subject".
-
modifyMailBody
Method to modify given mail body (text/plain and text/html) that should be filled in Compose window. -
modifySenderAddress
Method to modify given sender address that should be filled in Compose window.- Parameters:
sender
- the sender address which should modified; it could benull
or empty, than theMailUtil.getSender()
is used- a
MailBox
object in format <classname>:<oid> - a
User
object in format <classname>:<oid> - a valid email address as
String
- Returns:
- a manipulated sender address; the default implementation returns the value of parameter "address".
-
modifyDMSAttachments
Method to modify given list of DMS attachments that should be filled in Compose window.- Parameters:
attachments
- a list ofDMSObject
that should be modified; this list is nevernull
, but could be empty depending on mail actionmsg
- the referencedMessage
object; can benull
- Returns:
- a manipulated list of
DMSObject
that should be added as DMS attachments; the default implementation returns the value of parameter "attachments".
-
modifyFileAttachments
default List<Pair<String,File>> modifyFileAttachments(List<Pair<String, File>> attachments, Message msg) Method to modify given list ofFile
attachments that should be filled in Compose window.- Parameters:
attachments
- a list of attachments that should be modified asPair
containing the filename as first parameter and theFile
itself as second one; this list is nevernull
, but could be empty depending on mail actionmsg
- the referencedMessage
object; can benull
- Returns:
- a manipulated list of
Pair
that should be added as file attachments; the default implementation returns the value of parameter "attachments".
-
addScriptBlockForComposeWindow
Possibility to add an additional <script> block to HTML's head element- Parameters:
head
- the HTML's head element asElement
-
addSelectorForComposeWindow
Possibility to enrich the placeholder selectors for recipient types TO, CC and BCC with an own functionality. -
beforeMailSent
default void beforeMailSent(String actionId, MessageTemplate mt, DMSFolder mailFolder, Pair<FormType, String> emailFtInfo, HttpServletRequest req) This method is called before the mail is sent and before the permission check is performed, if the user is able to create an email object (info available in parameter "emailFtInfo") and is able to store this object in appropriateDMSFolder
"mailFolder".- Parameters:
actionId
- the id of the action defined in GUI-XML in format<xml-id>.<node-id>
(e.g. in case of default action "compose" the id is "admin.composeSC")mt
- theMessageTemplate
object which is used for sending the mailmailFolder
- theDMSFolder
where the email object should be storedemailFtInfo
- aPair
containing theFormType
as key an the extension as String (by default "eml")req
- theHttpServletRequest
containing all data which are transferred from client to server
-
afterMailSent
default void afterMailSent(String actionId, MessageTemplate mt, DMSDocForm email, boolean isSent, HttpServletRequest req) This method is called after the mail has been sent the the email object (parameter "email") has been created.- Parameters:
actionId
- the id of the action defined in GUI-XML in format<xml-id>.<node-id>
(e.g. in case of default action "compose" the id is "admin.composeSC")mt
- theMessageTemplate
object which was used for sending the mailemail
- the email object asDMSDocForm
where the sentMessage
was stored.isSent
- flag to indicate, if the mail has been sent or not; if theMessage
was put into @enterprise mail-queue this flag has the valuefalse
req
- theHttpServletRequest
containing all data which are transferred from client to server
-
getMailListAsJson
This method can be used for manipulating the mail list in the Mail tab. Each list entry must be a JSONObject which can be determined withMailFunctions.toJSON(DMSDocForm)
, but without "parent" and "hasChildren" attributes that must be defined manually. The following example shows a structure of such aJSONArray
which contains nested elements (= children):[{"_toString":"mailtext (Support ID:52)", "objectId":"com.groiss.dms.impl.Email:4295027131", "mailstatus":"mailqueued", "subj":"mailtext (Support ID:52)", "sender":"sender@company.com", "recipient":"recipient@company.com", "maildate":1519808251000, "avwcreatedat":1519808251000, "replytoid":"<1814437681.6.1519808246976@gi>", "hasAttachments":false, "parent":"root", ====> placeholder which defines that no parent exists "hasChildren":false, }, {"_toString":"Process 34", "hasChildren":true, ====> defines that mails e.g. of a subprocess are available "subj":"Incident 34", "objectId":"<any_obj_class>:<oid1>", "parent":"root" ====> placeholder which defines that no parent exists }, ----- following element is a child of process 34 ----- {"_toString":"mailtext_inc (Support ID:34)", "objectId":"com.groiss.dms.impl.Email:4295027107" "mailstatus":"mailsent", "subj":"mailtext_inc (Support ID:34)", "sender":"sender@company.com", "recipient":"recipient@company.com", "maildate":1519807597000, "avwcreatedat":1519807597000, "replytoid":"<2083146686.2.1519807593244@gi>", "hasAttachments":true, "parent":<oid1>, ====> refers to oid of objectId-attribute of parent entry "hasChildren":false }]
- Parameters:
ctx
- either aProcessInstance
or aDMSFolder
where mails are stored; in case ofProcessInstance
the functionMailFunctions.getEmailsFolder(ProcessInstance, boolean)
can be calledemailFt
- theFormType
for reading the appropriate mail objects- Returns:
- a
JSONArray
containing the mail list for the client; by defaultnull
is returned which indicates that the default mail list loading behavior should be used by Mail tab - Throws:
Exception
-