Search in sources :

Example 1 with IdSelectionOptions

use of com.khartec.waltz.model.IdSelectionOptions in project waltz by khartec.

the class ApplicationIdSelectorHarness method main.

public static void main(String[] args) {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
    ApplicationIdSelectorFactory factory = ctx.getBean(ApplicationIdSelectorFactory.class);
    DSLContext dsl = ctx.getBean(DSLContext.class);
    ApplicationService applicationService = ctx.getBean(ApplicationService.class);
    IdSelectionOptions options = IdSelectionOptions.mkOpts(EntityReference.mkRef(EntityKind.MEASURABLE, 1L), HierarchyQueryScope.EXACT);
    Select<Record1<Long>> selector = factory.apply(options);
    System.out.println(selector);
    List<Application> apps = applicationService.findByAppIdSelector(options);
    System.out.println("--- sz: " + apps.size());
    apps.forEach(System.out::println);
    System.out.println("--- done");
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) ApplicationIdSelectorFactory(com.khartec.waltz.data.application.ApplicationIdSelectorFactory) DSLContext(org.jooq.DSLContext) Application(com.khartec.waltz.model.application.Application) ApplicationService(com.khartec.waltz.service.application.ApplicationService) IdSelectionOptions(com.khartec.waltz.model.IdSelectionOptions) Record1(org.jooq.Record1)

Example 2 with IdSelectionOptions

use of com.khartec.waltz.model.IdSelectionOptions 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);
    ApplicationIdSelectorFactory factory = ctx.getBean(ApplicationIdSelectorFactory.class);
    IdSelectionOptions options = IdSelectionOptions.mkOpts(mkRef(EntityKind.ORG_UNIT, 20), HierarchyQueryScope.CHILDREN);
    LogicalFlow app2appFlow = dao.findByFlowId(28940);
    LogicalFlow app2actorFlow = dao.findByFlowId(28941);
    System.out.println("-- App 2 App");
    System.out.println(app2appFlow);
    System.out.println("-- App 2 Actor");
    System.out.println(app2actorFlow);
    List<LogicalFlow> flows = dao.findByEntityReference(mkRef(EntityKind.APPLICATION, 22406));
    System.out.println("-- flows");
    flows.forEach(System.out::println);
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) LogicalFlow(com.khartec.waltz.model.logical_flow.LogicalFlow) ApplicationIdSelectorFactory(com.khartec.waltz.data.application.ApplicationIdSelectorFactory) DSLContext(org.jooq.DSLContext) LogicalFlowDao(com.khartec.waltz.data.logical_flow.LogicalFlowDao) IdSelectionOptions(com.khartec.waltz.model.IdSelectionOptions)

Example 3 with IdSelectionOptions

use of com.khartec.waltz.model.IdSelectionOptions in project waltz by khartec.

the class MeasurableHarness method main.

public static void main(String[] args) {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
    MeasurableIdSelectorFactory factory = ctx.getBean(MeasurableIdSelectorFactory.class);
    MeasurableService measurableService = ctx.getBean(MeasurableService.class);
    EntityReference ref = mkRef(EntityKind.FLOW_DIAGRAM, 2);
    IdSelectionOptions options = mkOpts(ref, HierarchyQueryScope.EXACT);
    Select<Record1<Long>> selector = factory.apply(options);
    System.out.println("--selector");
    System.out.println(selector);
    System.out.println("---");
    List<Measurable> measurables = measurableService.findByMeasurableIdSelector(options);
    measurables.forEach(System.out::println);
    System.out.println("-----");
    measurables.stream().filter(m -> OptionalUtilities.contentsEqual(m.id(), 486L)).forEach(System.out::println);
    System.out.println("-----");
}
Also used : Measurable(com.khartec.waltz.model.measurable.Measurable) HierarchyQueryScope(com.khartec.waltz.model.HierarchyQueryScope) EntityReference(com.khartec.waltz.model.EntityReference) OptionalUtilities(com.khartec.waltz.common.OptionalUtilities) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) EntityKind(com.khartec.waltz.model.EntityKind) MeasurableService(com.khartec.waltz.service.measurable.MeasurableService) List(java.util.List) IdSelectionOptions(com.khartec.waltz.model.IdSelectionOptions) DIConfiguration(com.khartec.waltz.service.DIConfiguration) Record1(org.jooq.Record1) MeasurableIdSelectorFactory(com.khartec.waltz.data.measurable.MeasurableIdSelectorFactory) IdSelectionOptions.mkOpts(com.khartec.waltz.model.IdSelectionOptions.mkOpts) Select(org.jooq.Select) EntityReference.mkRef(com.khartec.waltz.model.EntityReference.mkRef) Measurable(com.khartec.waltz.model.measurable.Measurable) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) MeasurableIdSelectorFactory(com.khartec.waltz.data.measurable.MeasurableIdSelectorFactory) EntityReference(com.khartec.waltz.model.EntityReference) MeasurableService(com.khartec.waltz.service.measurable.MeasurableService) IdSelectionOptions(com.khartec.waltz.model.IdSelectionOptions) Record1(org.jooq.Record1)

