use of org.finos.waltz.data.application.ApplicationIdSelectorFactory 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);
}
use of org.finos.waltz.data.application.ApplicationIdSelectorFactory in project waltz by khartec.
the class AttestationInstanceService method findAttestationInstanceSummaryForSelector.
public Set<ApplicationAttestationSummaryCounts> findAttestationInstanceSummaryForSelector(ApplicationAttestationInstanceInfo applicationAttestationInstanceInfo) {
Condition condition = getApplicationAttestationFilterCondition(applicationAttestationInstanceInfo.filters());
ApplicationIdSelectorFactory applicationIdSelectorFactory = new ApplicationIdSelectorFactory();
Select<Record1<Long>> appIds = applicationIdSelectorFactory.apply(applicationAttestationInstanceInfo.selectionOptions());
return attestationInstanceDao.findAttestationInstanceSummaryForSelector(appIds, condition);
}
use of org.finos.waltz.data.application.ApplicationIdSelectorFactory in project waltz by khartec.
the class ScenarioPopulator method main.
public static void main(String[] args) {
LoggingUtilities.configureLogging();
// these two parameters specify which roadmap to use and what set of applications to use in the population.
long roadmapId = 62L;
IdSelectionOptions appSelectionOptions = IdSelectionOptions.mkOpts(mkRef(EntityKind.APP_GROUP, 11261L));
Select<Record1<Long>> appSelector = new ApplicationIdSelectorFactory().apply(appSelectionOptions);
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
dsl.transaction(context -> {
DSLContext tx = context.dsl();
Timestamp now = DateTimeUtilities.nowUtcTimestamp();
scrub(tx, roadmapId);
SelectConditionStep<Record> qry = tx.select(road.NAME).select(mc.NAME).select(s.NAME, s.ID, s.EFFECTIVE_DATE).select(cai.DOMAIN_ITEM_ID, cai.DOMAIN_ITEM_KIND).select(rai.DOMAIN_ITEM_ID, rai.DOMAIN_ITEM_KIND).select(mr.ENTITY_ID, mr.ENTITY_KIND, mr.RATING).select(pd.PLANNED_DECOMMISSION_DATE).select(repl.ENTITY_ID, repl.ENTITY_KIND, repl.PLANNED_COMMISSION_DATE).select(inclCurrent).select(inclReplacement).from(road).innerJoin(mc).on(mc.ID.eq(road.ROW_TYPE_ID)).innerJoin(s).on(s.ROADMAP_ID.eq(road.ID)).innerJoin(cai).on(cai.SCENARIO_ID.eq(s.ID)).and(cai.ORIENTATION.eq(AxisOrientation.COLUMN.name())).innerJoin(rai).on(rai.SCENARIO_ID.eq(s.ID)).and(rai.ORIENTATION.eq(AxisOrientation.ROW.name())).innerJoin(mr).on(mr.MEASURABLE_ID.eq(rai.DOMAIN_ITEM_ID)).leftJoin(pd).on(pd.ENTITY_ID.eq(mr.ENTITY_ID)).and(pd.ENTITY_KIND.eq(mr.ENTITY_KIND)).and(mr.MEASURABLE_ID.eq(pd.MEASURABLE_ID)).leftJoin(repl).on(pd.ID.eq(repl.DECOMMISSION_ID)).where(road.ID.eq(roadmapId)).and(mr.ENTITY_ID.in(appSelector)).and(mr.ENTITY_KIND.eq(EntityKind.APPLICATION.name()));
int[] insertResult = qry.fetch().stream().flatMap(r -> mkRecordsFromRow(tx, r, now)).collect(collectingAndThen(Collectors.toSet(), tx::batchInsert)).execute();
});
}
use of org.finos.waltz.data.application.ApplicationIdSelectorFactory in project waltz by khartec.
the class ApplicationIdSelectorHarness method main.
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
ApplicationIdSelectorFactory factory = new ApplicationIdSelectorFactory();
DSLContext dsl = ctx.getBean(DSLContext.class);
ApplicationService applicationService = ctx.getBean(ApplicationService.class);
IdSelectionOptions options = mkOpts(EntityReference.mkRef(EntityKind.DATA_TYPE, 5000L), HierarchyQueryScope.CHILDREN);
Select<Record1<Long>> selector = factory.apply(options);
dsl.settings().withRenderFormatted(true);
List<Application> apps = applicationService.findByAppIdSelector(options);
System.out.println("--- sz: " + apps.size());
apps.forEach(System.out::println);
System.out.println("--- done");
}
use of org.finos.waltz.data.application.ApplicationIdSelectorFactory in project waltz by khartec.
the class MeasurableRatingExporterHarness method main.
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
ApplicationIdSelectorFactory applicationIdSelectorFactory = new ApplicationIdSelectorFactory();
Select<Record1<Long>> appSelector = applicationIdSelectorFactory.apply(IdSelectionOptions.mkOpts(mkRef(EntityKind.ORG_UNIT, 10L), HierarchyQueryScope.CHILDREN));
//
//
// long categoryId = 1L;
//
// Measurable m = MEASURABLE.as("m");
// Application app = APPLICATION.as("app");
// MeasurableCategory mc = MEASURABLE_CATEGORY.as("mc");
// MeasurableRating mr = MEASURABLE_RATING.as("mr");
// RatingScheme rs = RATING_SCHEME.as("rs");
// RatingSchemeItem rsi = RATING_SCHEME_ITEM.as("rsi");
//
//
// SelectConditionStep<Record> qry = dsl
// .select(m.NAME.as("Taxonomy Item Name"), m.EXTERNAL_ID.as("Taxonomy Item Code"))
// .select(app.NAME.as("App Name"), app.ASSET_CODE.as("App Code"), app.ID.as("App Waltz Id"), app.KIND.as("App Kind"))
// .select(rsi.NAME.as("Rating Name"), rsi.CODE.as("Rating Code"))
// .select(mr.DESCRIPTION.as("Rating Description"), mr.LAST_UPDATED_AT.as("Last Updated Time"), mr.LAST_UPDATED_BY.as("Last Updated By"))
// .from(m)
// .innerJoin(mr).on(mr.MEASURABLE_ID.eq(m.ID))
// .innerJoin(app).on(app.ID.eq(mr.ENTITY_ID))
// .innerJoin(mc).on(mc.ID.eq(m.MEASURABLE_CATEGORY_ID))
// .innerJoin(rs).on(rs.ID.eq(mc.RATING_SCHEME_ID))
// .innerJoin(rsi).on(rsi.SCHEME_ID.eq(rs.ID))
// .where(app.ENTITY_LIFECYCLE_STATUS.eq(EntityLifecycleStatus.ACTIVE.name()))
// .and(m.MEASURABLE_CATEGORY_ID.eq(categoryId))
// .and(mr.ENTITY_KIND.eq(EntityKind.APPLICATION.name()))
// .and(mr.ENTITY_ID.in(appSelector));
//
// String csv = qry.fetch().formatCSV();
// System.out.println(csv);
}
Aggregations