Can I get the steps inside workflow only?

116 Views Asked by At

I am trying to get all the steps inside a particular workflow ONLY in FileNet Process Engine. But no luck getting it. I am not sure if what I am trying to achieve is available in the API because I looked for days but cannot see it.

Here is my code String workflowName = "Sample workflow 1";

    String[] workClassNames = myPESession.fetchWorkClassNames(true);
    for (int i = 0; i < workClassNames.length; i++) {
        System.out.println(workClassNames[i]);
    }


    // Launch Workflow VWStepElement
    VWStepElement stepElement = myPESession.createWorkflow(workflowName);
    System.out.println(stepElement.getWorkflowName());
    System.out.println(stepElement.getSubject());
    System.out.println(stepElement.getComment());
    System.out.println(stepElement.getStepDescription());
    System.out.println("Parameters");

    String[] a = stepElement.getParameterNames();
       for (int i = 0; i < a.length; i++)
       {
           if (a[i] != null)
           {
               Object _parameterValue = stepElement.getParameterValue(a[i]);
               System.out.println("\t" + a[i] + "=" + _parameterValue);
           }
       }
2

There are 2 best solutions below

0
On

Try this

VWWorkflowDefinition defn = peSession.fetchWorkflowDefinition(workSpaceId, workflowIdentifier, convert);
VWMapDefinition vwMapDefinition = defn.getMap(workflowname);
VWMapNode[] mapNode = vwMapDefinition.getSteps()//Gets all of the steps contained in this map.

then iterate the mapNode.

0
On

It is static part that is the same for any instance of particular workflow. Thus you should obtain it from the workflow definition, not the running workflow instance.

You should start with VWWorkflowDefinition, iterate through each map obtained using getMaps() and then obtain the steps from VWMapDefinition using getSteps().