0 Replies Latest reply on Mar 3, 2015 11:33 PM by lich0079

    how can I runtime drawing Process workflow base on meta data

    lich0079

      We have a requirement that need draw workflow on the runtime along with some other feature, 

       

      In order to do that, I need some meta data  about the process definition, like which roles are in the flow, how many node, the node's atttibute and so on.

       

      I write code below, try to get much metadata as I can which is not enough. like I don't know the task node's player

       

      KieBase base = ksession.getKieBase();

      RuleFlowProcess p = (RuleFlowProcess) base.getProcess("com.sample.evaluation");

      Map<String, Object> m = p.getMetaData();

      for (String key : m.keySet()) {

          Object o = m.get(key);

          System.out.println(key+":"+o);

      }

      Node[] nodes = p.getNodes();

      for (int i = 0; i < nodes.length; i++) {

          Node n = nodes[i];

          System.out.println(n.getClass().getName());

          Map<String, Object> meta =n.getMetaData();

          for (String key : meta.keySet()) {

              Object o = meta.get(key);

              System.out.println(key+":"+o);

        }

      }

       

      console output:

       

      TargetNamespace:

      Definitions:org.jbpm.bpmn2.core.Definitions@8c1c614

      BPMN.Connections:[SequenceFlow (SequenceFlow_1) [_1 -> _2], SequenceFlow (SequenceFlow_2) [_2 -> _5], SequenceFlow (SequenceFlow_3) [_5 -> _4], SequenceFlow (SequenceFlow_4) [_5 -> _3], SequenceFlow (SequenceFlow_5) [_4 -> _6], SequenceFlow (SequenceFlow_6) [_3 -> _6], SequenceFlow (SequenceFlow_7) [_6 -> _7]]

      org.jbpm.workflow.core.node.StartNode

      height:36

      width:36

      UniqueId:_1

      y:62

      x:30

      org.jbpm.workflow.core.node.HumanTaskNode

      height:48

      width:135

      UniqueId:_2

      y:56

      x:96

      org.jbpm.workflow.core.node.HumanTaskNode

      height:48

      width:136

      UniqueId:_3

      y:106

      x:344

      org.jbpm.workflow.core.node.HumanTaskNode

      height:48

      width:136

      UniqueId:_4

      y:9

      x:344

      org.jbpm.workflow.core.node.Split

      height:48

      width:48

      UniqueId:_5

      y:56

      x:263

      org.jbpm.workflow.core.node.Join

      height:48

      width:48

      UniqueId:_6

      y:56

      x:512

      org.jbpm.workflow.core.node.EndNode

      height:36

      width:36

      UniqueId:_7

      y:63

      x:582