Search in sources :

Example 1 with DataType

use of org.finos.waltz.schema.tables.DataType 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);
}
Also used : Condition(org.jooq.Condition) DataTypeUsage(org.finos.waltz.schema.tables.DataTypeUsage) DataType(org.finos.waltz.schema.tables.DataType) EntityHierarchy(org.finos.waltz.schema.tables.EntityHierarchy)

Aggregations

DataType (org.finos.waltz.schema.tables.DataType)1 DataTypeUsage (org.finos.waltz.schema.tables.DataTypeUsage)1 EntityHierarchy (org.finos.waltz.schema.tables.EntityHierarchy)1 Condition (org.jooq.Condition)1