Search in sources :

Example 1 with LOGICAL_FLOW_DECORATOR

use of com.khartec.waltz.schema.tables.LogicalFlowDecorator.LOGICAL_FLOW_DECORATOR in project waltz by khartec.

the class FlowLineageHarness method findIncomingByRefs.

private static void findIncomingByRefs(DSLContext dsl, Set<EntityReference> entityReferences) {
    Map<EntityKind, Collection<EntityReference>> refsByKind = groupBy(ref -> ref.kind(), entityReferences);
    Condition anyTargetMatches = refsByKind.entrySet().stream().map(entry -> LOGICAL_FLOW.TARGET_ENTITY_KIND.eq(entry.getKey().name()).and(LOGICAL_FLOW.TARGET_ENTITY_ID.in(map(entry.getValue(), ref -> ref.id())))).collect(Collectors.reducing(DSL.falseCondition(), (acc, c) -> acc.or(c)));
    System.out.println(anyTargetMatches);
    Field<String> SOURCE_NAME_FIELD = EntityNameUtilities.mkEntityNameField(LOGICAL_FLOW.SOURCE_ENTITY_ID, LOGICAL_FLOW.SOURCE_ENTITY_KIND, newArrayList(EntityKind.APPLICATION, EntityKind.ACTOR));
    dsl.select(LOGICAL_FLOW.fields()).select(SOURCE_NAME_FIELD).from(LOGICAL_FLOW).where(anyTargetMatches.and(LogicalFlowDao.NOT_REMOVED)).forEach(System.out::println);
    dsl.select().from(LOGICAL_FLOW_DECORATOR).innerJoin(LOGICAL_FLOW).on(LOGICAL_FLOW.ID.eq(LOGICAL_FLOW_DECORATOR.LOGICAL_FLOW_ID)).where(anyTargetMatches).forEach(System.out::println);
}
Also used : Condition(org.jooq.Condition) DSL(org.jooq.impl.DSL) SetUtilities(com.khartec.waltz.common.SetUtilities) ACTOR(com.khartec.waltz.model.EntityKind.ACTOR) ParseException(org.jooq.tools.json.ParseException) Collection(java.util.Collection) MapUtilities.groupBy(com.khartec.waltz.common.MapUtilities.groupBy) Set(java.util.Set) EntityReference(com.khartec.waltz.model.EntityReference) Field(org.jooq.Field) ListUtilities.newArrayList(com.khartec.waltz.common.ListUtilities.newArrayList) Collectors(java.util.stream.Collectors) Condition(org.jooq.Condition) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) EntityKind(com.khartec.waltz.model.EntityKind) CollectionUtilities.map(com.khartec.waltz.common.CollectionUtilities.map) DIConfiguration(com.khartec.waltz.service.DIConfiguration) LOGICAL_FLOW_DECORATOR(com.khartec.waltz.schema.tables.LogicalFlowDecorator.LOGICAL_FLOW_DECORATOR) EntityNameUtilities(com.khartec.waltz.data.EntityNameUtilities) LogicalFlowDao(com.khartec.waltz.data.logical_flow.LogicalFlowDao) Map(java.util.Map) APPLICATION(com.khartec.waltz.model.EntityKind.APPLICATION) DSLContext(org.jooq.DSLContext) EntityReference.mkRef(com.khartec.waltz.model.EntityReference.mkRef) LOGICAL_FLOW(com.khartec.waltz.schema.tables.LogicalFlow.LOGICAL_FLOW) Collection(java.util.Collection) EntityKind(com.khartec.waltz.model.EntityKind)

Aggregations

CollectionUtilities.map (com.khartec.waltz.common.CollectionUtilities.map)1 ListUtilities.newArrayList (com.khartec.waltz.common.ListUtilities.newArrayList)1 MapUtilities.groupBy (com.khartec.waltz.common.MapUtilities.groupBy)1 SetUtilities (com.khartec.waltz.common.SetUtilities)1 EntityNameUtilities (com.khartec.waltz.data.EntityNameUtilities)1 LogicalFlowDao (com.khartec.waltz.data.logical_flow.LogicalFlowDao)1 EntityKind (com.khartec.waltz.model.EntityKind)1 ACTOR (com.khartec.waltz.model.EntityKind.ACTOR)1 APPLICATION (com.khartec.waltz.model.EntityKind.APPLICATION)1 EntityReference (com.khartec.waltz.model.EntityReference)1 EntityReference.mkRef (com.khartec.waltz.model.EntityReference.mkRef)1 LOGICAL_FLOW (com.khartec.waltz.schema.tables.LogicalFlow.LOGICAL_FLOW)1 LOGICAL_FLOW_DECORATOR (com.khartec.waltz.schema.tables.LogicalFlowDecorator.LOGICAL_FLOW_DECORATOR)1 DIConfiguration (com.khartec.waltz.service.DIConfiguration)1 Collection (java.util.Collection)1 Map (java.util.Map)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Condition (org.jooq.Condition)1 DSLContext (org.jooq.DSLContext)1