-
1. Re: Task assignment problem
kukeltje May 15, 2006 8:01 AM (in response to yschluchter)normal behaviour afaik (maybe it is not always should change, but that is another thing)
Once a swimlane has an actor assigned in it, it will always use the same assigned actor. The assignementhandler will not be called again.
Maybe the an attribute on the swimlane like 'evaluate' with the possible values of 'initial', 'always', 'once a day' would be an addition. -
2. Re: Task assignment problem
yschluchter May 15, 2006 8:43 AM (in response to yschluchter)Hi,
Thanks for your quick answer! :)
To get the right behavior (calling everytime the assignment handler), I changed my task like this:
Before, the task was assigned to a swimlane which was calling the assignment handler.
Now, the task is directly linked to the handler. I don't have any swimlane anymore.
...and it works perfectly!
Thanks for your help! -
3. Re: Task assignment problem
kukeltje May 15, 2006 9:37 AM (in response to yschluchter)The biggest chance you will have on a quick answer from me is posting it between 07:00 and 08:00 CET, or between 22:00 and 0:00 CET.
Now back to your response That is what I did to, but personally I like to have this functionality WITH using swimlanes -
4. Re: Task assignment problem
hannes Jun 7, 2006 1:48 PM (in response to yschluchter)"kukeltje" wrote:
Once a swimlane has an actor assigned in it, it will always use the same assigned actor. The assignementhandler will not be called again.
I am running in the same problem: i need to run the AssignmentHandler once more. So i firstly wrote an action:import java.util.HashSet; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jbpm.graph.def.ActionHandler; import org.jbpm.graph.exe.ExecutionContext; import org.jbpm.taskmgmt.exe.SwimlaneInstance; public class ClearSwimlaneHandler implements ActionHandler { private static final Log log = LogFactory.getLog(ClearSwimlaneHandler.class); private String swimlane; public void execute(ExecutionContext executionContext) throws Exception { SwimlaneInstance swi = executionContext.getProcessInstance().getTaskMgmtInstance().getSwimlaneInstance(swimlane); if (swi == null) { log.error("cant reassign: Swimlane doesnt exists: " + swimlane); } else { swi.setActorId(null); swi.setPooledActors(new HashSet()); log.info("clearing actors for swimlane: "+ swimlane); } } }
The action gets invoked at the affected task:<task-node name="Analyze State"> <task name="Analyze" swimlane="Responsible"> <event type="task-create"> <action name="Always Assignment" class="my.ClearSwimlaneHandler"> <swimlane>Responsible</swimlane> </action> </event>
But the assignment is 'null'
The I tried to delete the swimlane of the task:public void execute(ExecutionContext executionContext) throws Exception { executionContext.getTask().setSwimlane(null);
But no assignment:
The code of the taskinstance (jbpm 3.0.2) says:public void assign(ExecutionContext executionContext) { TaskMgmtInstance taskMgmtInstance = executionContext .getTaskMgmtInstance(); Swimlane swimlane = task.getSwimlane(); // if this task is in a swimlane if (swimlane != null) { // if this is a task assignment for a start-state if (isStartTaskInstance()) { // initialize the swimlane swimlaneInstance = new SwimlaneInstance(swimlane); taskMgmtInstance.addSwimlaneInstance(swimlaneInstance); // with the current authenticated actor swimlaneInstance.setActorId(Authentication .getAuthenticatedActorId()); } else { // lazy initialize the swimlane... // get the swimlane instance (if there is any) swimlaneInstance = taskMgmtInstance .getInitializedSwimlaneInstance(executionContext, swimlane); // copy the swimlaneInstance assignment into the taskInstance // assignment copySwimlaneInstanceAssignment(swimlaneInstance); } } else { // this task is not in a swimlane taskMgmtInstance.invokeAssignmentHandler(task .getAssignmentDelegation(), this, executionContext); } updatePooledActorsReferences(swimlaneInstance); }
So it should be enough to clear the swimlane of the task, or am I wrong? -
5. Re: Task assignment problem
kukeltje Jun 7, 2006 3:32 PM (in response to yschluchter)you clear the actorid, not the swimlane. The code you show tests for the swimlane to be null, not the actor or so.
Could be that the same is true for 3.1 as well, then I was wrong and you should make the swimlane null.