use of org.finos.waltz.data.application.ApplicationIdSelectorFactory in project waltz by khartec.
the class MeasurableIdSelectorFactory method mkViaAppSelector.
private Select<Record1<Long>> mkViaAppSelector(IdSelectionOptions options) {
ApplicationIdSelectorFactory applicationIdSelectorFactory = new ApplicationIdSelectorFactory();
Select<Record1<Long>> validAppIds = applicationIdSelectorFactory.apply(options);
SelectConditionStep<Record1<Long>> measurableIds = DSL.selectDistinct(MEASURABLE_RATING.MEASURABLE_ID).from(MEASURABLE_RATING).where(MEASURABLE_RATING.ENTITY_ID.in(validAppIds));
return DSL.selectDistinct(ENTITY_HIERARCHY.ANCESTOR_ID).from(ENTITY_HIERARCHY).where(ENTITY_HIERARCHY.KIND.eq(EntityKind.MEASURABLE.name())).and(ENTITY_HIERARCHY.ID.in(measurableIds));
}
use of org.finos.waltz.data.application.ApplicationIdSelectorFactory in project waltz by khartec.
the class ChangeReporter method main.
public static void main(String[] args) throws IOException {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
ApplicationIdSelectorFactory selectorFactory = new ApplicationIdSelectorFactory();
LocalDateTime exerciseStart = LocalDateTime.of(2018, 06, 04, 0, 1).truncatedTo(ChronoUnit.DAYS);
LocalDateTime dayBeforeYesterday = LocalDateTime.now().truncatedTo(ChronoUnit.DAYS).minusDays(1);
LocalDateTime yesterday = LocalDateTime.now().truncatedTo(ChronoUnit.DAYS);
// BCBS239
EntityReference appGroupRef = EntityReference.mkRef(EntityKind.APP_GROUP, 10862);
Select<Record1<Long>> appSelector = mkSelector(selectorFactory, appGroupRef);
Tuple3<String, LocalDateTime, LocalDateTime> dayPeriod = Tuple.tuple("day", dayBeforeYesterday, yesterday);
Tuple3<String, LocalDateTime, LocalDateTime> cumulativePeriod = Tuple.tuple("cumulative", exerciseStart, yesterday);
dumpReport(dsl, dayPeriod, appGroupRef, appSelector);
dumpReport(dsl, cumulativePeriod, appGroupRef, appSelector);
}
use of org.finos.waltz.data.application.ApplicationIdSelectorFactory in project waltz by khartec.
the class ServerHarness method main.
public static void main(String[] args) {
System.out.println("start");
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIBaseConfiguration.class);
ServerInformationDao serverInfoDao = ctx.getBean(ServerInformationDao.class);
IdSelectionOptions mOpts = mkOpts(mkRef(EntityKind.MEASURABLE, 1), HierarchyQueryScope.CHILDREN);
IdSelectionOptions pOpts = mkOpts(mkRef(EntityKind.PERSON, 2), HierarchyQueryScope.CHILDREN);
IdSelectionOptions ouOpts = mkOpts(mkRef(EntityKind.ORG_UNIT, 3), HierarchyQueryScope.CHILDREN);
IdSelectionOptions agOpts = mkOpts(mkRef(EntityKind.APP_GROUP, 4), HierarchyQueryScope.EXACT);
System.out.println("start timer");
ListUtilities.asList(mOpts, pOpts, ouOpts, agOpts).forEach(opts -> {
FunctionUtilities.time("stats: " + opts.entityReference(), () -> {
Select<Record1<Long>> selector = new ApplicationIdSelectorFactory().apply(opts);
return serverInfoDao.calculateStatsForAppSelector(selector);
});
});
System.out.println("end");
}
Aggregations