org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException Java Examples
The following examples show how to use
org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FilterTreeToText.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override public String visitMember(final Member member) throws ExpressionVisitException, ODataApplicationException { String ret = ""; for (UriResource item : member.getResourcePath().getUriResourceParts()) { String tmp = ""; if (item instanceof UriResourceLambdaAll) { UriResourceLambdaAll all = (UriResourceLambdaAll) item; tmp = visitLambdaExpression("ALL", all.getLambdaVariable(), all.getExpression()); } else if (item instanceof UriResourceLambdaAny) { UriResourceLambdaAny any = (UriResourceLambdaAny) item; tmp = visitLambdaExpression("ANY", any.getLambdaVariable(), any.getExpression()); } else if (item instanceof UriResourcePartTyped) { UriResourcePartTyped typed = (UriResourcePartTyped) item; tmp = typed.toString(true); } if (ret.length() > 0) { ret += "/"; } ret += tmp; } return "<" + ret + ">"; }
Example #2
Source File: FilterExpressionVisitor.java From olingo-odata4 with Apache License 2.0 | 6 votes |
public Object visitUnaryOperator(UnaryOperatorKind operator, Object operand) throws ExpressionVisitException, ODataApplicationException { // OData allows two different unary operators. We have to take care, that the type of the operand fits to // operand if(operator == UnaryOperatorKind.NOT && operand instanceof Boolean) { // 1.) boolean negation return !(Boolean) operand; } else if(operator == UnaryOperatorKind.MINUS && operand instanceof Integer){ // 2.) arithmetic minus return -(Integer) operand; } // Operation not processed, throw an exception throw new ODataApplicationException("Invalid type for unary operator", HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ENGLISH); }
Example #3
Source File: ODataFesParser.java From arctic-sea with Apache License 2.0 | 6 votes |
@Override public UnaryExpr<?> visitUnaryOperator(UnaryOperatorKind op, Expr operand) throws ExpressionVisitException { Supplier<ExpressionVisitException> exceptionSupplier = () -> new ExpressionVisitException(String.format("Operator is not supported: %s %s", op, operand)); switch (op) { case NOT: return new BooleanUnaryExpr(UnaryLogicOperator.Not, operand.asBoolean().orElseThrow(exceptionSupplier)); case MINUS: default: throw exceptionSupplier.get(); } }
Example #4
Source File: ExpressionVisitorImpl.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override public VisitorOperand visitUnaryOperator(final UnaryOperatorKind operator, final VisitorOperand operand) throws ExpressionVisitException, ODataApplicationException { final UnaryOperator unaryOperator = new UnaryOperator(operand); switch (operator) { case MINUS: return unaryOperator.minusOperation(); case NOT: return unaryOperator.notOperation(); default: // Can't happen. return throwNotImplemented(); } }
Example #5
Source File: FilterExpressionVisitor.java From syndesis with Apache License 2.0 | 6 votes |
@Override public Object visitUnaryOperator(UnaryOperatorKind operator, Object operand) throws ExpressionVisitException, ODataApplicationException { // OData allows two different unary operators. We have to take care, // that the type of the operand fits to // operand if (operator == UnaryOperatorKind.NOT && operand instanceof Boolean) { // 1.) boolean negation return !(Boolean) operand; } else if (operator == UnaryOperatorKind.MINUS && operand instanceof Integer) { // 2.) arithmetic minus return -(Integer) operand; } // Operation not processed, throw an exception throw new ODataApplicationException("Invalid type for unary operator", HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ENGLISH); }
Example #6
Source File: FilterExpressionVisitor.java From olingo-odata4 with Apache License 2.0 | 6 votes |
public Object visitMember(final Member member) throws ExpressionVisitException, ODataApplicationException { // To keeps things simple, this tutorial allows only primitive properties. // We have faith that the java type of Edm.Int32 is Integer final List<UriResource> uriResourceParts = member.getResourcePath().getUriResourceParts(); // Make sure that the resource path of the property contains only a single segment and a primitive property // has been addressed. We can be sure, that the property exists because the UriParser checks if the // property has been defined in service metadata document. if(uriResourceParts.size() == 1 && uriResourceParts.get(0) instanceof UriResourcePrimitiveProperty) { UriResourcePrimitiveProperty uriResourceProperty = (UriResourcePrimitiveProperty) uriResourceParts.get(0); return currentEntity.getProperty(uriResourceProperty.getProperty().getName()).getValue(); } else { // The OData specification allows in addition complex properties and navigation properties // with a target cardinality 0..1 or 1. // This means any combination can occur e.g. Supplier/Address/City // -> Navigation properties Supplier // -> Complex Property Address // -> Primitive Property City // For such cases the resource path returns a list of UriResourceParts throw new ODataApplicationException("Only primitive properties are implemented in filter expressions", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH); } }
Example #7
Source File: QueryHandler.java From micro-integrator with Apache License 2.0 | 6 votes |
/** * This method applies filter query option to the given entity collection. * * @param filterOption Filter option * @param entitySet Entity collection * @param edmEntitySet Entity set * @throws ODataApplicationException */ public static void applyFilterSystemQuery(final FilterOption filterOption, final EntityCollection entitySet, final EdmBindingTarget edmEntitySet) throws ODataApplicationException { try { final Iterator<Entity> iter = entitySet.getEntities().iterator(); while (iter.hasNext()) { final VisitorOperand operand = filterOption.getExpression().accept(new ExpressionVisitorImpl(iter.next(), edmEntitySet)); final TypedOperand typedOperand = operand.asTypedOperand(); if (typedOperand.is(ODataConstants.primitiveBoolean)) { if (Boolean.FALSE.equals(typedOperand.getTypedValue(Boolean.class))) { iter.remove(); } } else { throw new ODataApplicationException( "Invalid filter expression. Filter expressions must return a value of " + "type Edm.Boolean", HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT); } } } catch (ExpressionVisitException e) { throw new ODataApplicationException("Exception in filter evaluation", HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), Locale.ROOT); } }
Example #8
Source File: FilterValidator.java From olingo-odata4 with Apache License 2.0 | 6 votes |
public FilterValidator isParameterText(final int parameterIndex, final String parameterText) throws ExpressionVisitException, ODataApplicationException { if (curExpression instanceof MethodImpl) { MethodImpl methodCall = (MethodImpl) curExpression; Expression parameter = methodCall.getParameters().get(parameterIndex); String actualParameterText = FilterTreeToText.Serialize(parameter); assertEquals(parameterText, actualParameterText); } else if (curExpression instanceof MemberImpl) { final MemberImpl member = (MemberImpl) curExpression; final List<UriResource> uriResourceParts = member.getResourcePath().getUriResourceParts(); if (!uriResourceParts.isEmpty() && uriResourceParts.get(0) instanceof UriResourceFunctionImpl) { assertEquals(parameterText, ((UriResourceFunctionImpl) uriResourceParts.get(0)).getParameters() .get(parameterIndex).getText()); } else { fail("Current expression is not a method or function"); } } else { fail("Current expression is not a method or function"); } return this; }
Example #9
Source File: ExpressionVisitorImpl.java From micro-integrator with Apache License 2.0 | 6 votes |
@Override public VisitorOperand visitMember(Member member) throws ExpressionVisitException, ODataApplicationException { final List<UriResource> uriResourceParts = member.getResourcePath().getUriResourceParts(); int size = uriResourceParts.size(); if (uriResourceParts.get(0) instanceof UriResourceProperty) { EdmProperty currentEdmProperty = ((UriResourceProperty) uriResourceParts.get(0)).getProperty(); Property currentProperty = entity.getProperty(currentEdmProperty.getName()); return new TypedOperand(currentProperty.getValue(), currentEdmProperty.getType(), currentEdmProperty); } else if (uriResourceParts.get(size - 1) instanceof UriResourceLambdaAll) { return throwNotImplemented(); } else if (uriResourceParts.get(size - 1) instanceof UriResourceLambdaAny) { return throwNotImplemented(); } else { return throwNotImplemented(); } }
Example #10
Source File: FilterExpressionVisitor.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override public Object visitMember(final Member member) throws ExpressionVisitException, ODataApplicationException { // To keeps things simple, this tutorial allows only primitive properties. // We have faith that the java type of Edm.Int32 is Integer final List<UriResource> uriResourceParts = member.getResourcePath().getUriResourceParts(); // Make sure that the resource path of the property contains only a single segment and a primitive property // has been addressed. We can be sure, that the property exists because the UriParser checks if the // property has been defined in service metadata document. if(uriResourceParts.size() == 1 && uriResourceParts.get(0) instanceof UriResourcePrimitiveProperty) { UriResourcePrimitiveProperty uriResourceProperty = (UriResourcePrimitiveProperty) uriResourceParts.get(0); return currentEntity.getProperty(uriResourceProperty.getProperty().getName()).getValue(); } else { // The OData specification allows in addition complex properties and navigation properties // with a target cardinality 0..1 or 1. // This means any combination can occur e.g. Supplier/Address/City // -> Navigation properties Supplier // -> Complex Property Address // -> Primitive Property City // For such cases the resource path returns a list of UriResourceParts throw new ODataApplicationException("Only primitive properties are implemented in filter expressions", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH); } }
Example #11
Source File: FilterExpressionVisitor.java From olingo-odata4 with Apache License 2.0 | 6 votes |
@Override public Object visitUnaryOperator(UnaryOperatorKind operator, Object operand) throws ExpressionVisitException, ODataApplicationException { // OData allows two different unary operators. We have to take care, that the type of the operand fits to // operand if(operator == UnaryOperatorKind.NOT && operand instanceof Boolean) { // 1.) boolean negation return !(Boolean) operand; } else if(operator == UnaryOperatorKind.MINUS && operand instanceof Integer){ // 2.) arithmetic minus return -(Integer) operand; } // Operation not processed, throw an exception throw new ODataApplicationException("Invalid type for unary operator", HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ENGLISH); }
Example #12
Source File: FilterExpressionVisitor.java From syndesis with Apache License 2.0 | 5 votes |
@Override public Object visitLiteral(Literal literal) throws ExpressionVisitException, ODataApplicationException { // To keep this tutorial simple, our filter expression visitor supports // only Edm.Int32 and Edm.String // In real world scenarios it can be difficult to guess the type of an // literal. // We can be sure, that the literal is a valid OData literal because the // URI Parser checks // the lexicographical structure // String literals start and end with an single quotation mark String literalAsString = literal.getText(); if (literal.getType() instanceof EdmString) { String stringLiteral = ""; if (literal.getText().length() > 2) { stringLiteral = literalAsString.substring(1, literalAsString.length() - 1); } return stringLiteral; } // Try to convert the literal into an Java Integer try { return Integer.parseInt(literalAsString); } catch (NumberFormatException e) { throw new ODataApplicationException("Only Edm.Int32 and Edm.String literals are implemented", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH, e); } }
Example #13
Source File: ExpressionVisitorImpl.java From micro-integrator with Apache License 2.0 | 5 votes |
@Override public VisitorOperand visitUnaryOperator(final UnaryOperatorKind operator, final VisitorOperand operand) throws ExpressionVisitException, ODataApplicationException { final UnaryOperator unaryOperator = new UnaryOperator(operand); switch (operator) { case MINUS: return unaryOperator.minusOperation(); case NOT: return unaryOperator.notOperation(); default: // Can't happen. return throwNotImplemented(); } }
Example #14
Source File: FilterExpressionVisitor.java From olingo-odata4 with Apache License 2.0 | 5 votes |
public Object visitBinaryOperator(BinaryOperatorKind operator, Object left, Object right) throws ExpressionVisitException, ODataApplicationException { // Binary Operators are split up in three different kinds. Up to the kind of the operator it can be applied // to different types // - Arithmetic operations like add, minus, modulo, etc. are allowed on numeric types like Edm.Int32 // - Logical operations are allowed on numeric types and also Edm.String // - Boolean operations like and, or are allowed on Edm.Boolean // A detailed explanation can be found in OData Version 4.0 Part 2: URL Conventions if (operator == BinaryOperatorKind.ADD || operator == BinaryOperatorKind.MOD || operator == BinaryOperatorKind.MUL || operator == BinaryOperatorKind.DIV || operator == BinaryOperatorKind.SUB) { return evaluateArithmeticOperation(operator, left, right); } else if (operator == BinaryOperatorKind.EQ || operator == BinaryOperatorKind.NE || operator == BinaryOperatorKind.GE || operator == BinaryOperatorKind.GT || operator == BinaryOperatorKind.LE || operator == BinaryOperatorKind.LT) { return evaluateComparisonOperation(operator, left, right); } else if (operator == BinaryOperatorKind.AND || operator == BinaryOperatorKind.OR) { return evaluateBooleanOperation(operator, left, right); } else { throw new ODataApplicationException("Binary operation " + operator.name() + " is not implemented", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH); } }
Example #15
Source File: DemoEntityCollectionProcessor.java From olingo-odata4 with Apache License 2.0 | 5 votes |
private List<Entity> applyFilterQueryOption(List<Entity> entityList, FilterOption filterOption) throws ODataApplicationException { if (filterOption != null) { try { Iterator<Entity> entityIterator = entityList.iterator(); // Evaluate the expression for each entity // If the expression is evaluated to "true", keep the entity otherwise remove it from the entityList while (entityIterator.hasNext()) { // To evaluate the the expression, create an instance of the Filter Expression Visitor and pass // the current entity to the constructor Entity currentEntity = entityIterator.next(); Expression filterExpression = filterOption.getExpression(); FilterExpressionVisitor expressionVisitor = new FilterExpressionVisitor(currentEntity); // Start evaluating the expression Object visitorResult = filterExpression.accept(expressionVisitor); // The result of the filter expression must be of type Edm.Boolean if (visitorResult instanceof Boolean) { if (!Boolean.TRUE.equals(visitorResult)) { // The expression evaluated to false (or null), so we have to remove the currentEntity from entityList entityIterator.remove(); } } else { throw new ODataApplicationException("A filter expression must evaulate to type Edm.Boolean", HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ENGLISH); } } } catch (ExpressionVisitException e) { throw new ODataApplicationException("Exception in filter evaluation", HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), Locale.ENGLISH); } } return entityList; }
Example #16
Source File: ExpressionJsonVisitor.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Override public JsonNode visitEnum(final EdmEnumType type, final List<String> enumValues) throws ExpressionVisitException, ODataApplicationException { ObjectNode result = nodeFactory.objectNode() .put(NODE_TYPE_NAME, ENUM_NAME) .put(TYPE_NAME, getTypeString(type)); ArrayNode values = result.putArray(VALUES_NAME); if (enumValues != null) { for (final String enumValue : enumValues) { values.add(enumValue); } } return result; }
Example #17
Source File: FilterExpressionVisitor.java From syndesis with Apache License 2.0 | 5 votes |
@Override public Object visitMember(final Member member) throws ExpressionVisitException, ODataApplicationException { // To keeps things simple, this tutorial allows only primitive // properties. // We have faith that the java type of Edm.Int32 is Integer final List<UriResource> uriResourceParts = member.getResourcePath().getUriResourceParts(); // Make sure that the resource path of the property contains only a // single segment and a primitive property // has been addressed. We can be sure, that the property exists because // the UriParser checks if the // property has been defined in service metadata document. if (uriResourceParts.size() == 1 && uriResourceParts.get(0) instanceof UriResourcePrimitiveProperty) { UriResourcePrimitiveProperty uriResourceProperty = (UriResourcePrimitiveProperty) uriResourceParts.get(0); return currentEntity.getProperty(uriResourceProperty.getProperty().getName()).getValue(); } // The OData specification allows in addition complex properties and // navigation properties // with a target cardinality 0..1 or 1. // This means any combination can occur e.g. Supplier/Address/City // -> Navigation properties Supplier // -> Complex Property Address // -> Primitive Property City // For such cases the resource path returns a list of UriResourceParts throw new ODataApplicationException("Only primitive properties are implemented in filter expressions", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH); }
Example #18
Source File: ExpressionJsonVisitor.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Override public JsonNode visitLambdaReference(final String variableName) throws ExpressionVisitException, ODataApplicationException { return nodeFactory.objectNode() .put(NODE_TYPE_NAME, LAMBDA_REFERENCE_NAME) .put(NAME_NAME, variableName); }
Example #19
Source File: FilterExpressionVisitor.java From syndesis with Apache License 2.0 | 5 votes |
@Override public Object visitMethodCall(MethodKind methodCall, List<Object> parameters) throws ExpressionVisitException, ODataApplicationException { // To keep this tutorial small and simple, we implement only one method // call if (methodCall == MethodKind.CONTAINS) { // "Contains" gets two parameters, both have to be of type String // e.g. /Products?$filter=contains(Description, '1024 MB') // // First the method visistMember is called, which returns the // current String value of the property. // After that the method visitLiteral is called with the string // literal '1024 MB', // which returns a String // // Both String values are passed to visitMethodCall. if (parameters.get(0) instanceof String && parameters.get(1) instanceof String) { String valueParam1 = (String) parameters.get(0); String valueParam2 = (String) parameters.get(1); return valueParam1.contains(valueParam2); } throw new ODataApplicationException("Contains needs two parametes of type Edm.String", HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ENGLISH); } throw new ODataApplicationException("Method call " + methodCall + " not implemented", HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH); }
Example #20
Source File: ExpressionJsonVisitor.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Override public JsonNode visitLiteral(final Literal literal) throws ExpressionVisitException, ODataApplicationException { return nodeFactory.objectNode() .put(NODE_TYPE_NAME, LITERAL_NAME) .put(TYPE_NAME, getTypeString(literal.getType())) .put(VALUE_NAME, literal.getText()); }
Example #21
Source File: ExpressionJsonVisitor.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Override public JsonNode visitLambdaExpression(final String lambdaFunction, final String lambdaVariable, final Expression expression) throws ExpressionVisitException, ODataApplicationException { return nodeFactory.objectNode() .put(NODE_TYPE_NAME, LAMBDA_FUNCTION_NAME) .put(LAMBDA_VARIABLE_NAME, lambdaVariable) .set(EXPRESSION_NAME, expression.accept(this)); }
Example #22
Source File: FilterHandler.java From olingo-odata4 with Apache License 2.0 | 5 votes |
public static void applyFilterSystemQuery(final FilterOption filterOption, final EntityCollection entitySet, final UriInfoResource uriInfo, final Edm edm) throws ODataApplicationException { if (filterOption == null) { return; } try { final Iterator<Entity> iter = entitySet.getEntities().iterator(); while (iter.hasNext()) { final VisitorOperand operand = filterOption.getExpression() .accept(new ExpressionVisitorImpl(iter.next(), uriInfo, edm)); final TypedOperand typedOperand = operand.asTypedOperand(); if (typedOperand.is(primBoolean)) { if (Boolean.FALSE.equals(typedOperand.getTypedValue(Boolean.class))) { iter.remove(); } } else { throw new ODataApplicationException( "Invalid filter expression. Filter expressions must return a value of type Edm.Boolean", HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT); } } } catch (ExpressionVisitException e) { throw new ODataApplicationException("Exception in filter evaluation", HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), Locale.ROOT); } }
Example #23
Source File: ExpressionVisitorImpl.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Override public VisitorOperand visitBinaryOperator(final BinaryOperatorKind operator, final VisitorOperand left, final VisitorOperand right) throws ExpressionVisitException, ODataApplicationException { final BinaryOperator binaryOperator = new BinaryOperator(left, right); switch (operator) { case AND: return binaryOperator.andOperator(); case OR: return binaryOperator.orOperator(); case EQ: return binaryOperator.equalsOperator(); case NE: return binaryOperator.notEqualsOperator(); case GE: return binaryOperator.greaterEqualsOperator(); case GT: return binaryOperator.greaterThanOperator(); case LE: return binaryOperator.lessEqualsOperator(); case LT: return binaryOperator.lessThanOperator(); case ADD: case SUB: case MUL: case DIV: case MOD: return binaryOperator.arithmeticOperator(operator); case HAS: return binaryOperator.hasOperator(); case IN: return binaryOperator.inOperator(); default: return throwNotImplemented(); } }
Example #24
Source File: ExpressionJsonVisitor.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Override public JsonNode visitMethodCall(final MethodKind methodCall, final List<JsonNode> parameters) throws ExpressionVisitException, ODataApplicationException { ObjectNode result = nodeFactory.objectNode() .put(NODE_TYPE_NAME, METHOD_NAME) .put(OPERATOR_NAME, methodCall.toString()) .put(TYPE_NAME, getType(methodCall)); ArrayNode jsonParameters = result.putArray(PARAMETERS_NAME); for (final JsonNode parameter : parameters) { jsonParameters.add(parameter); } return result; }
Example #25
Source File: ExpressionJsonVisitor.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Override public JsonNode visitUnaryOperator(final UnaryOperatorKind operator, final JsonNode operand) throws ExpressionVisitException, ODataApplicationException { return nodeFactory.objectNode() .put(NODE_TYPE_NAME, UNARY_NAME) .put(OPERATOR_NAME, operator.toString()) .put(TYPE_NAME, getType(operator)) .set(OPERAND_NAME, operand); }
Example #26
Source File: ExpressionJsonVisitor.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Override public JsonNode visitBinaryOperator(final BinaryOperatorKind operator, final JsonNode left, final JsonNode right) throws ExpressionVisitException, ODataApplicationException { ObjectNode result = nodeFactory.objectNode() .put(NODE_TYPE_NAME, BINARY_NAME) .put(OPERATOR_NAME, operator.toString()) .put(TYPE_NAME, getType(operator)); result.set(LEFT_NODE_NAME, left); result.set(RIGHT_NODE_NAME, right); return result; }
Example #27
Source File: ExpressionVisitorImpl.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Override public VisitorOperand visitEnum(final EdmEnumType type, final List<String> enumValues) throws ExpressionVisitException, ODataApplicationException { Long result = null; try { for (final String enumValue : enumValues) { final Long value = type.valueOfString(enumValue, null, null, null, null, null, Long.class); result = result == null ? value : result | value; } } catch (final EdmPrimitiveTypeException e) { throw new ODataApplicationException("Illegal enum value.", HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT, e); } return new TypedOperand(result, type); }
Example #28
Source File: ExpressionVisitorImpl.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Override public VisitorOperand visitBinaryOperator(BinaryOperatorKind operator, VisitorOperand left, List<VisitorOperand> right) throws ExpressionVisitException, ODataApplicationException { BinaryOperator binaryOperator = new BinaryOperator(left, right); switch (operator) { case IN : return binaryOperator.inOperator(); default: return throwNotImplemented(); } }
Example #29
Source File: FilterTreeToText.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Override public String visitEnum(final EdmEnumType type, final List<String> enumValues) throws ExpressionVisitException, ODataApplicationException { String tmp = ""; for (String item : enumValues) { if (tmp.length() > 0) { tmp += ","; } tmp += item; } return "<" + type.getFullQualifiedName().getFullQualifiedNameAsString() + "<" + tmp + ">>"; }
Example #30
Source File: FilterTreeToText.java From olingo-odata4 with Apache License 2.0 | 5 votes |
@Override public String visitMethodCall(final MethodKind methodCall, final List<String> parameters) throws ExpressionVisitException { String text = "<" + methodCall + "("; boolean first = true; for (final String parameter : parameters) { if (!first) { text += ","; } text += parameter; first = false; } return text + ")>"; }