use of com.khartec.waltz.schema.tables.PhysicalFlow.PHYSICAL_FLOW in project waltz by khartec.
the class PhysicalFlowSearchDao method searchReports.
/**
* A report is a physical flow which goes to an
* external actor
* @param query
* @return
*/
public List<EntityReference> searchReports(String query) {
if (isEmpty(query)) {
return emptyList();
}
Field<String> nameField = DSL.concat(PHYSICAL_SPECIFICATION.NAME, DSL.value(" - "), ACTOR.NAME);
Condition termMatcher = mkTerms(query).stream().reduce(DSL.trueCondition(), (acc, t) -> nameField.like("%" + t + "%"), (acc, t) -> acc.and(t));
return dsl.select(PHYSICAL_FLOW.ID, nameField).from(PHYSICAL_FLOW).innerJoin(PHYSICAL_SPECIFICATION).on(PHYSICAL_FLOW.SPECIFICATION_ID.eq(PHYSICAL_SPECIFICATION.ID)).innerJoin(LOGICAL_FLOW).on(LOGICAL_FLOW.ID.eq(PHYSICAL_FLOW.LOGICAL_FLOW_ID)).innerJoin(ACTOR).on(LOGICAL_FLOW.TARGET_ENTITY_ID.eq(ACTOR.ID).and(ACTOR.IS_EXTERNAL.eq(true))).where(LOGICAL_FLOW.TARGET_ENTITY_KIND.eq(EntityKind.ACTOR.name())).and(termMatcher).fetch().stream().map(r -> mkRef(EntityKind.PHYSICAL_FLOW, r.value1(), r.value2())).collect(Collectors.toList());
}
Aggregations