Search in sources :

Example 1 with ChangeInitiativeDao

use of com.khartec.waltz.data.change_initiative.ChangeInitiativeDao in project waltz by khartec.

the class ChangeInitiativeHarness method main.

public static void main(String[] args) throws ParseException {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
    DSLContext dsl = ctx.getBean(DSLContext.class);
    ChangeInitiativeDao dao = ctx.getBean(ChangeInitiativeDao.class);
    ChangeInitiative changeInitiative = dao.getById(1L);
    System.out.println(changeInitiative);
    SelectConditionStep<Record1<Long>> ouHier = dsl.selectDistinct(ENTITY_HIERARCHY.ANCESTOR_ID).from(ENTITY_HIERARCHY).where(ENTITY_HIERARCHY.ID.eq(210L).and(ENTITY_HIERARCHY.KIND.eq(EntityKind.ORG_UNIT.name())));
    SelectConditionStep<Record1<Long>> baseIdSelector = dsl.selectDistinct(CHANGE_INITIATIVE.ID).from(CHANGE_INITIATIVE).where(CHANGE_INITIATIVE.ORGANISATIONAL_UNIT_ID.in(ouHier));
    SelectConditionStep<Record1<Long>> ciHier = dsl.selectDistinct(ENTITY_HIERARCHY.ANCESTOR_ID).from(ENTITY_HIERARCHY).where(ENTITY_HIERARCHY.ID.in(baseIdSelector).and(ENTITY_HIERARCHY.KIND.eq(EntityKind.CHANGE_INITIATIVE.name())));
    dsl.select(CHANGE_INITIATIVE.NAME).from(CHANGE_INITIATIVE).where(CHANGE_INITIATIVE.ID.in(ciHier)).forEach(System.out::println);
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) ChangeInitiativeDao(com.khartec.waltz.data.change_initiative.ChangeInitiativeDao) ChangeInitiative(com.khartec.waltz.model.change_initiative.ChangeInitiative) DSLContext(org.jooq.DSLContext) Record1(org.jooq.Record1)

Aggregations

ChangeInitiativeDao (com.khartec.waltz.data.change_initiative.ChangeInitiativeDao)1 ChangeInitiative (com.khartec.waltz.model.change_initiative.ChangeInitiative)1 DSLContext (org.jooq.DSLContext)1 Record1 (org.jooq.Record1)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1