Search in sources :

Example 1 with TableExpression

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);
        }
    }
}
Also used : TableExpression(org.eclipse.persistence.jpa.jpql.parser.TableExpression)

Example 2 with TableExpression

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);
        }
    }
}
Also used : TableExpression(org.eclipse.persistence.jpa.jpql.parser.TableExpression)

Example 3 with TableExpression

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);
            }
        }
    }
}
Also used : ExtractExpression(org.eclipse.persistence.jpa.jpql.parser.ExtractExpression) CollectionValuedPathExpression(org.eclipse.persistence.jpa.jpql.parser.CollectionValuedPathExpression) StateFieldPathExpression(org.eclipse.persistence.jpa.jpql.parser.StateFieldPathExpression) InExpression(org.eclipse.persistence.jpa.jpql.parser.InExpression) BadExpression(org.eclipse.persistence.jpa.jpql.parser.BadExpression) CollectionExpression(org.eclipse.persistence.jpa.jpql.parser.CollectionExpression) RegexpExpression(org.eclipse.persistence.jpa.jpql.parser.RegexpExpression) CastExpression(org.eclipse.persistence.jpa.jpql.parser.CastExpression) Expression(org.eclipse.persistence.jpa.jpql.parser.Expression) FunctionExpression(org.eclipse.persistence.jpa.jpql.parser.FunctionExpression) TableExpression(org.eclipse.persistence.jpa.jpql.parser.TableExpression) NullExpression(org.eclipse.persistence.jpa.jpql.parser.NullExpression)

Aggregations

TableExpression (org.eclipse.persistence.jpa.jpql.parser.TableExpression)3 BadExpression (org.eclipse.persistence.jpa.jpql.parser.BadExpression)1 CastExpression (org.eclipse.persistence.jpa.jpql.parser.CastExpression)1 CollectionExpression (org.eclipse.persistence.jpa.jpql.parser.CollectionExpression)1 CollectionValuedPathExpression (org.eclipse.persistence.jpa.jpql.parser.CollectionValuedPathExpression)1 Expression (org.eclipse.persistence.jpa.jpql.parser.Expression)1 ExtractExpression (org.eclipse.persistence.jpa.jpql.parser.ExtractExpression)1 FunctionExpression (org.eclipse.persistence.jpa.jpql.parser.FunctionExpression)1 InExpression (org.eclipse.persistence.jpa.jpql.parser.InExpression)1 NullExpression (org.eclipse.persistence.jpa.jpql.parser.NullExpression)1 RegexpExpression (org.eclipse.persistence.jpa.jpql.parser.RegexpExpression)1 StateFieldPathExpression (org.eclipse.persistence.jpa.jpql.parser.StateFieldPathExpression)1