Search in sources :

Example 1 with FlowDiagramService

use of org.finos.waltz.service.flow_diagram.FlowDiagramService 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)

Example 2 with FlowDiagramService

use of org.finos.waltz.service.flow_diagram.FlowDiagramService in project waltz by khartec.

the class FlowDiagramHarness method main.

public static void main(String[] args) throws ParseException {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
    DSLContext dsl = ctx.getBean(DSLContext.class);
    FlowDiagramService svc = ctx.getBean(FlowDiagramService.class);
    svc.makeNewDiagramForEntity(mkRef(PHYSICAL_SPECIFICATION, 51807), "admin", "Hello");
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) FlowDiagramService(org.finos.waltz.service.flow_diagram.FlowDiagramService) DSLContext(org.jooq.DSLContext)

Aggregations

FlowDiagramService (org.finos.waltz.service.flow_diagram.FlowDiagramService)2 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)2 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 LogicalFlowService (org.finos.waltz.service.logical_flow.LogicalFlowService)1 DSLContext (org.jooq.DSLContext)1