01: package org.jbpm.command;
02:
03: import org.jbpm.JbpmContext;
04: import org.jbpm.taskmgmt.exe.TaskInstance;
05:
06: /**
07: * The current authorizes actor starts to work on the TaskInstance
08: * so the actor is set to the given actor
09: *
10: * see some more information why we need that in the
11: * <a href="http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4018785">jbpm forum</a>
12: *
13: * @author Bernd Ruecker
14: */
15: public class CancelWorkOnTaskCommand implements Command {
16:
17: private static final long serialVersionUID = -172457633891242288L;
18:
19: private long taskInstanceId;
20:
21: public CancelWorkOnTaskCommand(long taskInstanceId) {
22: this .taskInstanceId = taskInstanceId;
23: }
24:
25: public CancelWorkOnTaskCommand() {
26: }
27:
28: public Object execute(JbpmContext jbpmContext) throws Exception {
29: TaskInstance ti = jbpmContext.getTaskInstance(taskInstanceId);
30: ti.setActorId(null);
31: ti.setStart(null);
32: return null;
33: }
34:
35: public long getTaskInstanceId() {
36: return taskInstanceId;
37: }
38:
39: public void setTaskInstanceId(long taskInstanceId) {
40: this.taskInstanceId = taskInstanceId;
41: }
42:
43: }
|