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 Details

    • initForComposeWindow

      default void initForComposeWindow(String actionId, Persistent ctx, HttpServletRequest req)
      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 a ProcessInstance or a DMSFolder where the new composed mail should be stored
      req - the HttpServletRequest 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 a HashMap containing the Message.RecipientType as key and the appropriate recipient email addresses as string value.
      msg - the referenced Message object; can be null
      Returns:
      a manipulated Map of recipients; the default implementation returns the value of parameter "recipients".
    • modifySubject

      default String modifySubject(String subject, Message msg)
      Method to modify given subject that should be filled in Compose window.
      Parameters:
      subject - the subject which should modified
      msg - the referenced Message object; can be null
      Returns:
      a manipulated subject; the default implementation returns the value of parameter "subject".
    • modifyMailBody

      default Pair<String,String> 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.
      Parameters:
      mailBody - the mail body which should modified
      msg - the referenced Message object; can be null
      Returns:
      a manipulated mail body as Pair whereby the key is the "text/plain" and the value "text/html" part; the default implementation returns the value of parameter "mailBody".
    • modifySenderAddress

      default String modifySenderAddress(String sender)
      Method to modify given sender address that should be filled in Compose window.
      Parameters:
      sender - the sender address which should modified; it could be
      Returns:
      a manipulated sender address; the default implementation returns the value of parameter "address".
    • modifyDMSAttachments

      default List<DMSObject> modifyDMSAttachments(List<DMSObject> attachments, Message msg)
      Method to modify given list of DMS attachments that should be filled in Compose window.
      Parameters:
      attachments - a list of DMSObject that should be modified; this list is never null, but could be empty depending on mail action
      msg - the referenced Message object; can be null
      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 of File attachments that should be filled in Compose window.
      Parameters:
      attachments - a list of attachments that should be modified as Pair containing the filename as first parameter and the File itself as second one; this list is never null, but could be empty depending on mail action
      msg - the referenced Message object; can be null
      Returns:
      a manipulated list of Pair that should be added as file attachments; the default implementation returns the value of parameter "attachments".
    • addScriptBlockForComposeWindow

      default void addScriptBlockForComposeWindow(Element head)
      Possibility to add an additional <script> block to HTML's head element
      Parameters:
      head - the HTML's head element as Element
    • addSelectorForComposeWindow

      default 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.
      Parameters:
      toSelect - the placeholder element as Element of recipient type TO (<span id="toselect"/>)
      ccSelect - the placeholder element as Element of recipient type CC (<span id="ccselect"/>)
      bccSelect - the placeholder element as Element of recipient type BCC (<span id="bccselect"/>)
    • 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 appropriate DMSFolder "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 - the MessageTemplate object which is used for sending the mail
      mailFolder - the DMSFolder where the email object should be stored
      emailFtInfo - a Pair containing the FormType as key an the extension as String (by default "eml")
      req - the HttpServletRequest 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 - the MessageTemplate object which was used for sending the mail
      email - the email object as DMSDocForm where the sent Message was stored.
      isSent - flag to indicate, if the mail has been sent or not; if the Message was put into @enterprise mail-queue this flag has the value false
      req - the HttpServletRequest containing all data which are transferred from client to server
    • getMailListAsJson

      default JSONArray getMailListAsJson(Persistent ctx, FormType emailFt) throws Exception
      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 with MailFunctions.toJSON(DMSDocForm), but without "parent" and "hasChildren" attributes that must be defined manually. The following example shows a structure of such a JSONArray 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 a ProcessInstance or a DMSFolder where mails are stored; in case of ProcessInstance the function MailFunctions.getEmailsFolder(ProcessInstance, boolean) can be called
      emailFt - the FormType for reading the appropriate mail objects
      Returns:
      a JSONArray containing the mail list for the client; by default null is returned which indicates that the default mail list loading behavior should be used by Mail tab
      Throws:
      Exception