Search in sources :

Example 1 with FunctionExpression

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

the class ReportItemBuilder method visit.

@Override
public void visit(FunctionExpression 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 FunctionExpression

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

the class AbstractActualJPQLQueryFormatter method visit.

@Override
public void visit(FunctionExpressionStateObject stateObject) {
    if (stateObject.isDecorated()) {
        toText(stateObject);
    } else {
        FunctionExpression expression = stateObject.getExpression();
        // FUNC
        appendIdentifier((expression != null) ? expression.getActualIdentifier() : FUNC, FUNC);
        // (
        if (shouldOutput(expression) || expression.hasLeftParenthesis()) {
            writer.append(LEFT_PARENTHESIS);
        } else if (exactMatch && expression.hasSpaceAfterIdentifier()) {
            writer.append(SPACE);
        }
        // Function name
        if (stateObject.hasFunctionName()) {
            writer.append(stateObject.getQuotedFunctionName());
            if (shouldOutput(expression) || expression.hasComma()) {
                writer.append(COMMA);
            }
            if (shouldOutput(expression) || expression.hasSpaceAfterComma()) {
                writer.append(SPACE);
            }
        }
        // Arguments
        toStringChildren(stateObject, true);
        // )
        if (shouldOutput(expression) || expression.hasRightParenthesis()) {
            writer.append(RIGHT_PARENTHESIS);
        }
    }
}
Also used : FunctionExpression(org.eclipse.persistence.jpa.jpql.parser.FunctionExpression)

Aggregations

FunctionExpression (org.eclipse.persistence.jpa.jpql.parser.FunctionExpression)2 Expression (org.eclipse.persistence.expressions.Expression)1 AbsExpression (org.eclipse.persistence.jpa.jpql.parser.AbsExpression)1 AdditionExpression (org.eclipse.persistence.jpa.jpql.parser.AdditionExpression)1 CaseExpression (org.eclipse.persistence.jpa.jpql.parser.CaseExpression)1 CastExpression (org.eclipse.persistence.jpa.jpql.parser.CastExpression)1 CoalesceExpression (org.eclipse.persistence.jpa.jpql.parser.CoalesceExpression)1 CollectionExpression (org.eclipse.persistence.jpa.jpql.parser.CollectionExpression)1 CollectionValuedPathExpression (org.eclipse.persistence.jpa.jpql.parser.CollectionValuedPathExpression)1 ConcatExpression (org.eclipse.persistence.jpa.jpql.parser.ConcatExpression)1 ConstructorExpression (org.eclipse.persistence.jpa.jpql.parser.ConstructorExpression)1 DivisionExpression (org.eclipse.persistence.jpa.jpql.parser.DivisionExpression)1 EntryExpression (org.eclipse.persistence.jpa.jpql.parser.EntryExpression)1 ExtractExpression (org.eclipse.persistence.jpa.jpql.parser.ExtractExpression)1 IndexExpression (org.eclipse.persistence.jpa.jpql.parser.IndexExpression)1 KeyExpression (org.eclipse.persistence.jpa.jpql.parser.KeyExpression)1 KeywordExpression (org.eclipse.persistence.jpa.jpql.parser.KeywordExpression)1 LengthExpression (org.eclipse.persistence.jpa.jpql.parser.LengthExpression)1 LocateExpression (org.eclipse.persistence.jpa.jpql.parser.LocateExpression)1 LowerExpression (org.eclipse.persistence.jpa.jpql.parser.LowerExpression)1