use of com.haulmont.cuba.core.sys.jpql.transform.NodesFinder in project cuba by cuba-platform.
the class QueryTreeAnalyzer method findAllConditions.
public List<SimpleConditionNode> findAllConditions() {
NodesFinder<SimpleConditionNode> nodesFinder = new NodesFinder<>(SimpleConditionNode.class);
TreeVisitor treeVisitor = new TreeVisitor();
treeVisitor.visit(tree, nodesFinder);
return nodesFinder.getFoundNodes();
}
use of com.haulmont.cuba.core.sys.jpql.transform.NodesFinder in project cuba by cuba-platform.
the class QueryTreeAnalyzer method hasJoins.
public boolean hasJoins() {
CommonTree sourceNode = (CommonTree) tree.getFirstChildWithType(JPA2Lexer.T_SOURCES);
List<SelectionSourceNode> selectionSourceNodes = getChildrenByClass(sourceNode, SelectionSourceNode.class);
if (selectionSourceNodes.size() > 1) {
return true;
} else if (selectionSourceNodes.size() == 1) {
NodesFinder<JoinVariableNode> nodesFinder = new NodesFinder<>(JoinVariableNode.class);
TreeVisitor treeVisitor = new TreeVisitor();
treeVisitor.visit(tree, nodesFinder);
return !nodesFinder.getFoundNodes().isEmpty();
} else {
return false;
}
}
Aggregations