2 Replies Latest reply on Mar 25, 2010 6:37 AM by Sebastian Herbst

    jBPM get outgoing Transition names

    Sebastian Herbst Novice


      I'm new to jBPM and still fooling around with some examples. The goal is to integrate jBPM in an existing framework, but until now I'm not able to get the outgoing Transitions of a state.



      public class Workflow {
          public Workflow(String jpdl_file)
              // Setup Workflow-Engine
              ProcessEngine processEngine = new Configuration().buildProcessEngine();
              RepositoryService repositoryService = processEngine.getRepositoryService();
              ExecutionService executionService = processEngine.getExecutionService();
              // Deploy Workflows/Prozessdiagramm
              NewDeployment newDeployment = repositoryService.createDeployment().addResourceFromClasspath(jpdl_file);
              String deploymentDbid = newDeployment.deploy();
              //Set Rights
              Map<String, Object> variables = new HashMap<String, Object>();
              variables.put("user", new User());
              variables.put("group", new Group());
              // Start Workflow
              // TODO executionsService nicht über den Namen aufrufen
              ProcessInstance processInstance = executionService.startProcessInstanceByKey("testTask", variables);
              Execution execution = executionService.findProcessInstanceById(processInstance.getId());



      So far I'm just starting a new ProcessEngine, deploy a given workflow, setup some variables and start an new Instance of the given Workflow.

      So for now the Workflow itself isn't so important. At least I just have to know how to get the active node(s) of this wf and its transitions.


      Thanks and Greetings

      S. Herbst

        • 1. Re: jBPM get outgoing Transition names
          Maciej Swiderski Master



          so to get active node(s) you can use your execution instance:



          This will return all active nodes for your execution or null if none is active.


          Next, you can iterate over this and get each active node execution by using execution instance again:



          That will return new execution object.


          Here starts not so nice usage.... you can cat that execution to ExecutionImpl and then you could access getActivity method and then getOutgoingTransitions...


          I heard that there are issues in jira to get such functionality as part of public API so you could go through jira to check it out.


          Please take a look at java docs for more details.




          • 2. Re: jBPM get outgoing Transition names
            Sebastian Herbst Novice

            Ok, i've just managed to find the names.



            public List<Transition> getTransitiones(ProcessInstance processInstance)
                    Execution executionInA = processInstance.getProcessInstance();
                    return ((ExecutionImpl)executionInA).getActivity().getOutgoingTransitions();