0 Replies Latest reply on Dec 10, 2007 1:56 AM by pieter martin

    Finding next task after join?

    pieter martin Newbie


      I am trying to programatically find the next tasks to display to the user as buttons while he is busy on any particular task.

      I get this right with normal transitions to tasks and forks but do not know how to do this when the transition is to a join. I would then need to find out whether the join is only waiting for the current task in which case I will display the task after the join to the user otherwise I need to display the tasks that the join is still waiting for to the user.

      Is this possible?

      Basically the idea is to generate the transitions as buttons on the form for the user and start the next task for the user and display the web page for that task.

      Currently I am doing the following to get the next task when a fork is involved.

       List<Transition> leavingTransisitons = taskInstance.getAvailableTransitions();
       if (leavingTransisitons.size()!=1) {
       throw new IllegalStateException("Task may only have one leaving transition!");
       Transition leavingTransition = leavingTransisitons.get(0);
       log.info("leavingTransition = #0 ", leavingTransition.getName());
       Node node = leavingTransition.getTo();
       if (node.getName().startsWith("fork")) {
       log.info("leavingTransistion.getTo() = #0 ", node.getName());
       List<Transition> forkLeavingTrans = node.getLeavingTransitions();
       for (Transition forkTransition : forkLeavingTrans) {
       log.info("forkTransition #0 ", forkTransition.getName());
       transitionTasks.add(new TransitionTask(leavingTransition.getName(),forkTransition.getTo().getName(),forkTransition.getTo().getName()));
       } else if (node.getName().startsWith("join")) {
       log.info("leavingTransistion.getTo() = #0 ", node.getName());

      I know that the hardcoding of task names as 'join' or 'fork' is ugly but with the javassist I do not know how else to tell the type of the nodes.

      Any help pointers appreciated.

      I am using jbpm-3.2.2 with seam-2.0.0.GA