use of org.finos.waltz.service.flow_diagram.FlowDiagramEntityService in project waltz by khartec.
the class DiagramToDotExport method main.
public static void main(String[] args) throws IOException {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
FlowDiagramService flowDiagramService = ctx.getBean(FlowDiagramService.class);
FlowDiagramEntityService flowDiagramEntityService = ctx.getBean(FlowDiagramEntityService.class);
ApplicationService applicationService = ctx.getBean(ApplicationService.class);
LogicalFlowService logicalFlowService = ctx.getBean(LogicalFlowService.class);
EntityReference diagRef = mkRef(EntityKind.FLOW_DIAGRAM, 1L);
IdSelectionOptions options = IdSelectionOptions.mkOpts(diagRef, HierarchyQueryScope.EXACT);
List<Application> apps = applicationService.findByAppIdSelector(options);
List<LogicalFlow> flows = logicalFlowService.findBySelector(options);
Map<Long, Application> appsById = indexBy(a -> a.id().get(), apps);
System.out.println("------");
String digraph = String.format("digraph G { %s %s}", renderApplications(apps), renderFlows(flows, appsById));
System.out.println(digraph);
System.out.println("-----");
/*
digraph G {
"Welcome" -> "To"
"To" -> "Web"
"To" -> "GraphViz!"
}
*/
}
Aggregations