[jbpm-commits] JBoss JBPM SVN: r4539 - jbpm4/branches/email/modules/userguide/src/main/docbook/en/modules.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Apr 10 11:04:50 EDT 2009
Author: bradsdavis
Date: 2009-04-10 11:04:49 -0400 (Fri, 10 Apr 2009)
New Revision: 4539
Modified:
jbpm4/branches/email/modules/userguide/src/main/docbook/en/modules/ch09-Emails.xml
Log:
Added custom email example.
Modified: jbpm4/branches/email/modules/userguide/src/main/docbook/en/modules/ch09-Emails.xml
===================================================================
--- jbpm4/branches/email/modules/userguide/src/main/docbook/en/modules/ch09-Emails.xml 2009-04-10 14:54:55 UTC (rev 4538)
+++ jbpm4/branches/email/modules/userguide/src/main/docbook/en/modules/ch09-Emails.xml 2009-04-10 15:04:49 UTC (rev 4539)
@@ -10,9 +10,9 @@
</section>
<section id="scriptableemails">
<title>Producers</title>
- <para>Producers are responsible for creating emails within jBPM. All mail producers implement the <literal>MailProducer</literal> interface.
+ <para>Producers are responsible for creating emails within jBPM. All mail producers implement the <literal>org.jbpm.pvm.internal.email.producer.MailProducer</literal> interface.
Several out-of-the-box implementations have been created to address simple email needs.</para>
- <para>For complex emails or custom generation of attachments, see: <link linkend="customemails">Extension Points: Custom Emails</link>.</para>
+
<section id="standardemailformat">
<title>Standard</title>
<para>Used to send non-scripted text emails.</para>
@@ -51,7 +51,7 @@
<tbody>
<row>
<entry><literal>language</literal></entry>
- <entry>The scripting language used to resolve properties within the subject and textual body.</entry>
+ <entry>The scripting language used to resolve properties within the subject and textual body. If not provided, the default script language is applied.</entry>
</row>
<row>
<entry><literal>subject</literal></entry>
@@ -80,7 +80,7 @@
<tbody>
<row>
<entry><literal>language</literal></entry>
- <entry>The scripting language used to resolve properties within the subject, textual body, and HTML body.</entry>
+ <entry>The scripting language used to resolve properties within the subject, textual body, and HTML body. If not provided, the default script language is applied.</entry>
</row>
<row>
<entry><literal>subject</literal></entry>
@@ -97,12 +97,17 @@
</tbody>
</tgroup>
</table>
+ <para>For complex emails or custom generation of attachments, see: <link linkend="customemails">Extension Points: Custom Emails</link>.</para>
</section>
<section id="emailtemplates">
<title>Templates</title>
<para>Templates are available to externalize commonly used messages from jPDL definitions. In jBPM 4, templates can produce either standard or HTML message; also, templates
can support any scripting language supported by the jBPM Script Manager. As you will see, any <literal>MailProducer</literal> implementation available to jPDL is also available to be templated.
</para>
+ <para>The following is an example of a scriptable Email Template.</para>
+ <programlisting>TODO</programlisting>
+ <para>The following is an example of a scriptable HTML Email Template.</para>
+ <programlisting>TODO</programlisting>
</section>
<section id="emailserverconfiguration">
<title>Server Configuration</title>
@@ -201,11 +206,16 @@
<title>Extension Points</title>
<section id="addressresolvers">
<title>Address Resolvers</title>
+ <para>When implementing a different Identity Management in jBPM [such as LDAP], an Address Resolver is required to resolve Actor and Group email addresses from the Identity Management system.</para>
+ <para>Address Resolvers must implement the <literal>org.jbpm.pvm.internal.email.resolver.AddressResolver</literal> interface. Provided with a User or Group Identifier, the should return valid JavaMail <literal>javax.mail.internet.InternetAddress</literal>es for the given identifier.</para>
+ <para>Plugging in a custom Address Resolver to jBPM is handled within the jBPM Configuration. The following is an example of providing a custom Address Resolver within <literal>jbpm.cfg.xml</literal>.</para>
+ <programlisting>TODO</programlisting>
+
</section>
<section id="customemails">
<title>Custom Emails</title>
<para>jBPM 4 allows the creation of your own Email Producers to address an organization's specific email needs.
- To do so, users must implement the <literal>MailProducer</literal> interface. The method produce will return one or more Email objects, which jBPM will then send using the jBPM MailSession.
+ To do so, users must implement the <literal>org.jbpm.pvm.internal.email.producer.MailProducer</literal> interface. The method produce will return one or more Email objects, which jBPM will then send using the jBPM MailSession.
<para>Apache Commons Email was choosen to simplify the email interface for jBPM. All emails returned by the MailProducer implementation must extend the base <literal>org.apache.commons.mail.Email</literal>.</para>
<para>See the Apache Commons for more information on supported <literal>Email</literal> types:
<ulink url="http://commons.apache.org/email/">Apache Commons Email</ulink>.</para>
@@ -213,6 +223,34 @@
<section id="generatedemailattachments">
<title>Attachments</title>
+ <para>
+ Generation of custom attachments at runtime can be easily implemented in jBPM 4. By extending out-of-the-box mail producers, or implementing your own with the <literal>MailProducer</literal> interface, attachments can be generated, attachments can be generated and added to
+ emails at runtime.
+ </para>
+ <para>The following is an example of how to extend <literal>HtmlScriptMailProducer</literal> to produce HTML emails with custom attachments.</para>
+ <programlisting>public class CustomAttachmentHtmlScriptMailProducer extends HtmlScriptMailProducer{
+
+ @Override
+ public Collection<Email> produce(Execution exe, MailContext mailContext)
+ throws Exception {
+ //Use the HTML producer to create the body, subject, text.
+ Collection<Email> emails = super.produce(exe, mailContext);
+
+ //Add custom code to generate attachments here.
+ EmailAttachment attachment = null;
+
+ for(Email email : emails)
+ {
+ //We know it's a collection of HTML email.
+ HtmlEmail html = (HtmlEmail)email;
+ //Add your custom attachment.
+ html.attach(attachment);
+ }
+
+ return emails;
+
+ }
+}</programlisting>
</section>
</section>
More information about the jbpm-commits
mailing list