Search in sources :

Example 1 with MeasurableRatingTally

use of org.finos.waltz.model.tally.MeasurableRatingTally 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);
}
Also used : Tally(org.finos.waltz.model.tally.Tally) MeasurableRatingTally(org.finos.waltz.model.tally.MeasurableRatingTally) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) MeasurableIdSelectorFactory(org.finos.waltz.data.measurable.MeasurableIdSelectorFactory) MeasurableRatingDao(org.finos.waltz.data.measurable_rating.MeasurableRatingDao) EntityReference(org.finos.waltz.model.EntityReference) MeasurableRatingTally(org.finos.waltz.model.tally.MeasurableRatingTally) IdSelectionOptions(org.finos.waltz.model.IdSelectionOptions) Record1(org.jooq.Record1)

Aggregations

MeasurableIdSelectorFactory (org.finos.waltz.data.measurable.MeasurableIdSelectorFactory)1 MeasurableRatingDao (org.finos.waltz.data.measurable_rating.MeasurableRatingDao)1 EntityReference (org.finos.waltz.model.EntityReference)1 IdSelectionOptions (org.finos.waltz.model.IdSelectionOptions)1 MeasurableRatingTally (org.finos.waltz.model.tally.MeasurableRatingTally)1 Tally (org.finos.waltz.model.tally.Tally)1 Record1 (org.jooq.Record1)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1