01: package org.emforge.jbpm.assigner;
02:
03: import org.apache.commons.logging.Log;
04: import org.apache.commons.logging.LogFactory;
05: import org.emforge.jbpm.BpmVariable;
06: import org.jbpm.graph.exe.ExecutionContext;
07: import org.jbpm.taskmgmt.def.AssignmentHandler;
08: import org.jbpm.taskmgmt.exe.Assignable;
09:
10: public class AssignToProcessOwner implements AssignmentHandler {
11: private static final long serialVersionUID = 7799054263426390222L;
12: protected final Log logger = LogFactory.getLog(getClass());
13:
14: /** Assigned task according to "Owner" variable
15: *
16: * (non-Javadoc)
17: * @see org.jbpm.taskmgmt.def.AssignmentHandler#assign(org.jbpm.taskmgmt.exe.Assignable, org.jbpm.graph.exe.ExecutionContext)
18: */
19: public void assign(Assignable i_assignable,
20: ExecutionContext i_executionContext) throws Exception {
21: Object assignToVar = i_executionContext
22: .getVariable(BpmVariable.OWNER.getVariable());
23: assert assignToVar != null;
24:
25: String assignTo = assignToVar.toString();
26: logger.info("task "
27: + i_executionContext.getTaskInstance().getName()
28: + " assigned to " + assignTo);
29: i_assignable.setActorId(assignTo);
30: }
31: }
|