Search in sources :

Example 26 with Record1

use of org.jooq.Record1 in project waltz by khartec.

the class ReportGridHarness method main.

public static void main(String[] args) {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIBaseConfiguration.class);
    ReportGridDao dao = ctx.getBean(ReportGridDao.class);
    System.out.println("Starting....");
    EntityReference cib = mkRef(EntityKind.APP_GROUP, 11261);
    EntityReference infra = mkRef(EntityKind.ORG_UNIT, 6811);
    EntityReference justWaltz = mkRef(EntityKind.APPLICATION, 20506);
    EntityReference justWaltzGroup = mkRef(EntityKind.APP_GROUP, 433);
    EntityReference orgUnit = mkRef(EntityKind.ORG_UNIT, 95);
    EntityReference everythingGroup = mkRef(EntityKind.APP_GROUP, 20827);
    EntityReference flowDiagram = mkRef(EntityKind.FLOW_DIAGRAM, 1);
    EntityReference mgr = mkRef(EntityKind.PERSON, 1);
    Select<Record1<Long>> selector = new ApplicationIdSelectorFactory().apply(mkOpts(infra));
    System.out.println("Made selector");
    Set<ReportGridCell> a = FunctionUtilities.time("getCellData", () -> dao.findCellDataByGridId(3, selector));
    Set<ReportGridCell> b = FunctionUtilities.time("getCellData", () -> dao.findCellDataByGridId(3, selector));
    Set<ReportGridCell> c = FunctionUtilities.time("getCellData", () -> dao.findCellDataByGridId(3, selector));
    Set<ReportGridCell> data = FunctionUtilities.time("getCellData", () -> dao.findCellDataByGridId(3, selector));
    System.out.println(data.size());
    System.out.println(first(data));
}
Also used : ReportGridCell(org.finos.waltz.model.report_grid.ReportGridCell) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) ApplicationIdSelectorFactory(org.finos.waltz.data.application.ApplicationIdSelectorFactory) ReportGridDao(org.finos.waltz.data.report_grid.ReportGridDao) EntityReference(org.finos.waltz.model.EntityReference) Record1(org.jooq.Record1)

Example 27 with Record1

use of org.jooq.Record1 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)

Example 28 with Record1

use of org.jooq.Record1 in project waltz by khartec.

the class RoadmapGenerator method removeRoadmap.

private void removeRoadmap(ApplicationContext ctx, String roadmapName) {
    DSLContext dsl = getDsl(ctx);
    dsl.select(ROADMAP.ID).from(ROADMAP).where(ROADMAP.NAME.eq(roadmapName)).fetchOptional(ROADMAP.ID).ifPresent(rId -> {
        SelectConditionStep<Record1<Long>> scenarioIds = DSL.select(SCENARIO.ID).from(SCENARIO).where(SCENARIO.ROADMAP_ID.eq(rId));
        dsl.deleteFrom(SCENARIO_AXIS_ITEM).where(SCENARIO_AXIS_ITEM.SCENARIO_ID.in(scenarioIds)).execute();
        dsl.deleteFrom(SCENARIO_RATING_ITEM).where(SCENARIO_RATING_ITEM.SCENARIO_ID.in(scenarioIds)).execute();
        dsl.deleteFrom(ROADMAP).where(ROADMAP.ID.eq(rId)).execute();
    });
}
Also used : DSLContext(org.jooq.DSLContext) Record1(org.jooq.Record1)

Example 29 with Record1

use of org.jooq.Record1 in project waltz by khartec.

the class LogicalDataElementIdSelectorFactory method mkForDataType.

private Select<Record1<Long>> mkForDataType(IdSelectionOptions options) {
    ImmutableIdSelectionOptions dtSelectorOptions = ImmutableIdSelectionOptions.builder().entityReference(options.entityReference()).scope(options.scope()).build();
    Select<Record1<Long>> dtSelector = dataTypeIdSelectorFactory.apply(dtSelectorOptions);
    return DSL.selectDistinct(LOGICAL_DATA_ELEMENT.ID).from(LOGICAL_DATA_ELEMENT).where(LOGICAL_DATA_ELEMENT.PARENT_DATA_TYPE_ID.in(dtSelector)).and(LOGICAL_DATA_ELEMENT.ENTITY_LIFECYCLE_STATUS.in(options.entityLifecycleStatuses()));
}
Also used : ImmutableIdSelectionOptions(org.finos.waltz.model.ImmutableIdSelectionOptions) Record1(org.jooq.Record1)

Example 30 with Record1

use of org.jooq.Record1 in project waltz by khartec.

the class AttestationInstanceService method findApplicationAttestationInstancesForKindAndSelector.

public Set<ApplicationAttestationInstanceSummary> findApplicationAttestationInstancesForKindAndSelector(EntityKind attestedKind, Long attestedId, ApplicationAttestationInstanceInfo attestationInfo) {
    Condition condition = getApplicationAttestationFilterCondition(attestationInfo.filters());
    ApplicationIdSelectorFactory applicationIdSelectorFactory = new ApplicationIdSelectorFactory();
    Select<Record1<Long>> appIds = applicationIdSelectorFactory.apply(attestationInfo.selectionOptions());
    return attestationInstanceDao.findApplicationAttestationInstancesForKindAndSelector(attestedKind, attestedId, appIds, condition);
}
Also used : Condition(org.jooq.Condition) ApplicationIdSelectorFactory(org.finos.waltz.data.application.ApplicationIdSelectorFactory) Record1(org.jooq.Record1)

Aggregations

Record1 (org.jooq.Record1)58 Condition (org.jooq.Condition)22 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)16 DSLContext (org.jooq.DSLContext)14 Select (org.jooq.Select)10 ApplicationIdSelectorFactory (org.finos.waltz.data.application.ApplicationIdSelectorFactory)9 EntityReference (org.finos.waltz.model.EntityReference)8 IdSelectionOptions (org.finos.waltz.model.IdSelectionOptions)8 Record (org.jooq.Record)7 IdSelectionOptions (com.khartec.waltz.model.IdSelectionOptions)5 EntityKind (org.finos.waltz.model.EntityKind)5 EntityReference (com.khartec.waltz.model.EntityReference)4 List (java.util.List)4 Collectors (java.util.stream.Collectors)4 LogicalFlowDao (org.finos.waltz.data.logical_flow.LogicalFlowDao)4 EntityReference.mkRef (org.finos.waltz.model.EntityReference.mkRef)4 LogicalFlow (org.finos.waltz.model.logical_flow.LogicalFlow)4 DSL (org.jooq.impl.DSL)4 java.util (java.util)3 ArrayList (java.util.ArrayList)3