[jbpm-commits] JBoss JBPM SVN: r4490 - jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Apr 7 15:18:40 EDT 2009
Author: bradsdavis
Date: 2009-04-07 15:18:40 -0400 (Tue, 07 Apr 2009)
New Revision: 4490
Modified:
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/HtmlScriptMailProducer.java
jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java
Log:
Added more comments.
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/HtmlScriptMailProducer.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/HtmlScriptMailProducer.java 2009-04-07 19:12:58 UTC (rev 4489)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/HtmlScriptMailProducer.java 2009-04-07 19:18:40 UTC (rev 4490)
@@ -43,11 +43,15 @@
this.subject = (String)scriptManager.evaluateScript(this.subject, exe, language);
this.html = (String)scriptManager.evaluate(this.html, exe, language);
+ //Create an HTML message.
HtmlEmail email = new HtmlEmail();
+ //Populate recipients.
this.populateAddresses(mailContext, email);
+ //Set the regular body [non-html] and subject.
email.setTextMsg(this.body);
email.setSubject(this.subject);
+ //Run through the HTML, download images, and embed images within HTML message.
Matcher imgMatcher = imgSrcPattern.matcher(html);
StringBuffer htmlBuffer = new StringBuffer();
while(imgMatcher.find())
@@ -66,17 +70,19 @@
log.debug("Embedded HTML: "+htmlBuffer.toString());
}
try {
+ //Set the embedded HTML to the Email Message.
email.setHtmlMsg(htmlBuffer.toString());
}
catch(Exception e)
{
-
+ //TODO: what do we do here?
}
if(log.isTraceEnabled())
{
log.trace("Complete: "+(new Date()));
}
+ //Return the rendered message.
Collection<Email> collection = new HashSet<Email>();
collection.add(email);
return collection;
Modified: jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java
===================================================================
--- jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java 2009-04-07 19:12:58 UTC (rev 4489)
+++ jbpm4/branches/email/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/producer/impl/ScriptMailProducer.java 2009-04-07 19:18:40 UTC (rev 4490)
@@ -24,10 +24,13 @@
ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
- //Here, you just need to populate the body of the message if it is a simple text email.
+ //Here, you just need to populate the subject and body of the message
+ //as evaluated by the JBPM script manager.
this.body = (String)scriptManager.evaluateScript(this.body, exe, language);
this.subject = (String)scriptManager.evaluateScript(this.subject, exe, language);
+ //Populate and produce email based on SimpleMailProducer logic now that fields
+ //have been resolved using the JBPM script manager.
return super.produce(exe, mailContext);
}
More information about the jbpm-commits
mailing list