Search in sources :

Example 1 with AstJoin

use of com.developmentontheedge.sql.model.AstJoin in project be5 by DevelopmentOnTheEdge.

the class CategoryFilter method processTableRef.

private void processTableRef(AstTableRef ref) {
    String alias = Optional.ofNullable(ref.getAlias()).orElse(entity);
    AstFunNode categoryCondition = DefaultParserContext.FUNC_EQ.node(new AstFieldReference(identifier("classifications"), identifier("categoryID")), AstNumericConstant.of(categoryId));
    AstFunNode recordCondition = DefaultParserContext.FUNC_EQ.node(new AstFieldReference(identifier("classifications"), identifier("recordID")), new AstFieldReference(identifier(alias), identifier(primaryKeyColumn)));
    AstJoin join = JoinType.INNER.node("classifications", DefaultParserContext.FUNC_AND.node(categoryCondition, recordCondition));
    ref.appendSibling(join);
}
Also used : AstJoin(com.developmentontheedge.sql.model.AstJoin) AstFunNode(com.developmentontheedge.sql.model.AstFunNode) AstFieldReference(com.developmentontheedge.sql.model.AstFieldReference)

Aggregations

AstFieldReference (com.developmentontheedge.sql.model.AstFieldReference)1 AstFunNode (com.developmentontheedge.sql.model.AstFunNode)1 AstJoin (com.developmentontheedge.sql.model.AstJoin)1