01: package org.jbpm.job;
02:
03: import org.apache.commons.logging.Log;
04: import org.apache.commons.logging.LogFactory;
05: import org.jbpm.JbpmContext;
06: import org.jbpm.graph.def.Node;
07: import org.jbpm.graph.exe.ExecutionContext;
08: import org.jbpm.graph.exe.Token;
09:
10: public class ExecuteNodeJob extends Job {
11:
12: private static final long serialVersionUID = 1L;
13:
14: Node node;
15:
16: public ExecuteNodeJob() {
17: }
18:
19: public ExecuteNodeJob(Token token) {
20: super (token);
21: }
22:
23: public boolean execute(JbpmContext jbpmContext) throws Exception {
24: log.debug("job[" + id + "] executes " + node);
25: token.unlock(this .toString());
26: ExecutionContext executionContext = new ExecutionContext(token);
27: node.execute(executionContext);
28: jbpmContext.save(token);
29: return true;
30: }
31:
32: public Node getNode() {
33: return node;
34: }
35:
36: public void setNode(Node node) {
37: this .node = node;
38: }
39:
40: private static Log log = LogFactory.getLog(ExecuteNodeJob.class);
41: }
|