cancel
Showing results for 
Search instead for 
Did you mean: 

need custom attributes in flowelement in getbpmnmodel

rakesh_world86
Champ in-the-making
Champ in-the-making
hi

for(FlowElement fe : data) {
// here i want to get attributes also like sourceref , targetref and default attributes and other attributes also
System.out.println(fe.getDocumentation() + " " + fe.getId() + " " + fe.getName() + " ");
}

//here i want to get attributes also like sourceref , targetref and default attributes and other attributes also
but that properties is unable to show in object help with dot.

pls help me…

<blockcode>
BpmnModel model = repositoryService.getBpmnModel("newxml:2:66");

         List<org.activiti.bpmn.model.Process> processes = model.getProcesses();
         System.out.println("out 1");
         for(Process proc : processes) {
            System.out.println("out 2");

            Collection<FlowElement> data  = proc.getFlowElements() ;

            for(FlowElement fe : data) {
               // here i want to get  attributes also  like sourceref , targetref and default attributes and other attributes also
               System.out.println(fe.getDocumentation() + "        " + fe.getId() + "          " + fe.getName() + "             ");

            }

            System.out.println(data + " ok ");

            //Collection data = proc.getFlowElements();


            //listRequirements(proc);
         }
</blockcode>
1 REPLY 1

vasile_dirla
Star Contributor
Star Contributor
All you have to do is to play around the BpmnModel and it's elements.

This is the list of incomming arrows for an element.
<java>
List<SequenceFlow> incommings = ((FlowNode) fe).getIncomingFlows();
</java>
and now you just parse this list and take the sourceRefs.

you could do it in a similar way for outgoing flows to determine the targets.

Hint:
don't rely to much on the "dot" autocomplete list, just use the debugger and with a simple breakpoint you could inspect the variables and then you'll see a lot more information.