2 Replies Latest reply on Jul 8, 2010 6:18 AM by herbst

    Get all nodenames

    herbst

      Hello,

      is it possible to get all Nodes from a deployed processdefinition ? Actually I only need the names of all states/tasks for rightsmanagement, but I need them before the process starts.

      (I'm using jBPM v.4.3)

       

      Any suggestions ?

      Thank a lot

      Sebastian Herbst

        • 1. Re: Get all nodenames
          rebody

          Hi Sebastian,

           

          So easy,  You could cast ProcessDefinition to ProcessDefinitionImpl and invoke getActivities() method.

          • 2. Re: Get all nodenames
            herbst

            Thanks a lot for the quick answer.

             

            For completeness:

             

            public List<String> getAllNodes(ProcessDefinition processDefinition)
                {
                    ProcessDefinitionImpl processDefinitionImpl = (ProcessDefinitionImpl)processDefinition;
                    List<? extends Activity> activities= processDefinitionImpl.getActivities();
                    List<String> nodeNames = new ArrayList<String>();
                    for(Activity activity : activities)
                    {
                        nodeNames.add(activity.getName());
                        System.out.println(activity.getName());
                    }
                    return nodeNames;
                }