Search in sources :

Example 6 with IdentificationVariable

use of org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable in project eclipselink by eclipse-ee4j.

the class ReportItemBuilder method visit.

@Override
public void visit(ValueExpression expression) {
    IdentificationVariable identificationVariable = (IdentificationVariable) expression.getExpression();
    Expression queryExpression = queryContext.buildExpression(expression, type);
    addAttribute(identificationVariable.getText(), queryExpression);
}
Also used : IdentificationVariable(org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable) TrimExpression(org.eclipse.persistence.jpa.jpql.parser.TrimExpression) AbsExpression(org.eclipse.persistence.jpa.jpql.parser.AbsExpression) ValueExpression(org.eclipse.persistence.jpa.jpql.parser.ValueExpression) CoalesceExpression(org.eclipse.persistence.jpa.jpql.parser.CoalesceExpression) ConcatExpression(org.eclipse.persistence.jpa.jpql.parser.ConcatExpression) SubstringExpression(org.eclipse.persistence.jpa.jpql.parser.SubstringExpression) SizeExpression(org.eclipse.persistence.jpa.jpql.parser.SizeExpression) CastExpression(org.eclipse.persistence.jpa.jpql.parser.CastExpression) SqrtExpression(org.eclipse.persistence.jpa.jpql.parser.SqrtExpression) SubExpression(org.eclipse.persistence.jpa.jpql.parser.SubExpression) FunctionExpression(org.eclipse.persistence.jpa.jpql.parser.FunctionExpression) ExtractExpression(org.eclipse.persistence.jpa.jpql.parser.ExtractExpression) ConstructorExpression(org.eclipse.persistence.jpa.jpql.parser.ConstructorExpression) NullIfExpression(org.eclipse.persistence.jpa.jpql.parser.NullIfExpression) IndexExpression(org.eclipse.persistence.jpa.jpql.parser.IndexExpression) CollectionValuedPathExpression(org.eclipse.persistence.jpa.jpql.parser.CollectionValuedPathExpression) LocateExpression(org.eclipse.persistence.jpa.jpql.parser.LocateExpression) StateFieldPathExpression(org.eclipse.persistence.jpa.jpql.parser.StateFieldPathExpression) UpperExpression(org.eclipse.persistence.jpa.jpql.parser.UpperExpression) AdditionExpression(org.eclipse.persistence.jpa.jpql.parser.AdditionExpression) ObjectExpression(org.eclipse.persistence.jpa.jpql.parser.ObjectExpression) CollectionExpression(org.eclipse.persistence.jpa.jpql.parser.CollectionExpression) KeyExpression(org.eclipse.persistence.jpa.jpql.parser.KeyExpression) LowerExpression(org.eclipse.persistence.jpa.jpql.parser.LowerExpression) TreatExpression(org.eclipse.persistence.jpa.jpql.parser.TreatExpression) ModExpression(org.eclipse.persistence.jpa.jpql.parser.ModExpression) TypeExpression(org.eclipse.persistence.jpa.jpql.parser.TypeExpression) Expression(org.eclipse.persistence.expressions.Expression) SubtractionExpression(org.eclipse.persistence.jpa.jpql.parser.SubtractionExpression) EntryExpression(org.eclipse.persistence.jpa.jpql.parser.EntryExpression) CaseExpression(org.eclipse.persistence.jpa.jpql.parser.CaseExpression) LengthExpression(org.eclipse.persistence.jpa.jpql.parser.LengthExpression) MultiplicationExpression(org.eclipse.persistence.jpa.jpql.parser.MultiplicationExpression) DivisionExpression(org.eclipse.persistence.jpa.jpql.parser.DivisionExpression) KeywordExpression(org.eclipse.persistence.jpa.jpql.parser.KeywordExpression)

Example 7 with IdentificationVariable

use of org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable in project eclipselink by eclipse-ee4j.

the class ReportItemBuilder method visit.

@Override
public void visit(ResultVariable expression) {
    // Now cache the Expression for future retrieval by the ORDER BY clause
    IdentificationVariable identificationVariable = (IdentificationVariable) expression.getResultVariable();
    resultVariable = identificationVariable.getText();
    // Create the Expression that is added to the query as an attribute
    expression.getSelectExpression().accept(this);
    resultVariable = null;
}
Also used : IdentificationVariable(org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable)

Example 8 with IdentificationVariable

use of org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable in project eclipselink by eclipse-ee4j.

the class EclipseLinkSemanticValidatorHelper method collectLocalDeclarationIdentificationVariables.

