"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?

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949682#3949682

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949682


_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to