use of org.jooq.DSLContext 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 = ctx.getBean(LogicalFlowIdSelectorFactory.class);
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());
}
use of org.jooq.DSLContext in project waltz by khartec.
the class DataTypeUsageHarness method main.
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
DataTypeUsageDao dao = ctx.getBean(DataTypeUsageDao.class);
DataTypeUsageService svc = ctx.getBean(DataTypeUsageService.class);
long st = System.currentTimeMillis();
dao.recalculateForAllApplications();
List<DataTypeUsage> dtUsages = svc.findForDataTypeSelector(mkOpts(mkRef(EntityKind.DATA_TYPE, 3000), HierarchyQueryScope.CHILDREN));
System.out.println("Data Type usages: " + dtUsages.size());
List<DataTypeUsage> actorUsages = svc.findForEntity(mkRef(EntityKind.ACTOR, 16L));
System.out.println("Actor usages: " + actorUsages.size());
System.out.println("Took " + (System.currentTimeMillis() - st));
}
use of org.jooq.DSLContext in project waltz by khartec.
the class DatabaseHarness method main.
public static void main(String[] args) throws ParseException {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
DatabaseInformationService databaseInfoService = ctx.getBean(DatabaseInformationService.class);
DatabaseInformationDao databaseDao = ctx.getBean(DatabaseInformationDao.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
/*
List<DatabaseInformation> dbs = databaseDao.findByApplicationId(801L);
System.out.println(dbs.size());
List<Tally<String>> eolCounts = calculateStringTallies(
dsl,
DATABASE_INFORMATION,
DSL.when(DATABASE_INFORMATION.END_OF_LIFE_DATE.lt(DSL.currentDate()), DSL.inline(EndOfLifeStatus.END_OF_LIFE.name()))
.otherwise(DSL.inline(EndOfLifeStatus.NOT_END_OF_LIFE.name())),
DSL.trueCondition());
System.out.println(eolCounts);
*/
IdSelectionOptions options = ImmutableIdSelectionOptions.builder().entityReference(ImmutableEntityReference.builder().kind(EntityKind.ORG_UNIT).id(10).build()).scope(HierarchyQueryScope.CHILDREN).build();
for (int i = 0; i < 5; i++) {
HarnessUtilities.time("stats", () -> databaseInfoService.findStatsForAppIdSelector(options));
}
}
use of org.jooq.DSLContext in project waltz by khartec.
the class DrillGridDefinitionHarness method main.
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
DrillGridDefinitionDao dao = ctx.getBean(DrillGridDefinitionDao.class);
dao.findAll().stream().forEach(System.out::println);
}
use of org.jooq.DSLContext in project waltz by khartec.
the class LogicalFlowDecoratorRatingsServiceHarness method main.
public static void main(String[] args) throws SQLException {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
AuthoritativeSourceService authoritativeSourceService = ctx.getBean(AuthoritativeSourceService.class);
List<AuthoritativeSource> authSources = authoritativeSourceService.findAll();
OrganisationalUnitService organisationalUnitService = ctx.getBean(OrganisationalUnitService.class);
OrganisationalUnitDao organisationalUnitDao = ctx.getBean(OrganisationalUnitDao.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
dsl.select(ORGANISATIONAL_UNIT.fields()).from(ORGANISATIONAL_UNIT).fetch(organisationalUnitDao.TO_DOMAIN_MAPPER);
EntityHierarchyService hierarchyService = ctx.getBean(EntityHierarchyService.class);
List<OrganisationalUnit> allOrgUnits = organisationalUnitService.findAll();
List<FlatNode<OrganisationalUnit, Long>> ouNodes = ListUtilities.map(allOrgUnits, ou -> new FlatNode<>(ou.id().get(), ou.parentId(), ou));
Forest<OrganisationalUnit, Long> ouForest = HierarchyUtilities.toForest(ouNodes);
Map<Long, Node<OrganisationalUnit, Long>> nodeMap = ouForest.getAllNodes();
}
Aggregations