use of org.finos.waltz.data.measurable.MeasurableIdSelectorFactory in project waltz by khartec.
the class MeasurableHarness method main.
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
MeasurableIdSelectorFactory factory = new MeasurableIdSelectorFactory();
MeasurableService measurableService = ctx.getBean(MeasurableService.class);
EntityReference ref = mkRef(EntityKind.PERSON, 172272);
IdSelectionOptions options = mkOpts(ref, HierarchyQueryScope.CHILDREN);
Select<Record1<Long>> selector = factory.apply(options);
System.out.println("--selector");
System.out.println(selector);
System.out.println("---");
List<Measurable> measurables = measurableService.findByMeasurableIdSelector(options);
measurables.forEach(System.out::println);
System.out.println("-----");
measurables.stream().filter(m -> OptionalUtilities.contentsEqual(m.id(), 486L)).forEach(System.out::println);
System.out.println(measurables.size());
}
use of org.finos.waltz.data.measurable.MeasurableIdSelectorFactory in project waltz by khartec.
the class MeasurableRatingHarness method main.
public static void main(String[] args) throws ParseException {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
MeasurableRatingDao measurableRatingDao = ctx.getBean(MeasurableRatingDao.class);
MeasurableIdSelectorFactory measurableIdSelectorFactory = new MeasurableIdSelectorFactory();
EntityReference direct = mkRef(MEASURABLE, 18310);
EntityReference indirect = mkRef(MEASURABLE, 18064);
IdSelectionOptions directOpts = IdSelectionOptions.mkOpts(direct, CHILDREN);
IdSelectionOptions indirectOpts = IdSelectionOptions.mkOpts(indirect, CHILDREN);
Select<Record1<Long>> directSelector = measurableIdSelectorFactory.apply(directOpts);
Select<Record1<Long>> indirectSelector = measurableIdSelectorFactory.apply(indirectOpts);
List<MeasurableRatingTally> directTallies = measurableRatingDao.statsForRelatedMeasurable(directSelector);
List<MeasurableRatingTally> indirectTallies = measurableRatingDao.statsForRelatedMeasurable(indirectSelector);
List<Tally<Long>> tallies = measurableRatingDao.tallyByMeasurableCategoryId(1L);
System.out.println(tallies);
}
use of org.finos.waltz.data.measurable.MeasurableIdSelectorFactory in project waltz by khartec.
the class RemoveTaxonomy method main.
public static void main(String[] args) {
final String categoryExtId = "FUNCTION_3_1";
LOG.debug("Starting removal process for taxonomy {}", categoryExtId);
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
ctx.getBean(DSLContext.class).transaction(tx -> {
DSLContext dsl = DSL.using(tx);
Long categoryId = dsl.select(MEASURABLE_CATEGORY.ID).from(MEASURABLE_CATEGORY).where(MEASURABLE_CATEGORY.EXTERNAL_ID.eq(categoryExtId)).fetchOne(MEASURABLE_CATEGORY.ID);
if (categoryId == null) {
LOG.error("Could not find taxonomy with external id: {}", categoryExtId);
return;
}
MeasurableIdSelectorFactory selectorFactory = new MeasurableIdSelectorFactory();
Select<Record1<Long>> measurableIdSelector = selectorFactory.apply(mkOpts(mkRef(EntityKind.MEASURABLE_CATEGORY, categoryId), HierarchyQueryScope.EXACT));
removeAssociatedRatings(dsl, measurableIdSelector);
removeBookmarks(dsl, measurableIdSelector);
removeEntityRelationships(dsl, measurableIdSelector);
removeFlowDiagramLinks(dsl, measurableIdSelector);
removeEntitySvgDiagram(dsl, measurableIdSelector);
removeInvolvements(dsl, measurableIdSelector);
removeRatingScheme(dsl, categoryId);
removeMeasurables(dsl, measurableIdSelector);
removeCategory(dsl, categoryId);
throw new IllegalArgumentException("Aborting, comment this line if you really mean to execute this removal");
});
}
use of org.finos.waltz.data.measurable.MeasurableIdSelectorFactory in project waltz by khartec.
the class UnionHarness method measurableIdSelectorFactory_mkForFlowDiagram.
private static void measurableIdSelectorFactory_mkForFlowDiagram(ApplicationContext ctx) {
Select<Record1<Long>> selector = new MeasurableIdSelectorFactory().apply(mkOpts(mkRef(EntityKind.FLOW_DIAGRAM, 12L)));
List<Measurable> measurables = ctx.getBean(MeasurableDao.class).findByMeasurableIdSelector(selector);
System.out.println(measurables.size());
}
Aggregations