@Override public Tree dupNode() { SimpleConditionNode result = new SimpleConditionNode(token); dupChildren(result); return result; }
public void clearInConditions(List<SimpleConditionNode> conditions) { for (SimpleConditionNode condition : conditions) { Tree inToken = condition.getFirstChildWithType(JPA2Lexer.IN); if (inToken != null) { Tree notToken = condition.getFirstChildWithType(JPA2Lexer.NOT); condition.getChildren().clear(); condition.addChild(new CommonTree(new CommonToken(JPA2Lexer.WORD, notToken == null ? "1=0" : "1=1"))); condition.freshenParentAndChildIndexes(); } } }
public boolean isConditionISNULL(SimpleConditionNode condition) { for (int i = 0; i < condition.getChildCount(); i++) { Tree child = condition.getChild(i); if (i < condition.getChildCount() - 1) { Tree nextChild = condition.getChild(i + 1); if ("is".equalsIgnoreCase(child.getText()) && "null".equalsIgnoreCase(nextChild.getText())) { return true; } } } return false; }
public void applyLowerCaseForConditions(List<SimpleConditionNode> conditions) { for (SimpleConditionNode condition : conditions) { List<PathNode> pathNodes = new ArrayList<>(); for (int idx = 0; idx < condition.getChildCount(); idx++) { Tree child = condition.getChild(idx); if (child.getType() == JPA2Lexer.T_SELECTED_FIELD) { pathNodes.add((PathNode) child); } } for (PathNode pathNode : pathNodes) { for (int idx = 0; idx < condition.getChildCount(); idx++) { Tree child = condition.getChild(idx); if (child == pathNode) { CommonTree loweredPathNode = new CommonTree(); loweredPathNode.addChild(new CommonTree(new CommonToken(JPA2Lexer.LOWER, "lower"))); loweredPathNode.addChild(new CommonTree(new CommonToken(JPA2Lexer.LPAREN, "("))); loweredPathNode.addChild(pathNode); loweredPathNode.addChild(new CommonTree(new CommonToken(JPA2Lexer.RPAREN, ")"))); condition.replaceChildren(idx, idx, loweredPathNode); break; } } } condition.freshenParentAndChildIndexes(); } }
public boolean isConditionIN(SimpleConditionNode condition) { return condition.getFirstChildWithType(JPA2Lexer.IN) != null; }
root_1 = (Object)adaptor.becomeRoot(new SimpleConditionNode(T_SIMPLE_CONDITION), root_1); adaptor.addChild(root_1, stream_simple_cond_expression.nextTree()); adaptor.addChild(root_0, root_1);
public boolean isConditionForParameter(SimpleConditionNode condition, String parameterName) { ParameterNode parameter = (ParameterNode) condition.getFirstChildWithType(JPA2Lexer.T_PARAMETER); if (parameter == null) { return false; } if (StringUtils.contains(parameter.getChild(0).getText(), parameterName)) { return true; } if (parameter.getChildCount() > 1 && Objects.equals(parameter.getChild(1).getText(), parameterName)) { return true; } return false; }