public boolean isQueryWithJoins() { long identificationVariableCount = queryTree.getAstIdentificationVariableNodes().count(); if (identificationVariableCount > 1) { return true; } long joinCount = queryTree.getAstJoinVariableNodes().count(); return joinCount > 0; }
@Nullable public IdentificationVariableNode getMainIdentificationVariableNode() { List<IdentificationVariableNode> identificationVariables = queryTree.getAstIdentificationVariableNodes() .collect(Collectors.toList()); Optional<String> variableName = queryTree.getAstSelectedPathNodes().findFirst().map(PathNode::getEntityVariableName); if (variableName.isPresent()) { for (IdentificationVariableNode node : identificationVariables) { if (variableName.get().equalsIgnoreCase(node.getVariableName())) { return node; } } } return identificationVariables.stream().findFirst().orElse(null); }