private void collectLocalDeclarationIdentificationVariables(JPQLQueryContext queryContext, Map<String, List<IdentificationVariable>> identificationVariables) {
    DeclarationResolver declarationResolver = queryContext.getDeclarationResolverImp();
    // Collect the identification variables from the declarations
    for (Declaration declaration : declarationResolver.getDeclarations()) {
        IdentificationVariable identificationVariable = declaration.identificationVariable;
        addIdentificationVariable(identificationVariable, identificationVariables);
    }
    // Collect the result variables
    for (IdentificationVariable identificationVariable : declarationResolver.getResultVariables()) {
        addIdentificationVariable(identificationVariable, identificationVariables);
    }
}
Also used : IdentificationVariable(org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable) JPQLQueryDeclaration(org.eclipse.persistence.jpa.jpql.JPQLQueryDeclaration)

Example 9 with IdentificationVariable

use of org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable in project eclipselink by eclipse-ee4j.

the class ExpressionBuilderVisitor method visit.

@Override
public void visit(ResultVariable expression) {
    expression.getSelectExpression().accept(this);
    IdentificationVariable identificationVariable = (IdentificationVariable) expression.getResultVariable();
    String variableName = identificationVariable.getVariableName();
    queryContext.addQueryExpression(variableName, queryExpression);
// Note: The type will be calculated when traversing the select expression
}
Also used : IdentificationVariable(org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable)

Example 10 with IdentificationVariable

use of org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable in project eclipselink by eclipse-ee4j.

the class ExpressionBuilderVisitor method visit.

@Override
public void visit(RangeVariableDeclaration expression) {
    IdentificationVariable variable = (IdentificationVariable) expression.getIdentificationVariable();
    Declaration declaration = queryContext.getDeclaration(variable.getVariableName());
    switch(declaration.getType()) {
        // that cannot be visited
        case RANGE:
        case CLASS_NAME:
            {
                type[0] = declaration.getDescriptor().getJavaClass();
                queryExpression = new ExpressionBuilder(type[0]);
                break;
            }
        // The FROM subquery needs to be created differently than a regular subquery
        case SUBQUERY:
            {
                type[0] = null;
                queryExpression = declaration.getQueryExpression();
                break;
            }
        // This should be a derived path (CollectionValuedPathExpression) or a subquery
        default:
            {
                expression.getRootObject().accept(this);
                break;
            }
    }
}
Also used : IdentificationVariable(org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable) IdentificationVariableDeclaration(org.eclipse.persistence.jpa.jpql.parser.IdentificationVariableDeclaration) CollectionMemberDeclaration(org.eclipse.persistence.jpa.jpql.parser.CollectionMemberDeclaration) TableVariableDeclaration(org.eclipse.persistence.jpa.jpql.parser.TableVariableDeclaration) RangeVariableDeclaration(org.eclipse.persistence.jpa.jpql.parser.RangeVariableDeclaration) ExpressionBuilder(org.eclipse.persistence.expressions.ExpressionBuilder)

Aggregations

IdentificationVariable (org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable)12 CollectionExpression (org.eclipse.persistence.jpa.jpql.parser.CollectionExpression)4 ObjectExpression (org.eclipse.persistence.jpa.jpql.parser.ObjectExpression)4 StateFieldPathExpression (org.eclipse.persistence.jpa.jpql.parser.StateFieldPathExpression)4 Expression (org.eclipse.persistence.jpa.jpql.parser.Expression)3 JPQLExpression (org.eclipse.persistence.jpa.jpql.parser.JPQLExpression)3 LikeExpression (org.eclipse.persistence.jpa.jpql.parser.LikeExpression)3 UnknownExpression (org.eclipse.persistence.jpa.jpql.parser.UnknownExpression)3 JPQLQueryDeclaration (org.eclipse.persistence.jpa.jpql.JPQLQueryDeclaration)2 AbsExpression (org.eclipse.persistence.jpa.jpql.parser.AbsExpression)2 AdditionExpression (org.eclipse.persistence.jpa.jpql.parser.AdditionExpression)2 CaseExpression (org.eclipse.persistence.jpa.jpql.parser.CaseExpression)2 CoalesceExpression (org.eclipse.persistence.jpa.jpql.parser.CoalesceExpression)2 CollectionValuedPathExpression (org.eclipse.persistence.jpa.jpql.parser.CollectionValuedPathExpression)2 ConcatExpression (org.eclipse.persistence.jpa.jpql.parser.ConcatExpression)2 ConstructorExpression (org.eclipse.persistence.jpa.jpql.parser.ConstructorExpression)2 DivisionExpression (org.eclipse.persistence.jpa.jpql.parser.DivisionExpression)2 EntryExpression (org.eclipse.persistence.jpa.jpql.parser.EntryExpression)2 FunctionExpression (org.eclipse.persistence.jpa.jpql.parser.FunctionExpression)2 IndexExpression (org.eclipse.persistence.jpa.jpql.parser.IndexExpression)2