Interface IScriptedMessagePreProcessingTaskUtils


public interface IScriptedMessagePreProcessingTaskUtils
Utility class used while executing velocity based pre-processing task.
Author:
Fernado Boucquez
  • Method Summary

    Modifier and Type
    Method
    Description
    getBody(javax.mail.internet.MimeMessage message)
    Extracts the body, text first, html if text is not provided.
    getHeader(javax.mail.internet.MimeMessage message, String name)
    Returns the header in the message with the give name.
    getHeader(javax.mail.internet.MimeMessage message, String name, boolean includingSubparts)
    Returns the header in the message with the give name.
    getHeaderFromBody(javax.mail.internet.MimeMessage message, String name)
    A simple utility method to get a header from the body, for example in a forwarded email.
    getHeaderOrCreate(javax.mail.internet.MimeMessage message, String name)
    Returns the header in the message with the give name.
    getHeaderOrCreate(javax.mail.internet.MimeMessage message, String name, boolean includingSubparts)
    Returns the header in the message with the give name including sub-parts if it's parameter true.
    getHeaders(javax.mail.internet.MimeMessage message)
    Returns top level headers of the message.
    getHeaders(javax.mail.internet.MimeMessage message, boolean includingSubparts)
    Returns headers of the message.
    getHeaders(javax.mail.internet.MimeMessage message, String nameRegex)
    Returns headers of the message filtered by regex.
    getHeaders(javax.mail.internet.MimeMessage message, String nameRegex, boolean includingSubparts)
    Returns headers of the message filtered by regex.
    getHeaderValue(javax.mail.internet.MimeMessage message, String name)
    A simple utility method to load a top header value (multiple values are joined by csv)
    getHeaderValue(javax.mail.internet.MimeMessage message, String name, boolean includingSubparts)
    A simple utility method to load a header value (multiple values are joined by csv)
    boolean
    isForward(javax.mail.internet.MimeMessage message, String... customPrefixes)
    Return if the message is a forwarded message by checking the subject for prefixes like fwd: (case insensitive)
    void
    log(String message)
    Logs the message into the processing report.
  • Method Details

    • getBody

      String getBody(javax.mail.internet.MimeMessage message)
      Extracts the body, text first, html if text is not provided.
      Parameters:
      message - the message
      Returns:
      the body as text or html
    • isForward

      boolean isForward(javax.mail.internet.MimeMessage message, String... customPrefixes)
      Return if the message is a forwarded message by checking the subject for prefixes like fwd: (case insensitive)
      Parameters:
      message - the message
      customPrefixes - the prefixed to be check. If the list is not provided, the system one Fwd:,Fw:,WG:,Doorst:,VL:,TR:,I:,FS:,VS:,VB:,RV:,PD: is used.
      Returns:
      if the message's subject start with one of the prefixes (case insensitive)
    • getHeaderFromBody

      String getHeaderFromBody(javax.mail.internet.MimeMessage message, String name) throws IOException, javax.mail.MessagingException
      A simple utility method to get a header from the body, for example in a forwarded email.
      Parameters:
      message - the message
      name - the header to be extract from the button
      Returns:
      the first value of the header.
      Throws:
      IOException - if there is an error streaming the email into an String.
      javax.mail.MessagingException - if there is an error reading data from the mime email.
    • getHeaderValue

      String getHeaderValue(javax.mail.internet.MimeMessage message, String name)
      A simple utility method to load a top header value (multiple values are joined by csv)
      Parameters:
      message - the message
      name - the header
      Returns:
      the value of the header joined by commas if there are multiple vlaues.
    • getHeaderValue

      String getHeaderValue(javax.mail.internet.MimeMessage message, String name, boolean includingSubparts)
      A simple utility method to load a header value (multiple values are joined by csv)
      Parameters:
      message - the message
      name - the header
      includingSubparts - if subparts must be checked or just top header values.
      Returns:
      the value of the header joined by commas if there are multiple vlaues.
    • getHeaders

      List<IHeaderBean> getHeaders(javax.mail.internet.MimeMessage message)
      Returns top level headers of the message.
      Parameters:
      message - the message
      Returns:
      a list of headers.
    • getHeaders

      List<IHeaderBean> getHeaders(javax.mail.internet.MimeMessage message, boolean includingSubparts)
      Returns headers of the message. If includingSubparts is true, it returns headers in mime sub parts as well.
      Parameters:
      message - the message
      includingSubparts - if true, it include headers in subparts.
      Returns:
      a list of headers.
    • getHeaders

      List<IHeaderBean> getHeaders(javax.mail.internet.MimeMessage message, String nameRegex, boolean includingSubparts)
      Returns headers of the message filtered by regex. If includingSubparts is true, it returns headers in mime sub parts as well.
      Parameters:
      message - the message
      nameRegex - regex used to filter header by name.
      includingSubparts - if true, it include headers in subparts.
      Returns:
      a list of headers.
    • getHeaders

      List<IHeaderBean> getHeaders(javax.mail.internet.MimeMessage message, String nameRegex)
      Returns headers of the message filtered by regex.
      Parameters:
      message - the message
      nameRegex - regex used to filter header by name.
      Returns:
      a list of headers.
    • getHeader

      IHeaderBean getHeader(javax.mail.internet.MimeMessage message, String name)
      Returns the header in the message with the give name. Null if it doesn't exist.
      Parameters:
      message - the message.
      name - the name of the header. Case-insensitive.
      Returns:
      the header or null if it doesn't exist.
    • getHeader

      IHeaderBean getHeader(javax.mail.internet.MimeMessage message, String name, boolean includingSubparts)
      Returns the header in the message with the give name. If includingSubparts is true, method searches sub-parts as well. Null if it doesn't exist.
      Parameters:
      message - the message
      name - the name of the header. Case-insensitive.
      includingSubparts - if the search should include mime sub-parts.
      Returns:
      the header or null if it doesn't exist.
    • getHeaderOrCreate

      IHeaderBean getHeaderOrCreate(javax.mail.internet.MimeMessage message, String name)
      Returns the header in the message with the give name. If it doesn't exist, returns a new header the user can set it's value in the script.
      Parameters:
      message - the message
      name - the name
      Returns:
      the exist header or a new one if it's not found.
    • getHeaderOrCreate

      IHeaderBean getHeaderOrCreate(javax.mail.internet.MimeMessage message, String name, boolean includingSubparts)
      Returns the header in the message with the give name including sub-parts if it's parameter true. If it doesn't exist, returns a new header the user can set it's value in the script.
      Parameters:
      message - the message
      name - the haeader name
      includingSubparts - if the search should include mime sub-parts.
      Returns:
      the exist header or a new one at root message level part if it's not found.
    • log

      void log(String message)
      Logs the message into the processing report.
      Parameters:
      message - the message