Search in sources :

Example 1 with FlowDiagramEntityService

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!"
        }
        */
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) LogicalFlowService(org.finos.waltz.service.logical_flow.LogicalFlowService) FlowDiagramEntityService(org.finos.waltz.service.flow_diagram.FlowDiagramEntityService) FlowDiagramService(org.finos.waltz.service.flow_diagram.FlowDiagramService) LogicalFlow(org.finos.waltz.model.logical_flow.LogicalFlow) EntityReference(org.finos.waltz.model.EntityReference) Application(org.finos.waltz.model.application.Application) ApplicationService(org.finos.waltz.service.application.ApplicationService) IdSelectionOptions(org.finos.waltz.model.IdSelectionOptions)

Aggregations

EntityReference (org.finos.waltz.model.EntityReference)1 IdSelectionOptions (org.finos.waltz.model.IdSelectionOptions)1 Application (org.finos.waltz.model.application.Application)1 LogicalFlow (org.finos.waltz.model.logical_flow.LogicalFlow)1 ApplicationService (org.finos.waltz.service.application.ApplicationService)1 FlowDiagramEntityService (org.finos.waltz.service.flow_diagram.FlowDiagramEntityService)1 FlowDiagramService (org.finos.waltz.service.flow_diagram.FlowDiagramService)1 LogicalFlowService (org.finos.waltz.service.logical_flow.LogicalFlowService)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1