use of org.finos.waltz.schema.tables.DataTypeUsage in project waltz by khartec.
the class QuestionAppPredicateNamespace method dataTypeUsages.
public Set<String> dataTypeUsages(String name) {
DataTypeUsage dtu = DATA_TYPE_USAGE.as("dtu");
DataType dt = DATA_TYPE.as("dt");
EntityHierarchy eh = ENTITY_HIERARCHY.as("eh");
Condition dtNameMatches = dt.CODE.eq(name).or(dt.NAME.eq(name));
Condition subjectMatches = dtu.ENTITY_ID.eq(subjectRef.id()).and(dtu.ENTITY_KIND.eq(subjectRef.kind().name()));
return dsl.select(dtu.USAGE_KIND).from(dt).innerJoin(eh).on(eh.ANCESTOR_ID.eq(dt.ID).and(eh.KIND.eq(EntityKind.DATA_TYPE.name()))).innerJoin(dtu).on(dtu.DATA_TYPE_ID.eq(eh.ID)).where(dtNameMatches).and(subjectMatches).fetchSet(dtu.USAGE_KIND);
}
Aggregations