Klasse MailPlugin
java.lang.Object
org.imixs.workflow.engine.plugins.AbstractPlugin
org.imixs.workflow.engine.plugins.MailPlugin
- Alle implementierten Schnittstellen:
Plugin
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
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringVon Klasse geerbte Felder org.imixs.workflow.engine.plugins.AbstractPlugin
INVALID_ITEMVALUE_FORMAT, INVALID_PROPERTYVALUE_FORMAT -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidclose(boolean rollbackTransaction) Send the mail if the object 'mailMessage' is not null.getBody(ItemCollection documentContext, ItemCollection documentActivity) Computes the mail body from the current workflow event.This method returns a string representing the mail content type.getFrom(ItemCollection documentContext, ItemCollection documentActivity) Computes the sender name.jakarta.mail.internet.InternetAddressgetInternetAddress(String aAddr) This method creates an InternetAddress from a string.jakarta.mail.Messagejakarta.mail.SessionThis method returns the mail session object.jakarta.mail.MultipartgetRecipients(ItemCollection documentContext, ItemCollection documentActivity) Computes the mail Recipients from the current workflow activity.getRecipientsBCC(ItemCollection documentContext, ItemCollection documentActivity) Computes the mail RecipientsBCC from the current workflow activity.getRecipientsCC(ItemCollection documentContext, ItemCollection documentActivity) Computes the mail RecipientsCC from the current workflow activity.getReplyTo(ItemCollection documentContext, ItemCollection documentActivity) Computes the replyTo address from current workflow activity.getSubject(ItemCollection documentContext, ItemCollection documentActivity) Computes the mail subject from the current workflow activity.voidinitializes a new mail Message objectbooleanReturn true if the mail body contains HTML content.run(ItemCollection documentContext, ItemCollection documentActivity) The run method creates a mailMessage object if recipients are defined by the corresponding BPMN event.voidsetCharSet(String charSet) transformXSLBody(ItemCollection documentContext, String xslTemplate) This method performs a XSL transformation based on the current Mail Body text.Von Klasse geerbte Methoden org.imixs.workflow.engine.plugins.AbstractPlugin
getWorkflowContext, getWorkflowService, init, mergeFieldList, setWorkflowService, uniqueList
-
Felddetails
-
ERROR_INVALID_XSL_FORMAT
- Siehe auch:
-
ERROR_MAIL_MESSAGE
- Siehe auch:
-
MAIL_SESSION_NAME
- Siehe auch:
-
CONTENTTYPE_TEXT_PLAIN
- Siehe auch:
-
CONTENTTYPE_TEXT_HTML
- Siehe auch:
-
INVALID_ADDRESS
- Siehe auch:
-
-
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 processeddocumentActivity- the workflow event containing the processing instructions- Gibt zurück:
- updated workitem for further processing
- Löst aus:
PluginException
-
close
Send the mail if the object 'mailMessage' is not null. The method lookups the mail session from the session context.- Angegeben von:
closein SchnittstellePlugin- Setzt außer Kraft:
closein KlasseAbstractPlugin- Parameter:
rollbackTransaction- indicates if the current transaction will be rolled back.- Löst aus:
PluginException
-
getFrom
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
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
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.MessagingExceptioninitializes a new mail Message object- Löst aus:
jakarta.mail.internet.AddressExceptionjakarta.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
-
setCharSet
-
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:
-