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