Klasse MailPlugin

java.lang.Object
org.imixs.workflow.engine.plugins.AbstractPlugin
org.imixs.workflow.engine.plugins.MailPlugin
Alle implementierten Schnittstellen:
Plugin

public class MailPlugin extends AbstractPlugin
This plug-in supports a Mail interface to send a email to a list of recipients. The mail content can be defined by the corresponding BPMN event. The content of the email can either be plain text or HTML. The plug-in uses a JNID messaging session named 'org.imixs.workflow.mail'. The JNDI resource can be customized by the deployment constructor. The e-mail message can be canceled by the application or another plug-in by setting the attribute keyMailInactive=true
Autor:
Ralph Soika
  • Felddetails

  • Konstruktordetails

    • MailPlugin

      public MailPlugin()
  • Methodendetails

    • run

      public ItemCollection run(ItemCollection documentContext, ItemCollection documentActivity) throws PluginException
      The run method creates a mailMessage object if recipients are defined by the corresponding BPMN event. The mail message will finally be send in the close method. This mechanism avoids that a mail is send before all plug-ins were processed correctly.
      Parameter:
      documentContext - the workitem to be processed
      documentActivity - the workflow event containing the processing instructions
      Gibt zurück:
      updated workitem for further processing
      Löst aus:
      PluginException
    • close

      public void close(boolean rollbackTransaction) throws PluginException
      Send the mail if the object 'mailMessage' is not null. The method lookups the mail session from the session context.
      Angegeben von:
      close in Schnittstelle Plugin
      Setzt außer Kraft:
      close in Klasse AbstractPlugin
      Parameter:
      rollbackTransaction - indicates if the current transaction will be rolled back.
      Löst aus:
      PluginException
    • getFrom

      public String getFrom(ItemCollection documentContext, ItemCollection documentActivity)
      Computes the sender name. A sender can be defined by the event property 'namMailFrom' or by the system property 'mail.defaultSender'. If no sender is defined, the method takes the current username. This method can be overwritten by subclasses.
      Parameter:
      documentContext -
      documentActivity -
      Gibt zurück:
      String - mail seder
    • getReplyTo

      public String getReplyTo(ItemCollection documentContext, ItemCollection documentActivity)
      Computes the replyTo address from current workflow activity. This method can be overwritten by subclasses.
      Parameter:
      documentContext -
      documentActivity -
      Gibt zurück:
      String - replyTo address
    • getSubject

      public String getSubject(ItemCollection documentContext, ItemCollection documentActivity) throws PluginException
      Computes the mail subject from the current workflow activity. This method can be overwritten by subclasses.
      Parameter:
      documentContext -
      documentActivity -
      Gibt zurück:
      String - mail subject
      Löst aus:
      PluginException
    • getRecipients

      public List<String> getRecipients(ItemCollection documentContext, ItemCollection documentActivity)
      Computes the mail Recipients from the current workflow activity. This method can be overwritten by subclasses.
      Parameter:
      documentContext -
      documentActivity -
      Gibt zurück:
      String list of Recipients
    • getRecipientsCC

      public List<String> getRecipientsCC(ItemCollection documentContext, ItemCollection documentActivity)
      Computes the mail RecipientsCC from the current workflow activity. This method can be overwritten by subclasses.
      Parameter:
      documentContext -
      documentActivity -
      Gibt zurück:
      String list of Recipients
    • getRecipientsBCC

      public List<String> getRecipientsBCC(ItemCollection documentContext, ItemCollection documentActivity)
      Computes the mail RecipientsBCC from the current workflow activity. This method can be overwritten by subclasses.
      Parameter:
      documentContext -
      documentActivity -
      Gibt zurück:
      String list of Recipients
    • getBody

      public String getBody(ItemCollection documentContext, ItemCollection documentActivity) throws PluginException
      Computes the mail body from the current workflow event. The method also updates the internal flag HTMLMail to indicate if the mail is send as HTML mail. In case the content contains a XSL Template, the template will be processed with the current document structure. The method can be overwritten by subclasses.
      Parameter:
      documentContext -
      documentActivity -
      Gibt zurück:
      String - mail subject
      Löst aus:
      PluginException
    • transformXSLBody

      public String transformXSLBody(ItemCollection documentContext, String xslTemplate) throws PluginException
      This method performs a XSL transformation based on the current Mail Body text. The xml source is generated form the current document context. encoding is set to UTF-8
      Gibt zurück:
      translated email body
      Löst aus:
      PluginException
    • initMailMessage

      public void initMailMessage() throws jakarta.mail.internet.AddressException, jakarta.mail.MessagingException
      initializes a new mail Message object
      Löst aus:
      jakarta.mail.internet.AddressException
      jakarta.mail.MessagingException
    • getInternetAddress

      public jakarta.mail.internet.InternetAddress getInternetAddress(String aAddr) throws jakarta.mail.internet.AddressException
      This method creates an InternetAddress from a string. If the string has illegal characters like whitespace the string will be surrounded with "". The method can be overwritten by subclasses to return a different mail-address name or lookup a mail attribute in a directory.
      Parameter:
      aAddr - string
      Gibt zurück:
      InternetAddress
      Löst aus:
      jakarta.mail.internet.AddressException
    • getMailSession

      public jakarta.mail.Session getMailSession()
      This method returns the mail session object.
    • getMailMessage

      public jakarta.mail.Message getMailMessage()
    • getMultipart

      public jakarta.mail.Multipart getMultipart()
    • isHTMLMail

      public boolean isHTMLMail()
      Return true if the mail body contains HTML content.
      Gibt zurück:
    • getCharSet

      public String getCharSet()
    • setCharSet

      public void setCharSet(String charSet)
    • getContentType

      public String getContentType()
      This method returns a string representing the mail content type. The content type depends on the content of the mail body (html or plaintext) and contains optional the character set. If the mail is a HTML mail then the returned string contains 'text/html' otherwise it will contain 'text/plain'. The content
      Gibt zurück: