Search in sources :

Example 1 with MeasurableIdSelectorFactory

use of com.khartec.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 = ctx.getBean(MeasurableIdSelectorFactory.class);
    MeasurableService measurableService = ctx.getBean(MeasurableService.class);
    EntityReference ref = mkRef(EntityKind.FLOW_DIAGRAM, 2);
    IdSelectionOptions options = mkOpts(ref, HierarchyQueryScope.EXACT);
    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("-----");
}
Also used : Measurable(com.khartec.waltz.model.measurable.Measurable) HierarchyQueryScope(com.khartec.waltz.model.HierarchyQueryScope) EntityReference(com.khartec.waltz.model.EntityReference) OptionalUtilities(com.khartec.waltz.common.OptionalUtilities) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) EntityKind(com.khartec.waltz.model.EntityKind) MeasurableService(com.khartec.waltz.service.measurable.MeasurableService) List(java.util.List) IdSelectionOptions(com.khartec.waltz.model.IdSelectionOptions) DIConfiguration(com.khartec.waltz.service.DIConfiguration) Record1(org.jooq.Record1) MeasurableIdSelectorFactory(com.khartec.waltz.data.measurable.MeasurableIdSelectorFactory) IdSelectionOptions.mkOpts(com.khartec.waltz.model.IdSelectionOptions.mkOpts) Select(org.jooq.Select) EntityReference.mkRef(com.khartec.waltz.model.EntityReference.mkRef) Measurable(com.khartec.waltz.model.measurable.Measurable) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) MeasurableIdSelectorFactory(com.khartec.waltz.data.measurable.MeasurableIdSelectorFactory) EntityReference(com.khartec.waltz.model.EntityReference) MeasurableService(com.khartec.waltz.service.measurable.MeasurableService) IdSelectionOptions(com.khartec.waltz.model.IdSelectionOptions) Record1(org.jooq.Record1)

Aggregations

OptionalUtilities (com.khartec.waltz.common.OptionalUtilities)1 MeasurableIdSelectorFactory (com.khartec.waltz.data.measurable.MeasurableIdSelectorFactory)1 EntityKind (com.khartec.waltz.model.EntityKind)1 EntityReference (com.khartec.waltz.model.EntityReference)1 EntityReference.mkRef (com.khartec.waltz.model.EntityReference.mkRef)1 HierarchyQueryScope (com.khartec.waltz.model.HierarchyQueryScope)1 IdSelectionOptions (com.khartec.waltz.model.IdSelectionOptions)1 IdSelectionOptions.mkOpts (com.khartec.waltz.model.IdSelectionOptions.mkOpts)1 Measurable (com.khartec.waltz.model.measurable.Measurable)1 DIConfiguration (com.khartec.waltz.service.DIConfiguration)1 MeasurableService (com.khartec.waltz.service.measurable.MeasurableService)1 List (java.util.List)1 Record1 (org.jooq.Record1)1 Select (org.jooq.Select)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1