use of org.eclipse.persistence.jpa.jpql.parser.LengthExpression in project eclipselink by eclipse-ee4j.
the class ReportItemBuilder method visit.
@Override
public void visit(LengthExpression expression) {
Expression queryExpression = queryContext.buildExpression(expression, type);
addAttribute(ExpressionTools.EMPTY_STRING, queryExpression, type[0]);
}
use of org.eclipse.persistence.jpa.jpql.parser.LengthExpression in project eclipselink by eclipse-ee4j.
the class AbstractSemanticValidator method validateLikeExpression.
/**
* Validates the string expression of the given <code><b>LIKE</b></code> expression. The test to
* perform is:
* <ul>
* <li>If the string expression is a path expression, validation makes sure it is a basic
* mapping, an association field is not allowed.</li>
* <li>If the encapsulated expression is not a path expression, validation will be redirected to
* that expression but the returned status will not be changed.</li>
* </ul>
*
* @param expression The {@link LengthExpression} to validate by validating its string expression
* @return A number indicating the validation result. {@link #isValid(int, int)} can be used to
* determine the validation status of an expression based on its position
*/
protected int validateLikeExpression(LikeExpression expression) {
int result = 0;
// Validate the "first" expression
if (expression.hasStringExpression()) {
Expression stringExpression = expression.getStringExpression();
// Special case for state field path expression, association field is not allowed
StateFieldPathExpression pathExpression = getStateFieldPathExpression(stringExpression);
if (pathExpression != null) {
boolean valid = validateStateFieldPathExpression(pathExpression, validPathExpressionTypeForStringExpression());
updateStatus(result, 0, valid);
} else {
stringExpression.accept(this);
}
}
// Validate the pattern value
expression.getPatternValue().accept(this);
// Validate the escape character
expression.getEscapeCharacter().accept(this);
return result;
}
Aggregations