Search in sources :

Example 1 with TypeExpression

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

the class ReportItemBuilder method visit.

@Override
public void visit(TypeExpression expression) {
    Expression queryExpression = queryContext.buildExpression(expression, type);
    addAttribute(ExpressionTools.EMPTY_STRING, queryExpression);
}
Also used : 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 2 with TypeExpression

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

the class AbstractSemanticValidator method validateTypeExpression.

/**
 * Validates the given {@link TypeExpression}. The test to perform is:
 * <ul>
 *    <li>If the encapsulated expression is a path expression, validation makes sure it is an
 *        association field, a basic field is not allowed.</li>
 * </ul>
 *
 * @param expression The {@link TypeExpression} to validate
 * @return <code>false</code> if the encapsulated expression was validated and is invalid;
 * <code>true</code> otherwise
 */
protected boolean validateTypeExpression(TypeExpression expression) {
    // Validate the expression
    if (expression.hasEncapsulatedExpression()) {
        Expression encapsulatedExpression = expression.getExpression();
        // Special case for state field path expression, only association field is allowed
        StateFieldPathExpression pathExpression = getStateFieldPathExpression(encapsulatedExpression);
        if (pathExpression != null) {
            return validateStateFieldPathExpression(pathExpression, PathType.ASSOCIATION_FIELD_ONLY);
        } else {
            encapsulatedExpression.accept(this);
        }
    }
    return true;
}
Also used : ArithmeticExpression(org.eclipse.persistence.jpa.jpql.parser.ArithmeticExpression) TrimExpression(org.eclipse.persistence.jpa.jpql.parser.TrimExpression) AbsExpression(org.eclipse.persistence.jpa.jpql.parser.AbsExpression) 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) Expression(org.eclipse.persistence.jpa.jpql.parser.Expression) SubExpression(org.eclipse.persistence.jpa.jpql.parser.SubExpression) AbstractSingleEncapsulatedExpression(org.eclipse.persistence.jpa.jpql.parser.AbstractSingleEncapsulatedExpression) AndExpression(org.eclipse.persistence.jpa.jpql.parser.AndExpression) JPQLExpression(org.eclipse.persistence.jpa.jpql.parser.JPQLExpression) IndexExpression(org.eclipse.persistence.jpa.jpql.parser.IndexExpression) StateFieldPathExpression(org.eclipse.persistence.jpa.jpql.parser.StateFieldPathExpression) UpperExpression(org.eclipse.persistence.jpa.jpql.parser.UpperExpression) ExistsExpression(org.eclipse.persistence.jpa.jpql.parser.ExistsExpression) KeyExpression(org.eclipse.persistence.jpa.jpql.parser.KeyExpression) AllOrAnyExpression(org.eclipse.persistence.jpa.jpql.parser.AllOrAnyExpression) ModExpression(org.eclipse.persistence.jpa.jpql.parser.ModExpression) LikeExpression(org.eclipse.persistence.jpa.jpql.parser.LikeExpression) CaseExpression(org.eclipse.persistence.jpa.jpql.parser.CaseExpression) LengthExpression(org.eclipse.persistence.jpa.jpql.parser.LengthExpression) MultiplicationExpression(org.eclipse.persistence.jpa.jpql.parser.MultiplicationExpression) UnknownExpression(org.eclipse.persistence.jpa.jpql.parser.UnknownExpression) NullComparisonExpression(org.eclipse.persistence.jpa.jpql.parser.NullComparisonExpression) ValueExpression(org.eclipse.persistence.jpa.jpql.parser.ValueExpression) ComparisonExpression(org.eclipse.persistence.jpa.jpql.parser.ComparisonExpression) InExpression(org.eclipse.persistence.jpa.jpql.parser.InExpression) NotExpression(org.eclipse.persistence.jpa.jpql.parser.NotExpression) BadExpression(org.eclipse.persistence.jpa.jpql.parser.BadExpression) BetweenExpression(org.eclipse.persistence.jpa.jpql.parser.BetweenExpression) CompoundExpression(org.eclipse.persistence.jpa.jpql.parser.CompoundExpression) SqrtExpression(org.eclipse.persistence.jpa.jpql.parser.SqrtExpression) FunctionExpression(org.eclipse.persistence.jpa.jpql.parser.FunctionExpression) CollectionMemberExpression(org.eclipse.persistence.jpa.jpql.parser.CollectionMemberExpression) NullExpression(org.eclipse.persistence.jpa.jpql.parser.NullExpression) ConstructorExpression(org.eclipse.persistence.jpa.jpql.parser.ConstructorExpression) NullIfExpression(org.eclipse.persistence.jpa.jpql.parser.NullIfExpression) CollectionValuedPathExpression(org.eclipse.persistence.jpa.jpql.parser.CollectionValuedPathExpression) LocateExpression(org.eclipse.persistence.jpa.jpql.parser.LocateExpression) AdditionExpression(org.eclipse.persistence.jpa.jpql.parser.AdditionExpression) ObjectExpression(org.eclipse.persistence.jpa.jpql.parser.ObjectExpression) CollectionExpression(org.eclipse.persistence.jpa.jpql.parser.CollectionExpression) LowerExpression(org.eclipse.persistence.jpa.jpql.parser.LowerExpression) OrExpression(org.eclipse.persistence.jpa.jpql.parser.OrExpression) TreatExpression(org.eclipse.persistence.jpa.jpql.parser.TreatExpression) TypeExpression(org.eclipse.persistence.jpa.jpql.parser.TypeExpression) EmptyCollectionComparisonExpression(org.eclipse.persistence.jpa.jpql.parser.EmptyCollectionComparisonExpression) SubtractionExpression(org.eclipse.persistence.jpa.jpql.parser.SubtractionExpression) EntryExpression(org.eclipse.persistence.jpa.jpql.parser.EntryExpression) DivisionExpression(org.eclipse.persistence.jpa.jpql.parser.DivisionExpression) KeywordExpression(org.eclipse.persistence.jpa.jpql.parser.KeywordExpression) StateFieldPathExpression(org.eclipse.persistence.jpa.jpql.parser.StateFieldPathExpression)

Aggregations

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 CollectionExpression (org.eclipse.persistence.jpa.jpql.parser.CollectionExpression)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 KeyExpression (org.eclipse.persistence.jpa.jpql.parser.KeyExpression)2 KeywordExpression (org.eclipse.persistence.jpa.jpql.parser.KeywordExpression)2 LengthExpression (org.eclipse.persistence.jpa.jpql.parser.LengthExpression)2 LocateExpression (org.eclipse.persistence.jpa.jpql.parser.LocateExpression)2 LowerExpression (org.eclipse.persistence.jpa.jpql.parser.LowerExpression)2 ModExpression (org.eclipse.persistence.jpa.jpql.parser.ModExpression)2 MultiplicationExpression (org.eclipse.persistence.jpa.jpql.parser.MultiplicationExpression)2 NullIfExpression (org.eclipse.persistence.jpa.jpql.parser.NullIfExpression)2