use of org.eclipse.persistence.jpa.jpql.parser.TableExpression in project eclipselink by eclipse-ee4j.
the class EclipseLinkContentAssistVisitor method visit.
@Override
public void visit(TableVariableDeclaration expression) {
super.visit(expression);
TableExpression tableExpression = expression.getTableExpression();
int position = queryPosition.getPosition(expression) - corrections.peek();
int length = tableExpression.getLength();
// After "TABLE()"
if (expression.hasSpaceAfterTableExpression()) {
length += SPACE_LENGTH;
// Right after "TABLE() "
if (isPositionWithin(position, length, AS) && isComplete(tableExpression)) {
addIdentifier(AS);
}
}
}
use of org.eclipse.persistence.jpa.jpql.parser.TableExpression in project eclipselink by eclipse-ee4j.
the class EclipseLinkGrammarValidator method visit.
@Override
public void visit(TableVariableDeclaration expression) {
// Wrong JPA version
if (!isEclipseLink()) {
addProblem(expression, TableVariableDeclaration_InvalidJPAVersion);
} else {
TableExpression tableExpression = expression.getTableExpression();
// Validate the table expression
tableExpression.accept(this);
// The identification variable is missing
if (!expression.hasIdentificationVariable()) {
int startPosition = position(expression) + length(tableExpression) + (expression.hasSpaceAfterTableExpression() ? 1 : 0) + (expression.hasAs() ? 2 : 0) + (expression.hasSpaceAfterAs() ? 1 : 0);
addProblem(expression, startPosition, TableVariableDeclaration_MissingIdentificationVariable);
} else // Validate the identification variable
{
expression.getIdentificationVariable().accept(this);
}
}
}
use of org.eclipse.persistence.jpa.jpql.parser.TableExpression in project eclipselink by eclipse-ee4j.
the class AbstractEclipseLinkSemanticValidator method visit.
@Override
public void visit(TableExpression expression) {
super.visit(expression);
// No need to validate if no extension was defined
if (extension != EclipseLinkSemanticValidatorExtension.NULL_EXTENSION) {
Expression tableNameExpression = expression.getExpression();
String tableName = literal(tableNameExpression, LiteralType.STRING_LITERAL);
if (tableName != ExpressionTools.EMPTY_STRING) {
tableName = ExpressionTools.unquote(tableName);
if ((tableName.length() > 0) && !extension.tableExists(tableName)) {
addProblem(tableNameExpression, JPQLQueryProblemMessages.TableExpression_InvalidTableName);
}
}
}
}
Aggregations