3 Replies Latest reply on Dec 2, 2008 10:49 AM by Ronald van Kuijk

    Cange swimlane at runtime

    Peter Großmann Newbie

      Is it possible to change the swimlane or asignment of a task in a ProcessInstance, when the tasknode is not reached yet?

      apparently the asignment is appointed when the process leaves the start-state and can not be changed later

      even if i use a process variable:

      <task name="Execute">
      <assignment actor-id="#{SWIMLANE}"></assignment>
      </task>
      

      the processvariable seems to be read when the process leaves the start-state so it doeasn't matter if i change it later, the asignment will be to the actor which was set when leaving the start state


      any ideas ? the problem is that the point when i want to change the asigned-actor before reaching the task-node so there isn't a taskinstance yet

        • 1. Re: Cange swimlane at runtime
          Ronald van Kuijk Master

          so your subject is wrong... I almost pointed you to page 2 of this forum where the answer is 'use the api' It is normally best to start with your *real problem* in the beginning of the post. If it is in the end and more than 50% of this post is like a previous one (it's 95% for this post) I stop reading... you are lucky now....

          Still... the answer is 'use the api' At any moment in time you can change it, just *not* before it reaches the tasknode. Using an assignmenthandler is then probably best. You can do anything in there.

          • 2. Re: Cange swimlane at runtime
            Peter Großmann Newbie

            When i create my process instance i set the var "SWIMLANE" to "Unknown"

            i have following nodes

            startstate -> node -> tasknode1 -> tasknode2

            "node" sets var "swimlane" to "test"

            then i overrided the enter() function of tasknode as following

             @Override
             public void enter(ExecutionContext executionContext) {
             // TODO Auto-generated method stub
             super.enter(executionContext);
            
            
            
             for ( TaskInstance ti : (Collection<TaskInstance>)getTaskMgmtInstance(executionContext.getToken()).getTaskInstances()) {
             ti.setActorId(executionContext.getVariable("SWIMLANE").toString());
             System.out.println("Set " + ti.getName() + " actor to " + executionContext.getVariable("SWIMLANE").toString());
             }
             }
            


            Output:

            Set node1task actor to Unknown
            Set node2task actor to Test



            but node1task should have been set to test, too...

            seems that the variable isn't set fast enough or something like that, how can it be? ... i didn't set any asynchonous nodes

            • 3. Re: Cange swimlane at runtime
              Ronald van Kuijk Master

              This is way to complex... as mentioned use an assignmenthandler....