1 2 Previous Next 17 Replies Latest reply on Jan 21, 2010 6:13 PM by Ronald van Kuijk

    Unable to distingusih between  pooled-Actors and Swimlane

    john britto Newbie

      Hai

       

      As  per  my  understanding  Swimlane is a Roel  in the JBPM

      Actor-id and Pooled Actors are the attribute and  These(Actor-id and PooleActor)  are user.

       

       

      i   Have developed a samll Application.

      I have processdefiniton in  BuyerRegistration. The code is

       

       

       

      <?xml version="1.0" encoding="UTF-8"?>

       

      <process-definition  xmlns="urn:jbpm.org:jpdl-3.2"  name="BuyerRegistration">

       


          <swimlane name="Buyer">
              <assignment actor-id="Britto"></assignment>
          </swimlane>

       

          <swimlane name="Admin1">
              <assignment pooled-actors="A,B,C,D"></assignment>
          </swimlane>

       

          <swimlane name="Admin2">
              <assignment pooled-actors="X,Y,Z"></assignment>
          </swimlane>

       


          <start-state name="Registration_StartState">
              <task swimlane="Buyer"></task>
              <transition to="Registartion_Approve_By_Admin1" name="To_Approve_Admin1"></transition>
          </start-state>

       


          <task-node name="Registartion_Approve_By_Admin1">
              <task swimlane="Admin1"></task>
              <transition to="Registration_Approve_By_Admin2" name="To_Approve_Admin2"></transition>
          </task-node>

       

          <task-node name="Registration_Approve_By_Admin2">
              <task swimlane="Admin2"></task>
              <transition to="End_Registration" name="End"></transition>
          </task-node>

       


          <end-state name="End_Registration"></end-state>

       


      </process-definition>

       

       

      And the  java class for this file  is

       

       

       

      /**
      *
      */
      package com.br.bprocess;

       

      import java.util.Collection;
      import java.util.Iterator;

       

      import org.jbpm.graph.def.ProcessDefinition;
      import org.jbpm.graph.def.Node;
      import org.jbpm.graph.exe.ProcessInstance;
      import org.jbpm.graph.exe.Token;
      import org.jbpm.taskmgmt.exe.TaskInstance;
      import org.jbpm.taskmgmt.exe.TaskMgmtInstance;

       


      import junit.extensions.TestSetup;
      import junit.framework.Test;
      import junit.framework.TestCase;
      import junit.framework.TestSuite;

       

      /**
      * @author doss
      *
      */
      public class BuyerRegistrationTest extends TestCase {

       

          static ProcessDefinition buyerRegistrationProcess;
          static Node registarteInit,approveOne,approveTwo,end;
         
            public static Test suite()
            {
              return new TestSetup(new TestSuite(BuyerRegistrationTest.class))
              {
                protected void setUp() throws Exception
                {
                  super.setUp();
                  buyerRegistrationProcess=ProcessDefinition.parseXmlInputStream(BuyerRegistrationTest.class.getResourceAsStream("/BuyerRegistration/processdefinition.xml"));
                  registarteInit=buyerRegistrationProcess.getNode("Registration_StartState");
                  approveOne=buyerRegistrationProcess.getNode("Registartion_Approve_By_Admin1");
                  approveTwo=buyerRegistrationProcess.getNode("Registration_Approve_By_Admin2");
                  end=buyerRegistrationProcess.getNode("End_Registration");
               
                }
              };
            }
            public void testScenarioOne()
            {
              ProcessInstance processInstance = new ProcessInstance(buyerRegistrationProcess);
              Token token = processInstance.getRootToken();
          
             // token.setNode(registarteInit);
              assertEquals("Registration_StartState", token.getNode().getName());
              token.signal("To_Approve_Admin1");
             
              assertEquals("Registartion_Approve_By_Admin1", token.getNode().getName());
              token.lock("A");
              if(token.isLocked())
              {
                  System.out.println("Token is locked By the swimlane-0 : "+token.getLockOwner());
                  System.out.println("First unlock the token and execute-0");
              }else{
                  System.out.println("Token is not  locked By the swimlane: ");
              }
              token.unlock("Admin1");
              token.signal("To_Approve_Admin2");
             
            
             
              assertEquals("Registration_Approve_By_Admin2", token.getNode().getName());
              token.signal("End");
             
              assertEquals("End_Registration", token.getNode().getName());
              token.end();
            }
      }

       

       

       

      What ever the Swimlane role i specifiy it is locked the signal  of toke.

       

      I  Have assigned the  "Admin1"     to      "Registartion_Approve_By_Admin1"  task.

       

      but by using the "Buyer"  swimlae the token is locked even if  it is in the  "Registration_Approve_By_Admin2"  Task.

       

       

      I would like to know the list of swimlane user by code.

       

      I  have reffered the http://docs.jboss.org/jbpm/v3/userguide/taskmanagement.html#swimlanes   also

       

      but  no use.

       

      your help is urgent

      Adavnce thanks

       

      regards

      britto

        1 2 Previous Next