3 Replies Latest reply on Jun 9, 2009 9:04 AM by Nassos Michas

    Finding outgoing transitions - jBPM 4

    Nassos Michas Newbie


      I get a reference to my process instance as:
      ProcessInstance pi = executionService.findProcessInstanceById("__MY_ID_HERE__");

      First a confirmation... Is it correct to assume that I get the current state on which my process is at using: pi.findActiveActivityNames() ? I understand that in case of parallel execution, via a fork, I should be getting more than one elements here?

      And a question... How can I find the list of available outgoing transitions for the particular activity on which my process instance is currently at? I see there is an Activity class that can give me that info, but can't find a way to get a reference to an Activity object via pi.findActiveActivityNames(). Any suggestions please?


        • 1. Re: Finding outgoing transitions - jBPM 4
          Ronald van Kuijk Master

          1: yes afaik
          2: use the taskservice, at least for the 'human' tasks

          • 2. Re: Finding outgoing transitions - jBPM 4
            Nassos Michas Newbie

            Thanks kukeltje, however I believe that the TaskService can only give me the list of pending tasks that have previously been assigned to a particular user, correct?

            What I'm interested to find out is the list of the available outgoing transition of the currently active (or any...) activity of my workflow. I have the same requirement as other people have had in the past on this forum, i.e. to enable/disable menus & buttons according to what actions (outgoing transitions) the user is allowed to perform. I've seen previous posts on the forum regarding exactly that, however they're for v.3 and don't seem to be working on v.4.

            Any ideas?

            • 3. Re: Finding outgoing transitions - jBPM 4
              Nassos Michas Newbie

              Ok, I found a solution, here it is if anybody is interested:

               Configuration configuration = new Configuration();
               ProcessEngine processEngine = configuration.buildProcessEngine();
               Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
               RepositorySession repositorySession = env.getFromCurrent(RepositorySession.class);
               ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl)
               Activity a = processDefinition.findActivity("_ACTIVITY_NAME_");

              Once you have the Activity object, you can query it for a lot of information including the list of outgoing transitions.