@SuppressWarnings("unchecked")
<R> Flow createFlow(CtBlock<R> block){
if (block.getLabel() != null){
if (block.getLabel().startsWith("flow_")){
String flowName = block.getLabel().substring(5);
Flow flow = BPELFactory.eINSTANCE.createFlow();
flow.setName(flowName);
Links links = BPELFactory.eINSTANCE.createLinks();
flow.setLinks(links);
for(CtStatement stmt : block.getStatements()){
scan(stmt);
ASTNodeData stmtData = nodeDataStack.peek();
if (stmtData.flowActivity != null) {
flow.getActivities().add(stmtData.flowActivity);
setFlowActivityLinks(flow,stmtData.flowMethod,stmtData.flowActivity);
}
}
return flow;
}