diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/ExpressionVisitor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/ExpressionVisitor.java index 224ddbaf6..402db3a81 100644 --- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/ExpressionVisitor.java +++ b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/ExpressionVisitor.java @@ -23,7 +23,6 @@ import java.util.List; import org.apache.olingo.commons.api.edm.EdmEnumType; import org.apache.olingo.commons.api.edm.EdmType; import org.apache.olingo.server.api.ODataApplicationException; -import org.apache.olingo.server.api.uri.UriInfoResource; /** * Generic interface to define expression visitors with arbitrary return types. @@ -95,7 +94,7 @@ public interface ExpressionVisitor { * @throws ExpressionVisitException Thrown if an exception while traversing occured * @throws ODataApplicationException Thrown by the application */ - T visitMember(UriInfoResource member) throws ExpressionVisitException, ODataApplicationException; + T visitMember(Member member) throws ExpressionVisitException, ODataApplicationException; /** * Called for each traversed {@link Alias} expression diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/ExpressionJsonVisitor.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/ExpressionJsonVisitor.java index bf3797314..a8b22e951 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/ExpressionJsonVisitor.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/debug/ExpressionJsonVisitor.java @@ -18,28 +18,20 @@ */ package org.apache.olingo.server.core.debug; -import java.util.List; - -import org.apache.olingo.commons.api.edm.EdmEnumType; -import org.apache.olingo.commons.api.edm.EdmType; -import org.apache.olingo.server.api.ODataApplicationException; -import org.apache.olingo.server.api.uri.UriInfoResource; -import org.apache.olingo.server.api.uri.UriResource; -import org.apache.olingo.server.api.uri.UriResourceLambdaAll; -import org.apache.olingo.server.api.uri.UriResourceLambdaAny; -import org.apache.olingo.server.api.uri.UriResourcePartTyped; -import org.apache.olingo.server.api.uri.queryoption.expression.BinaryOperatorKind; -import org.apache.olingo.server.api.uri.queryoption.expression.Expression; -import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException; -import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor; -import org.apache.olingo.server.api.uri.queryoption.expression.Literal; -import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind; -import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind; - import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.fasterxml.jackson.databind.node.ObjectNode; +import org.apache.olingo.commons.api.edm.EdmEnumType; +import org.apache.olingo.commons.api.edm.EdmType; +import org.apache.olingo.server.api.ODataApplicationException; +import org.apache.olingo.server.api.uri.UriResource; +import org.apache.olingo.server.api.uri.UriResourceLambdaAll; +import org.apache.olingo.server.api.uri.UriResourceLambdaAny; +import org.apache.olingo.server.api.uri.UriResourcePartTyped; +import org.apache.olingo.server.api.uri.queryoption.expression.*; + +import java.util.List; /** * A custom expression visitor which converts the tree into a {@link JsonNode} tree. @@ -134,9 +126,9 @@ public class ExpressionJsonVisitor implements ExpressionVisitor { } @Override - public JsonNode visitMember(final UriInfoResource member) + public JsonNode visitMember(final Member member) throws ExpressionVisitException, ODataApplicationException { - final List uriResourceParts = member.getUriResourceParts(); + final List uriResourceParts = member.getResourcePath().getUriResourceParts(); ObjectNode result = nodeFactory.objectNode() .put(NODE_TYPE_NAME, MEMBER_NAME) .put(TYPE_NAME, getType(uriResourceParts)); diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/MemberImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/MemberImpl.java index fe5cb8745..330656535 100644 --- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/MemberImpl.java +++ b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/MemberImpl.java @@ -52,7 +52,7 @@ public class MemberImpl implements Member { @Override public T accept(final ExpressionVisitor visitor) throws ExpressionVisitException, ODataApplicationException { - return visitor.visitMember(path); + return visitor.visitMember(this); } @Override diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/ExpressionVisitorImpl.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/ExpressionVisitorImpl.java index a2ff71986..3748ab88b 100644 --- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/ExpressionVisitorImpl.java +++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/expression/ExpressionVisitorImpl.java @@ -38,13 +38,7 @@ import org.apache.olingo.server.api.uri.UriParameter; import org.apache.olingo.server.api.uri.UriResource; import org.apache.olingo.server.api.uri.UriResourceFunction; import org.apache.olingo.server.api.uri.UriResourceProperty; -import org.apache.olingo.server.api.uri.queryoption.expression.BinaryOperatorKind; -import org.apache.olingo.server.api.uri.queryoption.expression.Expression; -import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException; -import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor; -import org.apache.olingo.server.api.uri.queryoption.expression.Literal; -import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind; -import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind; +import org.apache.olingo.server.api.uri.queryoption.expression.*; import org.apache.olingo.server.tecsvc.data.DataProvider; import org.apache.olingo.server.tecsvc.processor.queryoptions.expression.operand.TypedOperand; import org.apache.olingo.server.tecsvc.processor.queryoptions.expression.operand.UntypedOperand; @@ -184,10 +178,10 @@ public class ExpressionVisitorImpl implements ExpressionVisitor } @Override - public VisitorOperand visitMember(final UriInfoResource member) throws ExpressionVisitException, + public VisitorOperand visitMember(final Member member) throws ExpressionVisitException, ODataApplicationException { - final List uriResourceParts = member.getUriResourceParts(); + final List uriResourceParts = member.getResourcePath().getUriResourceParts(); // UriResourceParts contains at least one UriResource. final UriResource initialPart = uriResourceParts.get(0); diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java index 96a32269d..a083c67ec 100644 --- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java +++ b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java @@ -29,13 +29,7 @@ import org.apache.olingo.server.api.uri.UriResourceLambdaAll; import org.apache.olingo.server.api.uri.UriResourceLambdaAny; import org.apache.olingo.server.api.uri.UriResourcePartTyped; import org.apache.olingo.server.api.uri.queryoption.FilterOption; -import org.apache.olingo.server.api.uri.queryoption.expression.BinaryOperatorKind; -import org.apache.olingo.server.api.uri.queryoption.expression.Expression; -import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException; -import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor; -import org.apache.olingo.server.api.uri.queryoption.expression.Literal; -import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind; -import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind; +import org.apache.olingo.server.api.uri.queryoption.expression.*; public class FilterTreeToText implements ExpressionVisitor { @@ -88,10 +82,10 @@ public class FilterTreeToText implements ExpressionVisitor { } @Override - public String visitMember(final UriInfoResource resource) throws ExpressionVisitException, ODataApplicationException { + public String visitMember(final Member member) throws ExpressionVisitException, ODataApplicationException { String ret = ""; - for (UriResource item : resource.getUriResourceParts()) { + for (UriResource item : member.getResourcePath().getUriResourceParts()) { String tmp = ""; if (item instanceof UriResourceLambdaAll) { UriResourceLambdaAll all = (UriResourceLambdaAll) item;