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);
}
Aggregations