01: package org.jbpm.command;
02:
03: import java.util.List;
04:
05: import org.jbpm.JbpmContext;
06:
07: /**
08: * This Command return the process definition
09: *
10: * @author Bernd Ruecker (bernd.ruecker@camunda.com)
11: */
12: public class GetProcessDefinitionCommand extends
13: AbstractGetObjectBaseCommand {
14:
15: private static final long serialVersionUID = -1908847549444051495L;
16:
17: private int version = -1;
18:
19: private String name;
20:
21: public GetProcessDefinitionCommand() {
22: }
23:
24: public GetProcessDefinitionCommand(String name) {
25: super ();
26: this .name = name;
27: }
28:
29: public GetProcessDefinitionCommand(String name, int version) {
30: super ();
31: this .version = version;
32: this .name = name;
33: }
34:
35: public Object execute(JbpmContext jbpmContext) throws Exception {
36: if (version >= 0)
37: return retrieveProcessDefinition(jbpmContext
38: .getGraphSession().findProcessDefinition(name,
39: version));
40: else
41: return retrieveProcessDefinition(jbpmContext
42: .getGraphSession()
43: .findLatestProcessDefinition(name));
44: }
45:
46: protected String getName() {
47: return name;
48: }
49:
50: protected void setName(String name) {
51: this .name = name;
52: }
53:
54: protected int getVersion() {
55: return version;
56: }
57:
58: protected void setVersion(int version) {
59: this.version = version;
60: }
61: }
|