Search in sources :

Example 1 with ApplicationIdSelectorFactory

use of com.khartec.waltz.data.application.ApplicationIdSelectorFactory 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 ApplicationIdSelectorFactory

use of com.khartec.waltz.data.application.ApplicationIdSelectorFactory in project waltz by khartec.

the class AssetCostHarness method main.

public static void main(String[] args) {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
    DSLContext dsl = ctx.getBean(DSLContext.class);
    AssetCostService service = ctx.getBean(AssetCostService.class);
    AssetCostStatsDao statsDao = ctx.getBean(AssetCostStatsDao.class);
    AssetCostDao costDao = ctx.getBean(AssetCostDao.class);
    ApplicationIdSelectorFactory selectorFactory = ctx.getBean(ApplicationIdSelectorFactory.class);
    long st = System.currentTimeMillis();
    System.out.println("-- start");
    IdSelectionOptions appIdSelectionOptions = ImmutableIdSelectionOptions.builder().scope(HierarchyQueryScope.CHILDREN).entityReference(ImmutableEntityReference.builder().id(5600).kind(EntityKind.ORG_UNIT).build()).build();
    List<Tuple2<Long, BigDecimal>> costs = service.calculateCombinedAmountsForSelector(appIdSelectionOptions);
    System.out.println("-- end, dur: " + (System.currentTimeMillis() - st));
    System.out.println(costs);
    System.out.println(costs.size());
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) AssetCostStatsDao(com.khartec.waltz.data.asset_cost.AssetCostStatsDao) ApplicationIdSelectorFactory(com.khartec.waltz.data.application.ApplicationIdSelectorFactory) Tuple2(org.jooq.lambda.tuple.Tuple2) AssetCostDao(com.khartec.waltz.data.asset_cost.AssetCostDao) DSLContext(org.jooq.DSLContext) AssetCostService(com.khartec.waltz.service.asset_cost.AssetCostService)

Example 3 with ApplicationIdSelectorFactory

use of com.khartec.waltz.data.application.ApplicationIdSelectorFactory 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)

Aggregations

ApplicationIdSelectorFactory (com.khartec.waltz.data.application.ApplicationIdSelectorFactory)3 DSLContext (org.jooq.DSLContext)3 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)3 IdSelectionOptions (com.khartec.waltz.model.IdSelectionOptions)2 AssetCostDao (com.khartec.waltz.data.asset_cost.AssetCostDao)1 AssetCostStatsDao (com.khartec.waltz.data.asset_cost.AssetCostStatsDao)1 LogicalFlowDao (com.khartec.waltz.data.logical_flow.LogicalFlowDao)1 Application (com.khartec.waltz.model.application.Application)1 LogicalFlow (com.khartec.waltz.model.logical_flow.LogicalFlow)1 ApplicationService (com.khartec.waltz.service.application.ApplicationService)1 AssetCostService (com.khartec.waltz.service.asset_cost.AssetCostService)1 Record1 (org.jooq.Record1)1 Tuple2 (org.jooq.lambda.tuple.Tuple2)1