Example 4 with IdSelectionOptions

use of com.khartec.waltz.model.IdSelectionOptions in project waltz by khartec.

the class EntityStatisticEndpoint method calculateHistoricStatTallyRoute.

private List<TallyPack<String>> calculateHistoricStatTallyRoute(Request request, Response response) throws IOException {
    IdSelectionOptions idSelectionOptions = readIdSelectionOptionsFromBody(request);
    RollupKind rollupKind = extractRollupKind(request);
    Duration duration = EnumUtilities.readEnum(request.queryParams("duration"), Duration.class, s -> Duration.MONTH);
    Long statisticId = getId(request);
    return entityStatisticService.calculateHistoricStatTally(statisticId, rollupKind, idSelectionOptions, duration);
}
Also used : Duration(com.khartec.waltz.model.Duration) RollupKind(com.khartec.waltz.model.entity_statistic.RollupKind) IdSelectionOptions(com.khartec.waltz.model.IdSelectionOptions)

Example 5 with IdSelectionOptions

use of com.khartec.waltz.model.IdSelectionOptions in project waltz by khartec.

the class EntityStatisticEndpoint method calculateStatTallyRoute.

private TallyPack<String> calculateStatTallyRoute(Request request, Response response) throws IOException {
    IdSelectionOptions idSelectionOptions = readIdSelectionOptionsFromBody(request);
    RollupKind rollupKind = extractRollupKind(request);
    Long statisticId = getId(request);
    return entityStatisticService.calculateStatTally(statisticId, rollupKind, idSelectionOptions);
}
Also used : RollupKind(com.khartec.waltz.model.entity_statistic.RollupKind) IdSelectionOptions(com.khartec.waltz.model.IdSelectionOptions)

Aggregations

IdSelectionOptions (com.khartec.waltz.model.IdSelectionOptions)12 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)6 Record1 (org.jooq.Record1)5 EntityReference (com.khartec.waltz.model.EntityReference)4 DSLContext (org.jooq.DSLContext)4 ApplicationIdSelectorFactory (com.khartec.waltz.data.application.ApplicationIdSelectorFactory)3 LogicalFlowDao (com.khartec.waltz.data.logical_flow.LogicalFlowDao)2 LogicalFlowIdSelectorFactory (com.khartec.waltz.data.logical_flow.LogicalFlowIdSelectorFactory)2 EntityKind (com.khartec.waltz.model.EntityKind)2 HierarchyQueryScope (com.khartec.waltz.model.HierarchyQueryScope)2 IdSelectionOptions.mkOpts (com.khartec.waltz.model.IdSelectionOptions.mkOpts)2 RollupKind (com.khartec.waltz.model.entity_statistic.RollupKind)2 LogicalFlow (com.khartec.waltz.model.logical_flow.LogicalFlow)2 LogicalFlowService (com.khartec.waltz.service.logical_flow.LogicalFlowService)2 Collection (java.util.Collection)2 Select (org.jooq.Select)2 Checks.checkNotNull (com.khartec.waltz.common.Checks.checkNotNull)1 OptionalUtilities (com.khartec.waltz.common.OptionalUtilities)1 SetUtilities (com.khartec.waltz.common.SetUtilities)1 SetUtilities.fromCollection (com.khartec.waltz.common.SetUtilities.fromCollection)1