Search in sources :

Example 1 with LogicalFlowService

use of org.finos.waltz.service.logical_flow.LogicalFlowService 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 LogicalFlowService

use of org.finos.waltz.service.logical_flow.LogicalFlowService in project waltz by khartec.

the class LogicalFlowHarness method main.

public static void main(String[] args) throws ParseException {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
    DSLContext dsl = ctx.getBean(DSLContext.class);
    LogicalFlowDao dao = ctx.getBean(LogicalFlowDao.class);
    LogicalFlowService service = ctx.getBean(LogicalFlowService.class);
    ApplicationIdSelectorFactory factory = new ApplicationIdSelectorFactory();
    IdSelectionOptions options = IdSelectionOptions.mkOpts(mkRef(EntityKind.PERSON, 262508), HierarchyQueryScope.CHILDREN);
    for (int i = 0; i < 5; i++) {
        List<LogicalFlow> flows = FunctionUtilities.time("Get flows", () -> service.findBySelector(options));
    }
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) LogicalFlowService(org.finos.waltz.service.logical_flow.LogicalFlowService) LogicalFlow(org.finos.waltz.model.logical_flow.LogicalFlow) ApplicationIdSelectorFactory(org.finos.waltz.data.application.ApplicationIdSelectorFactory) DSLContext(org.jooq.DSLContext) LogicalFlowDao(org.finos.waltz.data.logical_flow.LogicalFlowDao) IdSelectionOptions(org.finos.waltz.model.IdSelectionOptions)

Example 3 with LogicalFlowService

use of org.finos.waltz.service.logical_flow.LogicalFlowService in project waltz by khartec.

the class DataFlowHarness method main.

public static void main(String[] args) throws ParseException {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
    DSLContext dsl = ctx.getBean(DSLContext.class);
    LogicalFlowService service = ctx.getBean(LogicalFlowService.class);
    LogicalFlowDao dao = ctx.getBean(LogicalFlowDao.class);
    LogicalFlowIdSelectorFactory factory = new LogicalFlowIdSelectorFactory();
    IdSelectionOptions options = IdSelectionOptions.mkOpts(EntityReference.mkRef(EntityKind.ORG_UNIT, 5000), HierarchyQueryScope.CHILDREN);
    Select<Record1<Long>> selector = factory.apply(options);
    System.out.println(selector);
    List<LogicalFlow> flows = dao.findBySelector(selector);
    flows.forEach(System.out::println);
    // by data type
    EntityReference dataType = EntityReference.mkRef(EntityKind.DATA_TYPE, 6000);
    IdSelectionOptions dataTypeOptions = IdSelectionOptions.mkOpts(dataType, HierarchyQueryScope.CHILDREN);
    List<LogicalFlow> byDataTypeFlows = service.findBySelector(dataTypeOptions);
    byDataTypeFlows.forEach(System.out::println);
    System.out.println(byDataTypeFlows.size());
}
Also used : LogicalFlowIdSelectorFactory(org.finos.waltz.data.logical_flow.LogicalFlowIdSelectorFactory) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) LogicalFlowService(org.finos.waltz.service.logical_flow.LogicalFlowService) LogicalFlow(org.finos.waltz.model.logical_flow.LogicalFlow) EntityReference(org.finos.waltz.model.EntityReference) DSLContext(org.jooq.DSLContext) LogicalFlowDao(org.finos.waltz.data.logical_flow.LogicalFlowDao) IdSelectionOptions(org.finos.waltz.model.IdSelectionOptions) Record1(org.jooq.Record1)

Aggregations

IdSelectionOptions (org.finos.waltz.model.IdSelectionOptions)3 LogicalFlow (org.finos.waltz.model.logical_flow.LogicalFlow)3 LogicalFlowService (org.finos.waltz.service.logical_flow.LogicalFlowService)3 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)3 LogicalFlowDao (org.finos.waltz.data.logical_flow.LogicalFlowDao)2 EntityReference (org.finos.waltz.model.EntityReference)2 DSLContext (org.jooq.DSLContext)2 ApplicationIdSelectorFactory (org.finos.waltz.data.application.ApplicationIdSelectorFactory)1 LogicalFlowIdSelectorFactory (org.finos.waltz.data.logical_flow.LogicalFlowIdSelectorFactory)1 Application (org.finos.waltz.model.application.Application)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 Record1 (org.jooq.Record1)1