01: package org.jbpm.graph.node;
02:
03: import org.dom4j.Element;
04: import org.jbpm.JbpmException;
05: import org.jbpm.graph.def.Action;
06: import org.jbpm.graph.def.Node;
07: import org.jbpm.graph.exe.ExecutionContext;
08: import org.jbpm.instantiation.Delegation;
09: import org.jbpm.jpdl.xml.JpdlXmlReader;
10:
11: public class MailNode extends Node {
12:
13: private static final long serialVersionUID = 1L;
14:
15: // xml //////////////////////////////////////////////////////////////////////
16:
17: public void read(Element element, JpdlXmlReader jpdlReader) {
18: String template = element.attributeValue("template");
19: String actors = element.attributeValue("actors");
20: String to = element.attributeValue("to");
21: String subject = jpdlReader.getProperty("subject", element);
22: String text = jpdlReader.getProperty("text", element);
23: Delegation delegation = jpdlReader.createMailDelegation(
24: template, actors, to, subject, text);
25: this .action = new Action(delegation);
26: }
27:
28: public void execute(ExecutionContext executionContext) {
29: try {
30: executeAction(action, executionContext);
31: } catch (JbpmException e) {
32: throw e;
33: } catch (Exception e) {
34: throw new JbpmException("couldn't send email", e);
35: }
36: leave(executionContext);
37: }
38:
39: }
|