traverse(((LogicalExpression) expression).getLeftExpression(), m, kunderaMetadata, kunderaQuery, false); kunderaQuery.addFilterClause(((LogicalExpression) expression).getIdentifier()); traverse(((LogicalExpression) expression).getRightExpression(), m, kunderaMetadata, kunderaQuery, false);
/** * On logical expression. * * @param expression * the expression * @param m * the m * @param idColumn * the id column * @return the filter */ private Filter onLogicalExpression(Expression expression, EntityMetadata m, String idColumn) { FilterList filterList = checkOperationAndReturnFilter((LogicalExpression) expression); Filter f = traverse(((LogicalExpression) expression).getLeftExpression(), m, idColumn); if (f != null) { filterList.addFilter(f); } f = traverse(((LogicalExpression) expression).getRightExpression(), m, idColumn); if (f != null) { filterList.addFilter(f); } return filterList.getFilters().size() == 0 ? null : filterList; }
/** * Check operation and return filter. * * @param expression * the expression * @return the filter list */ private FilterList checkOperationAndReturnFilter(LogicalExpression expression) { if (expression.getIdentifier().equals(HBaseUtils.AND)) { return new FilterList(FilterList.Operator.MUST_PASS_ALL); } else if (expression.getIdentifier().equals(HBaseUtils.OR)) { return new FilterList(FilterList.Operator.MUST_PASS_ONE); } return null; }
/** * Visits the given {@link LogicalExpression} and attempts to find valid proposals. * * @param expression The {@link LogicalExpression} to inspect */ protected void visitLogicalExpression(LogicalExpression expression) { if (isFollowingInvalidExpression(expression)) { return; } int position = queryPosition.getPosition(expression) - corrections.peek(); String identifier = expression.getIdentifier(); int length = 0; if (expression.hasLeftExpression()) { length += expression.getLeftExpression().getLength() + SPACE_LENGTH; } // Within "AND" or "OR" if (isPositionWithin(position, length, identifier)) { proposals.addIdentifier(identifier); } // After "AND " or "OR " else if (expression.hasSpaceAfterIdentifier()) { length += identifier.length() + SPACE_LENGTH; // Right after "AND " or "OR " if (position == length) { addIdentificationVariables(); addFunctionIdentifiers(expression.getRightExpressionQueryBNFId()); } } }
/** * {@inheritDoc} */ @Override protected boolean isParsingComplete(WordParser wordParser, String word, Expression expression) { return word.equalsIgnoreCase(AND) || word.equalsIgnoreCase(OR) || super.isParsingComplete(wordParser, word, expression); } }
/** * {@inheritDoc} */ public final JPQLQueryBNF getQueryBNF() { return getQueryBNF(ConditionalExpressionBNF.ID); }
/** * {@inheritDoc} */ @Override protected String parseIdentifier(WordParser wordParser) { return getText(); } }
/** * Populate logical filter builder. * * @param logicalExp * the logical exp * @param m * the m * @param entity * the entity * @return the filter builder */ private QueryBuilder populateLogicalFilterBuilder(Expression logicalExp, EntityMetadata m) { String identifier = ((LogicalExpression) logicalExp).getIdentifier(); return (identifier.equalsIgnoreCase(LogicalExpression.AND)) ? getAndFilterBuilder(logicalExp, m) : (identifier .equalsIgnoreCase(LogicalExpression.OR)) ? getOrFilterBuilder(logicalExp, m) : null; }
/** * {@inheritDoc} */ @Override protected boolean isParsingComplete(WordParser wordParser, String word, Expression expression) { return word.equalsIgnoreCase(AND) || word.equalsIgnoreCase(OR) || super.isParsingComplete(wordParser, word, expression); } }
/** * {@inheritDoc} */ public final JPQLQueryBNF getQueryBNF() { return getQueryBNF(ConditionalExpressionBNF.ID); }
/** * {@inheritDoc} */ @Override protected String parseIdentifier(WordParser wordParser) { return getText(); } }
((LogicalExpression) conditionalExpression).getIdentifier());
protected void validateLogicalExpression(LogicalExpression expression, String leftExpressionQueryBNF, String rightExpressionQueryBNF) { validateCompoundExpression( expression, expression.getIdentifier(), LogicalExpression_MissingLeftExpression, LogicalExpression_InvalidLeftExpression, LogicalExpression_MissingRightExpression, LogicalExpression_InvalidRightExpression, leftExpressionQueryBNF, rightExpressionQueryBNF ); }
protected void validateLogicalExpression(LogicalExpression expression, String leftExpressionQueryBNF, String rightExpressionQueryBNF) { validateCompoundExpression( expression, expression.getIdentifier(), LogicalExpression_MissingLeftExpression, LogicalExpression_InvalidLeftExpression, LogicalExpression_MissingRightExpression, LogicalExpression_InvalidRightExpression, leftExpressionQueryBNF, rightExpressionQueryBNF ); }
/** * Populate logical filter builder. * * @param logicalExp * the logical exp * @param m * the m * @param entity * the entity * @return the filter builder */ private QueryBuilder populateLogicalFilterBuilder(Expression logicalExp, EntityMetadata m) { String identifier = ((LogicalExpression) logicalExp).getIdentifier(); return (identifier.equalsIgnoreCase(LogicalExpression.AND)) ? getAndFilterBuilder(logicalExp, m) : (identifier .equalsIgnoreCase(LogicalExpression.OR)) ? getOrFilterBuilder(logicalExp, m) : null; }
((LogicalExpression) conditionalExpression).getIdentifier());