diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoResource.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoResource.java index 5973b5f13..c17ca3551 100644 --- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoResource.java +++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriInfoResource.java @@ -25,7 +25,7 @@ import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandOption; import org.apache.olingo.odata4.server.api.uri.queryoption.FilterOption; import org.apache.olingo.odata4.server.api.uri.queryoption.FormatOption; import org.apache.olingo.odata4.server.api.uri.queryoption.IdOption; -import org.apache.olingo.odata4.server.api.uri.queryoption.InlineCountOption; +import org.apache.olingo.odata4.server.api.uri.queryoption.CountOption; import org.apache.olingo.odata4.server.api.uri.queryoption.OrderByOption; import org.apache.olingo.odata4.server.api.uri.queryoption.SearchOption; import org.apache.olingo.odata4.server.api.uri.queryoption.SelectOption; @@ -45,7 +45,7 @@ public interface UriInfoResource { IdOption getIdOption(); - InlineCountOption getInlineCountOption(); + CountOption getInlineCountOption(); OrderByOption getOrderByOption(); diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriParameter.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriParameter.java index 9bb1dadbc..c3ffa16e9 100644 --- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriParameter.java +++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriParameter.java @@ -26,7 +26,7 @@ public interface UriParameter { public String getText(); - public Expression getExression(); + public Expression getExpression(); public String getName(); diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceStartingTypeFilter.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceStartingTypeFilter.java deleted file mode 100644 index 1c0df722e..000000000 --- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/UriResourceStartingTypeFilter.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.olingo.odata4.server.api.uri; - -import org.apache.olingo.odata4.commons.api.edm.EdmType; - -public interface UriResourceStartingTypeFilter extends UriResourcePartTyped { - - EdmType getTypeFilterOnCollection(); - - EdmType getTypeFilterOnEntry(); - -} diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/InlineCountOption.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/CountOption.java similarity index 93% rename from odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/InlineCountOption.java rename to odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/CountOption.java index c694b9281..522307020 100644 --- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/InlineCountOption.java +++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/CountOption.java @@ -18,7 +18,7 @@ */ package org.apache.olingo.odata4.server.api.uri.queryoption; -public interface InlineCountOption extends SystemQueryOption { +public interface CountOption extends SystemQueryOption { boolean getValue(); diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExpandItem.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExpandItem.java index 54133929d..cb1b7203b 100644 --- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExpandItem.java +++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/ExpandItem.java @@ -18,6 +18,7 @@ */ package org.apache.olingo.odata4.server.api.uri.queryoption; +import org.apache.olingo.odata4.commons.api.edm.EdmType; import org.apache.olingo.odata4.server.api.uri.UriInfoResource; public interface ExpandItem { @@ -34,16 +35,19 @@ public interface ExpandItem { TopOption getTopOption(); - InlineCountOption getInlineCountOption(); + CountOption getInlineCountOption(); SelectOption getSelectOption(); ExpandOption getExpandOption(); - UriInfoResource getResourceInfo(); + UriInfoResource getResourcePath(); boolean isStar(); boolean isRef(); + EdmType getStartTypeFilter(); + + } diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SelectItem.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SelectItem.java index 58dd17622..196fa39f6 100644 --- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SelectItem.java +++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/SelectItem.java @@ -18,6 +18,7 @@ */ package org.apache.olingo.odata4.server.api.uri.queryoption; +import org.apache.olingo.odata4.commons.api.edm.EdmType; import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName; import org.apache.olingo.odata4.server.api.uri.UriInfoResource; @@ -29,6 +30,8 @@ public interface SelectItem { FullQualifiedName getAllOperationsInSchemaNameSpace(); - UriInfoResource getResourceInfo(); + UriInfoResource getResourcePath(); + + EdmType getStartTypeFilter(); } diff --git a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Member.java b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Member.java index 21084d7db..f0f04238e 100644 --- a/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Member.java +++ b/odata4-lib/odata4-server-api/src/main/java/org/apache/olingo/odata4/server/api/uri/queryoption/expression/Member.java @@ -23,10 +23,14 @@ import org.apache.olingo.odata4.server.api.uri.UriInfoResource; public interface Member extends Expression { - public UriInfoResource getPath(); + public UriInfoResource getResourcePath(); public EdmType getType(); + public EdmType getStartTypeFilter(); public boolean isCollection(); + + + } diff --git a/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriParser.g4 b/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriParser.g4 index 0b246cba9..d94302fb2 100644 --- a/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriParser.g4 +++ b/odata4-lib/odata4-server-core/src/main/antlr4/org/apache/olingo/odata4/server/core/uri/antlr/UriParser.g4 @@ -347,7 +347,7 @@ odataIdentifier : ODATAIDENTIFIER; primitiveLiteral : nullrule | booleanNonCase | DECIMAL //includes double and single literals - | NANINFINITY + | naninfinity | INT //includes int16/int32 and int64 literals | BINARY | DATE @@ -373,6 +373,7 @@ primitiveLiteral : nullrule | geometryPolygon ; +naninfinity : NANINFINITY; nullrule : NULLVALUE; booleanNonCase : BOOLEAN | TRUE | FALSE; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriInfoImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriInfoImpl.java similarity index 97% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriInfoImpl.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriInfoImpl.java index af1130a71..59b16a457 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriInfoImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriInfoImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri.apiimpl; +package org.apache.olingo.odata4.server.core.uri; import java.util.ArrayList; import java.util.Collections; @@ -38,7 +38,7 @@ import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandOption; import org.apache.olingo.odata4.server.api.uri.queryoption.FilterOption; import org.apache.olingo.odata4.server.api.uri.queryoption.FormatOption; import org.apache.olingo.odata4.server.api.uri.queryoption.IdOption; -import org.apache.olingo.odata4.server.api.uri.queryoption.InlineCountOption; +import org.apache.olingo.odata4.server.api.uri.queryoption.CountOption; import org.apache.olingo.odata4.server.api.uri.queryoption.OrderByOption; import org.apache.olingo.odata4.server.api.uri.queryoption.SearchOption; import org.apache.olingo.odata4.server.api.uri.queryoption.SelectOption; @@ -181,7 +181,7 @@ public class UriInfoImpl implements UriInfo { } @Override - public InlineCountOption getInlineCountOption() { + public CountOption getInlineCountOption() { return inlineCountOption; } @@ -288,4 +288,9 @@ public class UriInfoImpl implements UriInfo { this.fragment = fragment; return this; } + + public void removeResourcePart(int index) { + this.pathParts.remove(index); + + } } \ No newline at end of file diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriParameterImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParameterImpl.java similarity index 95% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriParameterImpl.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParameterImpl.java index 1d373a21e..582c5ee95 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriParameterImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParameterImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri.apiimpl; +package org.apache.olingo.odata4.server.core.uri; import org.apache.olingo.odata4.server.api.uri.UriParameter; import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression; @@ -60,7 +60,7 @@ public class UriParameterImpl implements UriParameter { } @Override - public Expression getExression() { + public Expression getExpression() { return expression; } diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceActionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceActionImpl.java similarity index 97% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceActionImpl.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceActionImpl.java index 9ae40fd1d..a5a539ebc 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceActionImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceActionImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri.apiimpl; +package org.apache.olingo.odata4.server.core.uri; import org.apache.olingo.odata4.commons.api.edm.EdmAction; import org.apache.olingo.odata4.commons.api.edm.EdmActionImport; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceComplexPropertyImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceComplexPropertyImpl.java similarity index 97% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceComplexPropertyImpl.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceComplexPropertyImpl.java index bcd78ea7a..4ba6093f5 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceComplexPropertyImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceComplexPropertyImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri.apiimpl; +package org.apache.olingo.odata4.server.core.uri; import org.apache.olingo.odata4.commons.api.edm.EdmComplexType; import org.apache.olingo.odata4.commons.api.edm.EdmProperty; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceCountImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceCountImpl.java similarity index 95% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceCountImpl.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceCountImpl.java index 93394311d..46ae4143f 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceCountImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceCountImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri.apiimpl; +package org.apache.olingo.odata4.server.core.uri; import org.apache.olingo.odata4.server.api.uri.UriResourceCount; import org.apache.olingo.odata4.server.api.uri.UriResourceKind; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceEntitySetImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceEntitySetImpl.java similarity index 97% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceEntitySetImpl.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceEntitySetImpl.java index bbeff822c..b7033e075 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceEntitySetImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceEntitySetImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri.apiimpl; +package org.apache.olingo.odata4.server.core.uri; import org.apache.olingo.odata4.commons.api.edm.EdmEntitySet; import org.apache.olingo.odata4.commons.api.edm.EdmEntityType; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceFunctionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceFunctionImpl.java similarity index 98% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceFunctionImpl.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceFunctionImpl.java index 2b67c4f68..3f0eaa194 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceFunctionImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceFunctionImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri.apiimpl; +package org.apache.olingo.odata4.server.core.uri; import java.util.ArrayList; import java.util.List; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceImpl.java similarity index 95% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceImpl.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceImpl.java index dddf930f9..5441fb01f 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri.apiimpl; +package org.apache.olingo.odata4.server.core.uri; import org.apache.olingo.odata4.server.api.uri.UriResource; import org.apache.olingo.odata4.server.api.uri.UriResourceKind; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceItImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceItImpl.java similarity index 96% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceItImpl.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceItImpl.java index a7df2ff12..665dd6e7e 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceItImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceItImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri.apiimpl; +package org.apache.olingo.odata4.server.core.uri; import org.apache.olingo.odata4.commons.api.edm.EdmType; import org.apache.olingo.odata4.server.api.uri.UriResourceIt; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceLambdaAllImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAllImpl.java similarity index 97% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceLambdaAllImpl.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAllImpl.java index 629243710..175efc2f0 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceLambdaAllImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAllImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri.apiimpl; +package org.apache.olingo.odata4.server.core.uri; import org.apache.olingo.odata4.commons.api.edm.EdmProperty; import org.apache.olingo.odata4.commons.api.edm.EdmType; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceLambdaAnyImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAnyImpl.java similarity index 97% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceLambdaAnyImpl.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAnyImpl.java index c5f8587b1..87dcd25a2 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceLambdaAnyImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaAnyImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri.apiimpl; +package org.apache.olingo.odata4.server.core.uri; import org.apache.olingo.odata4.commons.api.edm.EdmProperty; import org.apache.olingo.odata4.commons.api.edm.EdmType; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceLambdaVarImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaVarImpl.java similarity index 97% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceLambdaVarImpl.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaVarImpl.java index b522e7738..f84971baa 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceLambdaVarImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceLambdaVarImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri.apiimpl; +package org.apache.olingo.odata4.server.core.uri; import org.apache.olingo.odata4.commons.api.edm.EdmType; import org.apache.olingo.odata4.server.api.uri.UriResourceKind; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceNavigationPropertyImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceNavigationPropertyImpl.java similarity index 97% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceNavigationPropertyImpl.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceNavigationPropertyImpl.java index a1a25e199..6cccd1f00 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceNavigationPropertyImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceNavigationPropertyImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri.apiimpl; +package org.apache.olingo.odata4.server.core.uri; import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty; import org.apache.olingo.odata4.commons.api.edm.EdmType; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourcePrimitivePropertyImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourcePrimitivePropertyImpl.java similarity index 96% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourcePrimitivePropertyImpl.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourcePrimitivePropertyImpl.java index d11c989b5..57a0046ef 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourcePrimitivePropertyImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourcePrimitivePropertyImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri.apiimpl; +package org.apache.olingo.odata4.server.core.uri; import org.apache.olingo.odata4.commons.api.edm.EdmProperty; import org.apache.olingo.odata4.commons.api.edm.EdmType; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceRefImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRefImpl.java similarity index 95% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceRefImpl.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRefImpl.java index 8648b900a..87e5d6561 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceRefImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRefImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri.apiimpl; +package org.apache.olingo.odata4.server.core.uri; import org.apache.olingo.odata4.server.api.uri.UriResourceKind; import org.apache.olingo.odata4.server.api.uri.UriResourceRef; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceRootImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRootImpl.java similarity index 96% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceRootImpl.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRootImpl.java index d2687c4f3..3e7620d6b 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceRootImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceRootImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri.apiimpl; +package org.apache.olingo.odata4.server.core.uri; import org.apache.olingo.odata4.commons.api.edm.EdmType; import org.apache.olingo.odata4.server.api.uri.UriResourceKind; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceSingletonImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceSingletonImpl.java similarity index 97% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceSingletonImpl.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceSingletonImpl.java index 8f5aefae7..56e408ba3 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceSingletonImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceSingletonImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri.apiimpl; +package org.apache.olingo.odata4.server.core.uri; import org.apache.olingo.odata4.commons.api.edm.EdmEntityType; import org.apache.olingo.odata4.commons.api.edm.EdmSingleton; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceStartingTypeFilterImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceStartingTypeFilterImpl.java similarity index 90% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceStartingTypeFilterImpl.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceStartingTypeFilterImpl.java index 5b2d54609..baf4ebeb5 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceStartingTypeFilterImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceStartingTypeFilterImpl.java @@ -16,14 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri.apiimpl; +package org.apache.olingo.odata4.server.core.uri; import org.apache.olingo.odata4.commons.api.edm.EdmType; import org.apache.olingo.odata4.server.api.uri.UriResourceKind; -import org.apache.olingo.odata4.server.api.uri.UriResourceStartingTypeFilter; -public class UriResourceStartingTypeFilterImpl extends UriResourceWithKeysImpl - implements UriResourceStartingTypeFilter { +public class UriResourceStartingTypeFilterImpl extends UriResourceWithKeysImpl { private EdmType type; private boolean isCollection; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceTypedImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceTypedImpl.java similarity index 97% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceTypedImpl.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceTypedImpl.java index 1d10f1df0..2cec8dee2 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceTypedImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceTypedImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri.apiimpl; +package org.apache.olingo.odata4.server.core.uri; import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType; import org.apache.olingo.odata4.commons.api.edm.EdmType; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceValueImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceValueImpl.java similarity index 95% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceValueImpl.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceValueImpl.java index 026591e4c..53776141a 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceValueImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceValueImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri.apiimpl; +package org.apache.olingo.odata4.server.core.uri; import org.apache.olingo.odata4.server.api.uri.UriResourceKind; import org.apache.olingo.odata4.server.api.uri.UriResourceValue; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceWithKeysImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceWithKeysImpl.java similarity index 98% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceWithKeysImpl.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceWithKeysImpl.java index 54ae62815..d911aa5c2 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceWithKeysImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriResourceWithKeysImpl.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri.apiimpl; +package org.apache.olingo.odata4.server.core.uri; import java.util.ArrayList; import java.util.List; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/Parser.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/Parser.java index 5f7b42a66..93a6ce263 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/Parser.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/Parser.java @@ -34,8 +34,8 @@ import org.apache.olingo.odata4.server.api.uri.UriInfo; import org.apache.olingo.odata4.server.api.uri.UriInfoKind; import org.apache.olingo.odata4.server.api.uri.UriResource; import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped; -import org.apache.olingo.odata4.server.core.uri.UriParserException; -import org.apache.olingo.odata4.server.core.uri.UriParserSyntaxException; +import org.apache.olingo.odata4.server.core.uri.UriInfoImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceImpl; import org.apache.olingo.odata4.server.core.uri.antlr.UriLexer; import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser; import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AllEOFContext; @@ -48,8 +48,6 @@ import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.MetadataEO import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.OrderByEOFContext; import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.PathSegmentEOFContext; import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.SelectEOFContext; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.CountOptionImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/RawUri.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/RawUri.java index 5b8fbdf3d..fd0e64aaa 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/RawUri.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/RawUri.java @@ -22,7 +22,7 @@ import java.util.List; public class RawUri { public String uri; - public String sheme; + public String scheme; public String authority; public String path; public String queryOptionString; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriContext.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriContext.java index 724a0113d..664910416 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriContext.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriContext.java @@ -21,11 +21,11 @@ package org.apache.olingo.odata4.server.core.uri.parser; import java.util.Stack; import org.apache.olingo.odata4.commons.api.edm.EdmType; +import org.apache.olingo.odata4.server.core.uri.UriInfoImpl; import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.ExpandPathContext; import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.ExpandPathExtensionContext; import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.SelectItemContext; import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.SelectSegmentContext; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl; import org.apache.olingo.odata4.server.core.uri.parser.UriParseTreeVisitor.TypeInformation; import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandItemImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.SelectItemImpl; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriDecoder.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriDecoder.java index 5f19a5d52..dc8ac0575 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriDecoder.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriDecoder.java @@ -27,7 +27,6 @@ import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.olingo.odata4.server.core.uri.UriParserSyntaxException; import org.apache.olingo.odata4.server.core.uri.parser.RawUri.QueryOption; public class UriDecoder { @@ -39,7 +38,7 @@ public class UriDecoder { Matcher m = uriPattern.matcher(uri); if (m.matches()) { - rawUri.sheme = m.group(2); + rawUri.scheme = m.group(2); rawUri.authority = m.group(4); rawUri.path = m.group(5); rawUri.queryOptionString = m.group(7); diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParseTreeVisitor.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParseTreeVisitor.java index 48f2fb110..4f99f0182 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParseTreeVisitor.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParseTreeVisitor.java @@ -47,8 +47,27 @@ import org.apache.olingo.odata4.server.api.uri.UriResource; import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped; import org.apache.olingo.odata4.server.api.uri.queryoption.expression.BinaryOperatorKind; import org.apache.olingo.odata4.server.api.uri.queryoption.expression.MethodCallKind; -import org.apache.olingo.odata4.server.core.uri.UriParserException; -import org.apache.olingo.odata4.server.core.uri.UriParserSemanticException; +import org.apache.olingo.odata4.server.core.uri.UriInfoImpl; +import org.apache.olingo.odata4.server.core.uri.UriParameterImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceActionImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceComplexPropertyImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceCountImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceEntitySetImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceFunctionImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceItImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceLambdaAllImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceLambdaAnyImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceLambdaVarImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceNavigationPropertyImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourcePrimitivePropertyImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceRefImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceRootImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceSingletonImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceStartingTypeFilterImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceTypedImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceValueImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceWithKeysImpl; import org.apache.olingo.odata4.server.core.uri.antlr.UriLexer; import org.apache.olingo.odata4.server.core.uri.antlr.UriParserBaseVisitor; import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AliasAndValueContext; @@ -107,8 +126,10 @@ import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.MonthMetho import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.NameValueOptListContext; import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.NameValuePairContext; import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.NamespaceContext; +import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.NaninfinityContext; import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.NowMethodCallExprContext; import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.NullruleContext; +import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.Number_in_jsonContext; import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.OdataIdentifierContext; import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.OrderByContext; import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.OrderByEOFContext; @@ -139,27 +160,6 @@ import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.Totalsecon import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.TrimMethodCallExprContext; import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.UnaryContext; import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.YearMethodCallExprContext; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriParameterImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceActionImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceComplexPropertyImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceCountImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceEntitySetImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceFunctionImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceItImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceLambdaAllImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceLambdaAnyImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceLambdaVarImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceNavigationPropertyImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourcePrimitivePropertyImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceRefImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceRootImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceSingletonImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceStartingTypeFilterImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceTypedImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceValueImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceWithKeysImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.AliasQueryOptionImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.CountOptionImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandItemImpl; @@ -459,7 +459,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { if (lastResourcePart == null) { // this may be the case if a member expression within a filter starts with a typeCast UriResourceStartingTypeFilterImpl uriResource = new UriResourceStartingTypeFilterImpl() - .setType(source.type) + .setType(filterEntityType) .setCollection(source.isCollection); if (source.isCollection) { uriResource.setCollectionTypeFilter(filterEntityType); @@ -525,7 +525,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { if (lastResourcePart == null) { // this may be the case if a member expression within a filter starts with a typeCast UriResourceStartingTypeFilterImpl uriResource = new UriResourceStartingTypeFilterImpl() - .setType(source.type) + .setType(filterComplexType) .setCollection(source.isCollection); if (source.isCollection) { @@ -700,8 +700,43 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { uriInfoImplpath.addResourcePart((UriResourceImpl) super.visitAltAll(ctx)); - return new MemberImpl() - .setPath(uriInfoImplpath); + EdmType startType = removeUriResourceStartingTypeFilterImpl(uriInfoImplpath); + + MemberImpl ret = new MemberImpl(); + + ret.setResourcePath(uriInfoImplpath); + if (startType != null) { + ret.setTypeFilter(startType); + } + + return ret; + } + + private EdmType removeUriResourceStartingTypeFilterImpl(UriInfoImpl uriInfoImplpath) { + + List segments = uriInfoImplpath.getUriResourceParts(); + if (segments.size() == 0) { + return null; + } + + UriResource segment = segments.get(0); + if (segment instanceof UriResourceStartingTypeFilterImpl) { + UriResourceStartingTypeFilterImpl startingTypeFilter = (UriResourceStartingTypeFilterImpl) segment; + + EdmType type = null; + if (startingTypeFilter.getTypeFilterOnEntry()!= null) { + type =startingTypeFilter.getTypeFilterOnEntry(); + } else if (startingTypeFilter.getTypeFilterOnCollection()!= null) { + type =startingTypeFilter.getTypeFilterOnCollection(); + } else { + type =startingTypeFilter.getType(); + } + + uriInfoImplpath.removeResourcePart(0); + return type; + } + + return null; } @Override @@ -721,8 +756,14 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { uriInfoImplpath.addResourcePart((UriResourceImpl) super.visitAltAny(ctx)); - return new MemberImpl() - .setPath(uriInfoImplpath); + EdmType startType = removeUriResourceStartingTypeFilterImpl(uriInfoImplpath); + + MemberImpl ret = new MemberImpl(); + ret.setResourcePath(uriInfoImplpath); + if (startType != null) { + ret.setTypeFilter(startType); + } + return ret; } @Override @@ -1125,7 +1166,12 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { // contextUriInfo.addPathInfo(pathInfoIT); super.visitExpandPath(ctx); - expandItem.setResourceInfo(context.contextUriInfo); + + EdmType startType = this.removeUriResourceStartingTypeFilterImpl(context.contextUriInfo); + expandItem.setResourcePath(context.contextUriInfo); + if ( startType != null) { + expandItem.setTypeFilter(startType); + } // reset context context.contextUriInfo = uriInfoResourceBU; @@ -1146,14 +1192,14 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { targetType = getTypeInformation(lastSegment).type; isColl = lastSegment.isCollection(); } else { - if (context.contextExpandItemPath.getResourceInfo() == null) { + if (context.contextExpandItemPath.getResourcePath() == null) { // use the type of the last resource path segement UriResourceTypedImpl lastSegment = (UriResourceTypedImpl) context.contextUriInfo.getLastResourcePart(); targetType = getTypeInformation(lastSegment).type; isColl = lastSegment.isCollection(); } else { // use the type of the last ''expand'' path segement - UriInfoImpl info = (UriInfoImpl) context.contextExpandItemPath.getResourceInfo(); + UriInfoImpl info = (UriInfoImpl) context.contextExpandItemPath.getResourcePath(); targetType = getTypeInformation((UriResourceImpl) info.getLastResourcePart()).type; isColl = ((UriResourcePartTyped) info.getLastResourcePart()).isCollection(); } @@ -1162,14 +1208,14 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { context.contextTypes.push(new TypeInformation(targetType, isColl)); if (ctx.vC != null) { - UriInfoImpl resourcePath = (UriInfoImpl) context.contextExpandItemPath.getResourceInfo(); + UriInfoImpl resourcePath = (UriInfoImpl) context.contextExpandItemPath.getResourcePath(); resourcePath.addResourcePart(new UriResourceCountImpl()); for (ExpandCountOptionContext s : ctx.vlEOC) { list.add((SystemQueryOptionImpl) s.accept(this)); } } else if (ctx.vR != null) { - UriInfoImpl resourcePath = (UriInfoImpl) context.contextExpandItemPath.getResourceInfo(); + UriInfoImpl resourcePath = (UriInfoImpl) context.contextExpandItemPath.getResourcePath(); resourcePath.addResourcePart(new UriResourceRefImpl()); for (ExpandRefOptionContext s : ctx.vlEOR) { @@ -1365,8 +1411,15 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { uriInfoImplpath.addResourcePart((UriResourceImpl) ctx.vANY.accept(this)); } - return new MemberImpl() - .setPath(uriInfoImplpath); + EdmType startType = removeUriResourceStartingTypeFilterImpl(uriInfoImplpath); + + MemberImpl ret = new MemberImpl(); + ret.setResourcePath(uriInfoImplpath); + if (startType != null) { + ret.setTypeFilter(startType); + } + + return ret; } @Override @@ -1556,6 +1609,11 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { return uriParameter; } + @Override + public Object visitNaninfinity(NaninfinityContext ctx) { + return new LiteralImpl().setType(EdmPrimitiveTypeKind.Decimal.getEdmPrimitiveTypeInstance()).setText(ctx.getText()); + } + @Override public ExpressionImpl visitNowMethodCallExpr(final NowMethodCallExprContext ctx) { return new MethodCallImpl() @@ -1661,7 +1719,8 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { if (child1 instanceof EnumLitContext || child1 instanceof BooleanNonCaseContext || - child1 instanceof NullruleContext) { + child1 instanceof NullruleContext || + child1 instanceof NaninfinityContext) { return child1.accept(this); } return new LiteralImpl().setText(ctx.getText()); @@ -1725,7 +1784,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { } return new MemberImpl() - .setPath(uriInfoImplpath); + .setResourcePath(uriInfoImplpath); } @@ -1797,15 +1856,16 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { if (ctx.vNS == null) { EdmType prevType = null; - if (context.contextSelectItem.getResourceInfo() == null) { + if (context.contextSelectItem.getResourcePath() == null) { prevType = context.contextTypes.peek().type; } else { - UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourceInfo(); + UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourcePath(); UriResource last = uriInfo.getLastResourcePart(); - if (!(last instanceof UriResourceTypedImpl)) { - throw wrap(new UriParserSemanticException("prev segement typed")); + + prevType = getTypeInformation( last).type; + if (prevType == null) { + throw wrap(new UriParserSemanticException("prev segement not typed")); } - prevType = getTypeInformation((UriResourceTypedImpl) last).type; } if (!(prevType instanceof EdmStructuralType)) { @@ -1828,17 +1888,23 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { UriResourcePrimitivePropertyImpl simple = new UriResourcePrimitivePropertyImpl(); simple.setProperty(property); - UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourceInfo(); + UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourcePath(); if (uriInfo == null) { uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource); uriInfo.addResourcePart(simple); - context.contextSelectItem.setResourceInfo(uriInfo); + + EdmType startType = this.removeUriResourceStartingTypeFilterImpl(uriInfo); + if (startType != null) { + context.contextSelectItem.setTypeFilter(startType); + } + + context.contextSelectItem.setResourcePath(uriInfo); } else { uriInfo.addResourcePart(simple); } return this; } else { - UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourceInfo(); + UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourcePath(); UriResourceComplexPropertyImpl complex = new UriResourceComplexPropertyImpl(); complex.setProperty(property); @@ -1846,7 +1912,13 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { if (uriInfo == null) { uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource); uriInfo.addResourcePart(complex); - context.contextSelectItem.setResourceInfo(uriInfo); + + EdmType startType = this.removeUriResourceStartingTypeFilterImpl(uriInfo); + if (startType != null) { + context.contextSelectItem.setTypeFilter(startType); + } + + context.contextSelectItem.setResourcePath(uriInfo); } else { uriInfo.addResourcePart(complex); } @@ -1862,7 +1934,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { FullQualifiedName fullName = new FullQualifiedName(namespace, odi); // contextSelectItem.addQualifiedThing(fullName); - if (context.contextSelectItem.getResourceInfo() == null) { + if (context.contextSelectItem.getResourcePath() == null) { EdmType prevType = context.contextTypes.peek().type; // check for complex type cast @@ -1875,7 +1947,13 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource); uriInfo.addResourcePart(resourcePart); - context.contextSelectItem.setResourceInfo(uriInfo); + + EdmType startType = this.removeUriResourceStartingTypeFilterImpl(uriInfo); + if (startType != null) { + context.contextSelectItem.setTypeFilter(startType); + } + + context.contextSelectItem.setResourcePath(uriInfo); return this; } } @@ -1888,7 +1966,13 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource); uriInfo.addResourcePart(resourcePart); - context.contextSelectItem.setResourceInfo(uriInfo); + + EdmType startType = this.removeUriResourceStartingTypeFilterImpl(uriInfo); + if (startType != null) { + context.contextSelectItem.setTypeFilter(startType); + } + + context.contextSelectItem.setResourcePath(uriInfo); return this; } } @@ -1897,7 +1981,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { } } else { - UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourceInfo(); + UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourcePath(); UriResource last = uriInfo.getLastResourcePart(); if (!(last instanceof UriResourceTypedImpl)) { throw wrap(new UriParserSemanticException("prev segement typed")); @@ -1935,10 +2019,10 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { } EdmType prevType = null; - if (context.contextSelectItem.getResourceInfo() == null) { + if (context.contextSelectItem.getResourcePath() == null) { prevType = context.contextTypes.peek().type; } else { - UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourceInfo(); + UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourcePath(); UriResource last = uriInfo.getLastResourcePart(); if (!(last instanceof UriResourceTypedImpl)) { throw wrap(new UriParserSemanticException("prev segement typed")); @@ -1956,7 +2040,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { UriResourceActionImpl uriAction = new UriResourceActionImpl(); uriAction.setAction(action); - UriInfoImpl resourcePath = (UriInfoImpl) context.contextSelectItem.getResourceInfo(); + UriInfoImpl resourcePath = (UriInfoImpl) context.contextSelectItem.getResourcePath(); resourcePath.addResourcePart(uriAction); } @@ -1968,7 +2052,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor { UriResourceFunctionImpl uriFunction = new UriResourceFunctionImpl(); uriFunction.setFunction(function); - UriInfoImpl resourcePath = (UriInfoImpl) context.contextSelectItem.getResourceInfo(); + UriInfoImpl resourcePath = (UriInfoImpl) context.contextSelectItem.getResourcePath(); resourcePath.addResourcePart(uriFunction); } } diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserException.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserException.java similarity index 95% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserException.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserException.java index 506e00b47..8f54672ab 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserException.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserException.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri; +package org.apache.olingo.odata4.server.core.uri.parser; //TODO Check name of this exception when implementing proper error handling public class UriParserException extends Exception { diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSemanticException.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSemanticException.java similarity index 95% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSemanticException.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSemanticException.java index 69631a118..29c6653c5 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSemanticException.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSemanticException.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri; +package org.apache.olingo.odata4.server.core.uri.parser; //TODO Check name of this exception when implementing proper error handling public class UriParserSemanticException extends UriParserException { diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSyntaxException.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSyntaxException.java similarity index 95% rename from odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSyntaxException.java rename to odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSyntaxException.java index eb864f70a..9fffde6a9 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/UriParserSyntaxException.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParserSyntaxException.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.uri; +package org.apache.olingo.odata4.server.core.uri.parser; public class UriParserSyntaxException extends UriParserException { diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CountOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CountOptionImpl.java index b9d6f2cb8..86841da33 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CountOptionImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/CountOptionImpl.java @@ -18,10 +18,10 @@ */ package org.apache.olingo.odata4.server.core.uri.queryoption; -import org.apache.olingo.odata4.server.api.uri.queryoption.InlineCountOption; +import org.apache.olingo.odata4.server.api.uri.queryoption.CountOption; import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions; -public class CountOptionImpl extends SystemQueryOptionImpl implements InlineCountOption { +public class CountOptionImpl extends SystemQueryOptionImpl implements CountOption { private boolean count; diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandItemImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandItemImpl.java index 0b7be406c..dc3e2abe5 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandItemImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/ExpandItemImpl.java @@ -20,11 +20,12 @@ package org.apache.olingo.odata4.server.core.uri.queryoption; import java.util.List; +import org.apache.olingo.odata4.commons.api.edm.EdmType; import org.apache.olingo.odata4.server.api.uri.UriInfoResource; import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandItem; import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandOption; import org.apache.olingo.odata4.server.api.uri.queryoption.FilterOption; -import org.apache.olingo.odata4.server.api.uri.queryoption.InlineCountOption; +import org.apache.olingo.odata4.server.api.uri.queryoption.CountOption; import org.apache.olingo.odata4.server.api.uri.queryoption.LevelsExpandOption; import org.apache.olingo.odata4.server.api.uri.queryoption.OrderByOption; import org.apache.olingo.odata4.server.api.uri.queryoption.SearchOption; @@ -32,6 +33,7 @@ import org.apache.olingo.odata4.server.api.uri.queryoption.SelectOption; import org.apache.olingo.odata4.server.api.uri.queryoption.SkipOption; import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions; import org.apache.olingo.odata4.server.api.uri.queryoption.TopOption; +import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MemberImpl; public class ExpandItemImpl implements ExpandItem { private LevelsExpandOption levelsExpandOption; @@ -40,7 +42,7 @@ public class ExpandItemImpl implements ExpandItem { private OrderByOption orderByOption; private SkipOption skipOption; private TopOption topOption; - private InlineCountOption inlineCountOption; + private CountOption inlineCountOption; private SelectOption selectOption; private ExpandOption expandOption; @@ -49,6 +51,7 @@ public class ExpandItemImpl implements ExpandItem { private boolean isStar; private boolean isRef; + private EdmType startTypeFilter; public ExpandItemImpl setSystemQueryOption(final SystemQueryOptionImpl sysItem) { @@ -113,7 +116,7 @@ public class ExpandItemImpl implements ExpandItem { } @Override - public InlineCountOption getInlineCountOption() { + public CountOption getInlineCountOption() { return inlineCountOption; } @@ -128,13 +131,13 @@ public class ExpandItemImpl implements ExpandItem { return expandOption; } - public ExpandItemImpl setResourceInfo(final UriInfoResource resourceInfo) { + public ExpandItemImpl setResourcePath(final UriInfoResource resourceInfo) { this.resourceInfo = resourceInfo; return this; } @Override - public UriInfoResource getResourceInfo() { + public UriInfoResource getResourcePath() { return resourceInfo; } @@ -159,4 +162,15 @@ public class ExpandItemImpl implements ExpandItem { return this; } + + + @Override + public EdmType getStartTypeFilter() { + return this.startTypeFilter; + } + + public ExpandItemImpl setTypeFilter(EdmType startTypeFilter) { + this.startTypeFilter = startTypeFilter; + return this; + } } diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java index 5da20ca5f..a3085fa11 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java @@ -18,6 +18,7 @@ */ package org.apache.olingo.odata4.server.core.uri.queryoption; +import org.apache.olingo.odata4.commons.api.edm.EdmType; import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName; import org.apache.olingo.odata4.server.api.uri.UriInfoResource; import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem; @@ -29,13 +30,15 @@ public class SelectItemImpl implements SelectItem { private boolean isStar; private FullQualifiedName addOperationsInSchemaNameSpace; + private EdmType startTypeFilter; + @Override - public UriInfoResource getResourceInfo() { + public UriInfoResource getResourcePath() { return path; } - public SelectItemImpl setResourceInfo(final UriInfoResource path) { + public SelectItemImpl setResourcePath(final UriInfoResource path) { this.path = path; return this; } @@ -67,5 +70,15 @@ public class SelectItemImpl implements SelectItem { public void addAllOperationsInSchema(final FullQualifiedName addOperationsInSchemaNameSpace) { this.addOperationsInSchemaNameSpace = addOperationsInSchemaNameSpace; } + + @Override + public EdmType getStartTypeFilter() { + return this.startTypeFilter; + } + + public SelectItemImpl setTypeFilter(EdmType startTypeFilter) { + this.startTypeFilter = startTypeFilter; + return this; + } } diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MemberImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MemberImpl.java index ce9c78f43..d0adfb07a 100644 --- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MemberImpl.java +++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MemberImpl.java @@ -25,21 +25,22 @@ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor; import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Member; import org.apache.olingo.odata4.server.api.uri.queryoption.expression.VisitableExression; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceTypedImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceWithKeysImpl; +import org.apache.olingo.odata4.server.core.uri.UriInfoImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceTypedImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceWithKeysImpl; public class MemberImpl extends ExpressionImpl implements Member, VisitableExression { private UriInfoResource path; + private EdmType startTypeFilter; @Override - public UriInfoResource getPath() { + public UriInfoResource getResourcePath() { return path; } - public Member setPath(final UriInfoResource pathSegments) { + public Member setResourcePath(final UriInfoResource pathSegments) { path = pathSegments; return this; } @@ -84,5 +85,15 @@ public class MemberImpl extends ExpressionImpl implements Member, VisitableExres } return false; } + + @Override + public EdmType getStartTypeFilter() { + return this.startTypeFilter; + } + + public MemberImpl setTypeFilter(EdmType startTypeFilter) { + this.startTypeFilter = startTypeFilter; + return this; + } } diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/RawUriTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/RawUriTest.java index c3eec583b..b4ab2b05d 100644 --- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/RawUriTest.java +++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/RawUriTest.java @@ -26,6 +26,7 @@ import java.util.List; import org.apache.olingo.odata4.server.core.uri.parser.RawUri; import org.apache.olingo.odata4.server.core.uri.parser.UriDecoder; +import org.apache.olingo.odata4.server.core.uri.parser.UriParserSyntaxException; import org.junit.Test; public class RawUriTest { diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriInfoImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriInfoImplTest.java index 9864cfb7f..5c91e18e3 100644 --- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriInfoImplTest.java +++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriInfoImplTest.java @@ -38,9 +38,6 @@ import org.apache.olingo.odata4.server.api.uri.queryoption.CustomQueryOption; import org.apache.olingo.odata4.server.core.edm.provider.EdmProviderImpl; import org.apache.olingo.odata4.server.core.testutil.EdmTechProvider; import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceActionImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceEntitySetImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.CountOptionImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl; diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriParameterImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriParameterImplTest.java index 3e0990170..234ba4f71 100644 --- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriParameterImplTest.java +++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/UriParameterImplTest.java @@ -42,25 +42,6 @@ import org.apache.olingo.odata4.server.core.edm.provider.EdmProviderImpl; import org.apache.olingo.odata4.server.core.edm.provider.EdmSingletonImpl; import org.apache.olingo.odata4.server.core.testutil.EdmTechProvider; import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriParameterImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceActionImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceComplexPropertyImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceCountImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceEntitySetImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceFunctionImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceItImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceLambdaAllImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceLambdaAnyImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceLambdaVarImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceNavigationPropertyImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourcePrimitivePropertyImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceRefImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceRootImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceSingletonImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceStartingTypeFilterImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceTypedImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceValueImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceWithKeysImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.expression.LiteralImpl; import org.junit.Test; @@ -81,7 +62,7 @@ public class UriParameterImplTest { assertEquals("Text", impl.getText()); assertEquals("A", impl.getName()); assertEquals("@A", impl.getAlias()); - assertEquals(expression, impl.getExression()); + assertEquals(expression, impl.getExpression()); } @Test @@ -495,6 +476,7 @@ public class UriParameterImplTest { assertEquals(true, impl.isCollection()); } + /* @Test public void testUriResourceStartingTypeFilterImpl() { UriResourceStartingTypeFilterImpl impl = new UriResourceStartingTypeFilterImpl(); @@ -516,5 +498,5 @@ public class UriParameterImplTest { impl.setKeyPredicates(keyPredicates); assertEquals(false, impl.isCollection()); - } + }*/ } diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java index cda67846f..5f723a266 100644 --- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java +++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestFullResourcePath.java @@ -18,12 +18,17 @@ */ package org.apache.olingo.odata4.server.core.uri.antlr; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.Arrays; import org.apache.olingo.odata4.commons.api.ODataApplicationException; import org.apache.olingo.odata4.commons.api.edm.Edm; +import org.apache.olingo.odata4.commons.api.edm.EdmType; +import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName; import org.apache.olingo.odata4.server.api.uri.UriInfoKind; import org.apache.olingo.odata4.server.api.uri.UriResourceKind; import org.apache.olingo.odata4.server.api.uri.queryoption.expression.BinaryOperatorKind; @@ -32,10 +37,11 @@ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.MethodCall import org.apache.olingo.odata4.server.core.edm.provider.EdmProviderImpl; import org.apache.olingo.odata4.server.core.testutil.EdmTechProvider; import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider; -import org.apache.olingo.odata4.server.core.testutil.FilterValidator; -import org.apache.olingo.odata4.server.core.testutil.ResourceValidator; -import org.apache.olingo.odata4.server.core.testutil.UriValidator; -import org.apache.olingo.odata4.server.core.uri.UriParserException; +import org.apache.olingo.odata4.server.core.uri.parser.UriParserException; +import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MemberImpl; +import org.apache.olingo.odata4.server.core.uri.testutil.FilterValidator; +import org.apache.olingo.odata4.server.core.uri.testutil.ResourceValidator; +import org.apache.olingo.odata4.server.core.uri.testutil.UriValidator; import org.junit.Test; public class TestFullResourcePath { @@ -53,7 +59,7 @@ public class TestFullResourcePath { @Test public void test() throws UriParserException { - // testUri.log("ESAllPrim?$orderby=PropertyDouble eq 3.5E+38"); + } @Test @@ -2344,10 +2350,11 @@ public class TestFullResourcePath { + "$expand=com.sap.odata.test1.ETBaseTwoKeyNav/NavPropertyETKeyNavMany") .isKind(UriInfoKind.resource).goPath().first() .goExpand().first() + .isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav) .goPath().first() - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) - .n() + // .isType(EdmTechProvider.nameETTwoKeyNav) + // .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + // .n() .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true); testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='Hugo')?" @@ -2356,10 +2363,11 @@ public class TestFullResourcePath { .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'Hugo'") .goExpand().first() + .isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav) .goPath().first() - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) - .n() + //.isType(EdmTechProvider.nameETTwoKeyNav) + //.isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + //.n() .isNavProperty("NavPropertyETKeyNavMany", EdmTechProvider.nameETKeyNav, true); testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')?" @@ -2368,10 +2376,11 @@ public class TestFullResourcePath { .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") .goExpand().first() + .isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav) .goPath().first() - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) - .n() + //.isType(EdmTechProvider.nameETTwoKeyNav) + //.isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + //.n() .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true); testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')?$expand=com.sap.odata.test1.ETBaseTwoKeyNav" @@ -2380,20 +2389,22 @@ public class TestFullResourcePath { .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") .goExpand().first() + .isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav) .goPath().first() - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) - .n() + //.isType(EdmTechProvider.nameETTwoKeyNav) + //.isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + //.n() .isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true) .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBaseTwoKeyNav); testUri.run("ESTwoKeyNav?$expand=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyComplexNav/NavPropertyETTwoKeyNavOne") .isKind(UriInfoKind.resource).goPath().first() .goExpand().first() + .isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav) .goPath().first() - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) - .n() + //.isType(EdmTechProvider.nameETTwoKeyNav) + //.isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + //.n() .isComplex("PropertyComplexNav") .isType(EdmTechProvider.nameCTBasePrimCompNav) .n() @@ -2403,10 +2414,11 @@ public class TestFullResourcePath { + "/com.sap.odata.test1.CTTwoBasePrimCompNav/NavPropertyETTwoKeyNavOne") .isKind(UriInfoKind.resource).goPath().first() .goExpand().first() + .isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav) .goPath().first() - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) - .n() + //.isType(EdmTechProvider.nameETTwoKeyNav) + //.isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + //.n() .isComplex("PropertyComplexNav") .isType(EdmTechProvider.nameCTBasePrimCompNav) .n() @@ -2434,11 +2446,12 @@ public class TestFullResourcePath { .isKeyPredicate(0, "PropertyInt16", "1") .isKeyPredicate(1, "PropertyString", "'2'") .goExpand().first() + .isExpandStartType(EdmTechProvider.nameETBaseTwoKeyNav) .goPath().first() - .isUriPathInfoKind(UriResourceKind.startingTypeFilter) - .isType(EdmTechProvider.nameETTwoKeyNav) - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) - .n().isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true) + //.isUriPathInfoKind(UriResourceKind.startingTypeFilter) + //.isType(EdmTechProvider.nameETTwoKeyNav) + //.isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + //.n().isNavProperty("NavPropertyETTwoKeyNavMany", EdmTechProvider.nameETTwoKeyNav, true) .isType(EdmTechProvider.nameETTwoKeyNav) .isTypeFilterOnCollection(EdmTechProvider.nameETTwoBaseTwoKeyNav) .goUpExpandValidator() @@ -2462,6 +2475,17 @@ public class TestFullResourcePath { .goPath().first() .isNavProperty("NavPropertyETKeyNavOne", EdmTechProvider.nameETKeyNav, false) .isType(EdmTechProvider.nameETKeyNav); + + testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')?$select=com.sap.odata.test1.ETBaseTwoKeyNav" + + "/PropertyInt16") + .isKind(UriInfoKind.resource).goPath() + .first() + .isKeyPredicate(0, "PropertyInt16", "1") + .isKeyPredicate(1, "PropertyString", "'2'") + .isSelectStartType(0, EdmTechProvider.nameETBaseTwoKeyNav) + .goSelectItem(0) + .first() + .isPrimitiveProperty("PropertyInt16", EdmTechProvider.nameInt16, false); testUri.run("ESKeyNav?$expand=NavPropertyETKeyNavOne($select=PropertyInt16)") .isKind(UriInfoKind.resource) @@ -2835,25 +2859,27 @@ public class TestFullResourcePath { .root().right(); testFilter.runOnETTwoKeyNav("com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate eq 2013-11-12") - .is("< eq <2013-11-12>>") + .is("< eq <2013-11-12>>") .root().left() .isType(EdmTechProvider.nameDate) - .isMember().goPath() - .first().isUriPathInfoKind(UriResourceKind.startingTypeFilter) - .isType(EdmTechProvider.nameETTwoKeyNav).isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) - .n().isPrimitiveProperty("PropertyDate", EdmTechProvider.nameDate, false) + .isMember().isMemberStartType(EdmTechProvider.nameETBaseTwoKeyNav).goPath() + // .first().isUriPathInfoKind(UriResourceKind.startingTypeFilter) + // .isType(EdmTechProvider.nameETTwoKeyNav).isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + // .n().isPrimitiveProperty("PropertyDate", EdmTechProvider.nameDate, false) + .first().isPrimitiveProperty("PropertyDate", EdmTechProvider.nameDate, false) .goUpFilterValidator() .root().right() .isLiteral("2013-11-12"); testFilter.runOnCTTwoPrim("com.sap.odata.test1.CTBase/AdditionalPropString eq 'SomeString'") - .is("< eq <'SomeString'>>") + .is("< eq <'SomeString'>>") .root().left() .isType(EdmTechProvider.nameString) - .isMember().goPath() - .first().isUriPathInfoKind(UriResourceKind.startingTypeFilter) - .isType(EdmTechProvider.nameCTTwoPrim).isTypeFilterOnEntry(EdmTechProvider.nameCTBase) - .n().isPrimitiveProperty("AdditionalPropString", EdmTechProvider.nameString, false) + .isMember().isMemberStartType(EdmTechProvider.nameCTBase).goPath() + // .first().isUriPathInfoKind(UriResourceKind.startingTypeFilter) + // .isType(EdmTechProvider.nameCTTwoPrim).isTypeFilterOnEntry(EdmTechProvider.nameCTBase) + // .n().isPrimitiveProperty("AdditionalPropString", EdmTechProvider.nameString, false) + .first().isPrimitiveProperty("AdditionalPropString", EdmTechProvider.nameString, false) .goUpFilterValidator() .root().right() .isLiteral("'SomeString'"); @@ -2874,7 +2900,7 @@ public class TestFullResourcePath { .root().right() .isLiteral("'SomeString'"); - // testFilter.runOnETTwoKeyNavEx("invalid").isExSemantic(0); + testFilter.runOnETTwoKeyNavEx("invalid").isExSemantic(0); testFilter.runOnETTwoKeyNavEx("PropertyComplex/invalid").isExSemantic(0); testFilter.runOnETTwoKeyNavEx("concat('a','b')/invalid").isExSyntax(0); testFilter.runOnETTwoKeyNavEx("PropertyComplex/concat('a','b')").isExSyntax(0); @@ -3269,7 +3295,7 @@ public class TestFullResourcePath { .root().right() .isType(EdmTechProvider.nameDecimal); - // DODO not synced + // testFilter.runOnETAllPrim("PropertyDecimal ge PropertyDecimal") .is("< ge >") .isBinary(BinaryOperatorKind.GE) @@ -3291,6 +3317,13 @@ public class TestFullResourcePath { .isType(EdmTechProvider.nameDecimal) .root().right() .isType(EdmTechProvider.nameDecimal); + + testFilter.runOnETAllPrim("PropertyDecimal sub NaN") + .right().isLiteral("NaN").isType(EdmTechProvider.nameDecimal); + testFilter.runOnETAllPrim("PropertyDecimal sub -INF") + .right().isLiteral("-INF").isType(EdmTechProvider.nameDecimal); + testFilter.runOnETAllPrim("PropertyDecimal sub INF") + .right().isLiteral("INF").isType(EdmTechProvider.nameDecimal); } @Test diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestLexer.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestLexer.java index 50015fac4..fd0f8beaa 100644 --- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestLexer.java +++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestLexer.java @@ -19,7 +19,7 @@ package org.apache.olingo.odata4.server.core.uri.antlr; import org.antlr.v4.runtime.Lexer; -import org.apache.olingo.odata4.server.core.testutil.TokenValidator; +import org.apache.olingo.odata4.server.core.uri.testutil.TokenValidator; import org.junit.Test; public class TestLexer { diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestParser.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestParser.java index 232f19ad1..7f2add77a 100644 --- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestParser.java +++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestParser.java @@ -18,7 +18,7 @@ */ package org.apache.olingo.odata4.server.core.uri.antlr; -import org.apache.olingo.odata4.server.core.testutil.ParserValidator; +import org.apache.olingo.odata4.server.core.uri.testutil.ParserValidator; import org.junit.Test; /** diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestUriParserImpl.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestUriParserImpl.java index f14ddbb27..e0fb3c1b1 100644 --- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestUriParserImpl.java +++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/antlr/TestUriParserImpl.java @@ -30,10 +30,10 @@ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.MethodCall import org.apache.olingo.odata4.server.core.edm.provider.EdmProviderImpl; import org.apache.olingo.odata4.server.core.testutil.EdmTechProvider; import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider; -import org.apache.olingo.odata4.server.core.testutil.FilterValidator; -import org.apache.olingo.odata4.server.core.testutil.ResourceValidator; -import org.apache.olingo.odata4.server.core.testutil.UriValidator; -import org.apache.olingo.odata4.server.core.uri.UriParserException; +import org.apache.olingo.odata4.server.core.uri.parser.UriParserException; +import org.apache.olingo.odata4.server.core.uri.testutil.FilterValidator; +import org.apache.olingo.odata4.server.core.uri.testutil.ResourceValidator; +import org.apache.olingo.odata4.server.core.uri.testutil.UriValidator; import org.junit.Test; public class TestUriParserImpl { @@ -1005,40 +1005,44 @@ public class TestUriParserImpl { // on EntityType entry testUri.run("ESTwoKeyNav(ParameterInt16=1,PropertyString='ABC')?" + "$filter=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate") - .goFilter().root().isMember().goPath() - .at(0) - .isUriPathInfoKind(UriResourceKind.startingTypeFilter) - .isType(EdmTechProvider.nameETTwoKeyNav, false) - .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) - .at(1).isType(EdmTechProvider.nameDate); + .goFilter().root().isMember() + .isMemberStartType(EdmTechProvider.nameETBaseTwoKeyNav).goPath() + // .at(0) + // .isUriPathInfoKind(UriResourceKind.startingTypeFilter) + // .isType(EdmTechProvider.nameETTwoKeyNav, false) + // .isTypeFilterOnEntry(EdmTechProvider.nameETBaseTwoKeyNav) + .at(0).isType(EdmTechProvider.nameDate); // on EntityType collection testUri.run("ESTwoKeyNav?$filter=com.sap.odata.test1.ETBaseTwoKeyNav/PropertyDate") - .goFilter().root().isMember().goPath() - .at(0) - .isUriPathInfoKind(UriResourceKind.startingTypeFilter) - .isType(EdmTechProvider.nameETTwoKeyNav, true) - .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) - .at(1).isType(EdmTechProvider.nameDate); + .goFilter().root().isMember() + .isMemberStartType(EdmTechProvider.nameETBaseTwoKeyNav).goPath() + // .at(0) + // .isUriPathInfoKind(UriResourceKind.startingTypeFilter) + // .isType(EdmTechProvider.nameETTwoKeyNav, true) + // .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav) + .at(0).isType(EdmTechProvider.nameDate); testUri.run("FICRTCTTwoPrimParam(ParameterInt16=1,ParameterString='2')?" + "$filter=com.sap.odata.test1.CTBase/AdditionalPropString") - .goFilter().root().isMember().goPath() - .at(0) - .isUriPathInfoKind(UriResourceKind.startingTypeFilter) - .isType(EdmTechProvider.nameCTTwoPrim, false) - .isTypeFilterOnEntry(EdmTechProvider.nameCTBase) - .at(1).isType(EdmTechProvider.nameString); + .goFilter().root().isMember() + .isMemberStartType(EdmTechProvider.nameCTBase).goPath() + //.at(0) + //.isUriPathInfoKind(UriResourceKind.startingTypeFilter) + //.isType(EdmTechProvider.nameCTTwoPrim, false) + //.isTypeFilterOnEntry(EdmTechProvider.nameCTBase) + .at(0).isType(EdmTechProvider.nameString); // on Complex collection testUri.run("FICRTCollCTTwoPrimParam(ParameterInt16=1,ParameterString='2')?" + "$filter=com.sap.odata.test1.CTBase/AdditionalPropString") - .goFilter().root().isMember().goPath() - .at(0) - .isUriPathInfoKind(UriResourceKind.startingTypeFilter) - .isType(EdmTechProvider.nameCTTwoPrim, true) - .isTypeFilterOnCollection(EdmTechProvider.nameCTBase) - .at(1).isType(EdmTechProvider.nameString); + .goFilter().root().isMember() + .isMemberStartType(EdmTechProvider.nameCTBase).goPath() + //.at(0) + //.isUriPathInfoKind(UriResourceKind.startingTypeFilter) + //.isType(EdmTechProvider.nameCTTwoPrim, true) + //.isTypeFilterOnCollection(EdmTechProvider.nameCTBase) + .at(0).isType(EdmTechProvider.nameString); } @@ -1116,16 +1120,10 @@ public class TestUriParserImpl { .isComplexProperty("PropertyComplex", EdmTechProvider.nameCTAllPrim, false); testUri.run("ESTwoKeyNav?$select=com.sap.odata.test1.ETBaseTwoKeyNav") - .goSelectItemPath(0) - .first() - .isUriPathInfoKind(UriResourceKind.startingTypeFilter) - .isTypeFilterOnCollection(EdmTechProvider.nameETBaseTwoKeyNav); + .isSelectStartType(0,EdmTechProvider.nameETBaseTwoKeyNav); testUri.run("ESTwoKeyNav/PropertyComplexNav?$select=com.sap.odata.test1.CTTwoBasePrimCompNav") - .goSelectItemPath(0) - .first() - .isUriPathInfoKind(UriResourceKind.startingTypeFilter) - .isTypeFilterOnCollection(EdmTechProvider.nameCTTwoBasePrimCompNav); + .isSelectStartType(0,EdmTechProvider.nameCTTwoBasePrimCompNav); testUri.run("ESTwoKeyNav?$select=PropertyComplexNav/com.sap.odata.test1.CTTwoBasePrimCompNav") .goSelectItemPath(0) diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionTest.java index a809073d9..b4aba01b0 100644 --- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionTest.java +++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/QueryOptionTest.java @@ -29,7 +29,7 @@ import org.apache.olingo.odata4.server.api.uri.UriInfoResource; import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions; import org.apache.olingo.odata4.server.core.edm.provider.EdmProviderImpl; import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl; +import org.apache.olingo.odata4.server.core.uri.UriInfoImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.expression.AliasImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.expression.LiteralImpl; @@ -109,8 +109,8 @@ public class QueryOptionTest { option = new ExpandItemImpl(); UriInfoResource resource = new UriInfoImpl().asUriInfoResource(); - option.setResourceInfo(resource); - assertEquals(resource, option.getResourceInfo()); + option.setResourcePath(resource); + assertEquals(resource, option.getResourcePath()); } diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ExpressionTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ExpressionTest.java index 5d8e29dd5..ff0b18952 100644 --- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ExpressionTest.java +++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ExpressionTest.java @@ -38,10 +38,10 @@ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.UnaryOpera import org.apache.olingo.odata4.server.core.edm.provider.EdmProviderImpl; import org.apache.olingo.odata4.server.core.testutil.EdmTechProvider; import org.apache.olingo.odata4.server.core.testutil.EdmTechTestProvider; -import org.apache.olingo.odata4.server.core.testutil.FilterTreeToText; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceActionImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceFunctionImpl; +import org.apache.olingo.odata4.server.core.uri.UriInfoImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceActionImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceFunctionImpl; +import org.apache.olingo.odata4.server.core.uri.testutil.FilterTreeToText; import org.junit.Test; public class ExpressionTest { @@ -135,11 +135,11 @@ public class ExpressionTest { EdmAction action = edm.getAction(EdmTechProvider.nameUARTPrimParam, null, null); UriInfoResource uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart( new UriResourceActionImpl().setAction(action)).asUriInfoResource(); - expression.setPath(uriInfo); + expression.setResourcePath(uriInfo); assertEquals(action.getReturnType().getType(), expression.getType()); // check accept and path - assertEquals(uriInfo, expression.getPath()); + assertEquals(uriInfo, expression.getResourcePath()); assertEquals("", expression.accept(new FilterTreeToText())); // UriResourceImplTyped check collection = false case @@ -147,21 +147,21 @@ public class ExpressionTest { // UriResourceImplTyped check collection = true case action = edm.getAction(EdmTechProvider.nameUARTPrimCollParam, null, null); - expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart( + expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart( new UriResourceActionImpl().setAction(action)) .asUriInfoResource()); assertEquals(true, expression.isCollection()); // UriResourceImplTyped with filter action = edm.getAction(EdmTechProvider.nameUARTPrimParam, null, null); - expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart( + expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart( new UriResourceActionImpl().setAction(action).setTypeFilter(entityType)) .asUriInfoResource()); assertEquals(entityType, expression.getType()); // UriResourceImplKeyPred EdmFunction function = edm.getFunction(EdmTechProvider.nameUFCRTETKeyNav, null, null, null); - expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart( + expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart( new UriResourceFunctionImpl().setFunction(function)) .asUriInfoResource()); assertEquals(function.getReturnType().getType(), expression.getType()); @@ -170,7 +170,7 @@ public class ExpressionTest { EdmEntityType entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav); function = edm.getFunction(EdmTechProvider.nameUFCRTESTwoKeyNavParam, null, null, Arrays.asList(("ParameterInt16"))); - expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart( + expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart( new UriResourceFunctionImpl().setFunction(function).setEntryTypeFilter(entityBaseType)) .asUriInfoResource()); assertEquals(entityBaseType, expression.getType()); @@ -179,7 +179,7 @@ public class ExpressionTest { entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav); function = edm.getFunction(EdmTechProvider.nameUFCRTESTwoKeyNavParam, null, null, Arrays.asList(("ParameterInt16"))); - expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart( + expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart( new UriResourceFunctionImpl().setFunction(function).setCollectionTypeFilter(entityBaseType)) .asUriInfoResource()); assertEquals(entityBaseType, expression.getType()); @@ -188,7 +188,7 @@ public class ExpressionTest { entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav); function = edm.getFunction(EdmTechProvider.nameUFCRTESTwoKeyNavParam, null, null, Arrays.asList(("ParameterInt16"))); - expression.setPath(new UriInfoImpl().setKind(UriInfoKind.all)); + expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.all)); assertEquals(null, expression.getType()); // no typed collection else case diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ExpandValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ExpandValidator.java similarity index 90% rename from odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ExpandValidator.java rename to odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ExpandValidator.java index 563ec471c..4d6d48c8c 100644 --- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ExpandValidator.java +++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ExpandValidator.java @@ -16,24 +16,26 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.testutil; +package org.apache.olingo.odata4.server.core.uri.testutil; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; import org.apache.olingo.odata4.commons.api.ODataApplicationException; import org.apache.olingo.odata4.commons.api.edm.Edm; +import org.apache.olingo.odata4.commons.api.edm.EdmType; import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName; import org.apache.olingo.odata4.server.api.uri.UriInfoKind; import org.apache.olingo.odata4.server.api.uri.queryoption.ExpandItem; import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem; import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitException; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl; +import org.apache.olingo.odata4.server.core.uri.UriInfoImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.OrderByOptionImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.QueryOptionImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.SelectOptionImpl; +import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MemberImpl; public class ExpandValidator implements Validator { private Edm edm; @@ -72,7 +74,7 @@ public class ExpandValidator implements Validator { } public ResourceValidator goPath() { - UriInfoImpl uriInfo = (UriInfoImpl) expandItem.getResourceInfo(); + UriInfoImpl uriInfo = (UriInfoImpl) expandItem.getResourcePath(); if (uriInfo.getKind() != UriInfoKind.resource) { fail("goPath() can only be used on UriInfoKind.resource"); @@ -98,7 +100,7 @@ public class ExpandValidator implements Validator { SelectOptionImpl select = (SelectOptionImpl) expandItem.getSelectOption(); SelectItem item = select.getSelectItems().get(index); - UriInfoImpl uriInfo = (UriInfoImpl) item.getResourceInfo(); + UriInfoImpl uriInfo = (UriInfoImpl) item.getResourcePath(); return new ResourceValidator() .setUpValidator(this) @@ -217,4 +219,14 @@ public class ExpandValidator implements Validator { return this; } + public ExpandValidator isExpandStartType(final FullQualifiedName fullName) { + EdmType actualType = expandItem.getStartTypeFilter(); + + FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName()); + assertEquals(fullName, actualName); + return this; + + + } + } diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterTreeToText.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterTreeToText.java similarity index 98% rename from odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterTreeToText.java rename to odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterTreeToText.java index 325831c19..351389004 100644 --- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterTreeToText.java +++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterTreeToText.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.testutil; +package org.apache.olingo.odata4.server.core.uri.testutil; import java.util.List; diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterValidator.java similarity index 93% rename from odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterValidator.java rename to odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterValidator.java index f8a79bd95..da13d4b15 100644 --- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/FilterValidator.java +++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/FilterValidator.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.testutil; +package org.apache.olingo.odata4.server.core.uri.testutil; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; @@ -34,11 +34,11 @@ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitException; import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Member; import org.apache.olingo.odata4.server.api.uri.queryoption.expression.MethodCallKind; -import org.apache.olingo.odata4.server.core.uri.UriParserException; -import org.apache.olingo.odata4.server.core.uri.UriParserSemanticException; -import org.apache.olingo.odata4.server.core.uri.UriParserSyntaxException; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl; +import org.apache.olingo.odata4.server.core.uri.UriInfoImpl; import org.apache.olingo.odata4.server.core.uri.parser.Parser; +import org.apache.olingo.odata4.server.core.uri.parser.UriParserException; +import org.apache.olingo.odata4.server.core.uri.parser.UriParserSemanticException; +import org.apache.olingo.odata4.server.core.uri.parser.UriParserSyntaxException; import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.OrderByOptionImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.expression.BinaryImpl; @@ -272,7 +272,7 @@ public class FilterValidator implements Validator { return new ResourceValidator() .setEdm(edm) - .setUriInfoImplPath((UriInfoImpl) member.getPath()) + .setUriInfoImplPath((UriInfoImpl) member.getResourcePath()) .setUpValidator(this); } @@ -332,6 +332,9 @@ public class FilterValidator implements Validator { } else if (curExpression instanceof TypeLiteralImpl) { TypeLiteralImpl typeLiteral = (TypeLiteralImpl) curExpression; actualType = typeLiteral.getType(); + } else if (curExpression instanceof LiteralImpl) { + LiteralImpl typeLiteral = (LiteralImpl) curExpression; + actualType = typeLiteral.getType(); } if (actualType == null) { @@ -441,6 +444,19 @@ public class FilterValidator implements Validator { return this; } + + public FilterValidator isMemberStartType(final FullQualifiedName fullName) { + if (!(curExpression instanceof MemberImpl)) { + fail("Current expression not a member"); + } + + MemberImpl member = (MemberImpl) curExpression; + EdmType actualType = member.getStartTypeFilter(); + + FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName()); + assertEquals(fullName, actualName); + return this; + } public FilterValidator isEnum(final FullQualifiedName nameenstring, final List enumValues) { if (!(curExpression instanceof EnumerationImpl)) { diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParseTreeToText.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParseTreeToText.java similarity index 97% rename from odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParseTreeToText.java rename to odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParseTreeToText.java index b6334b010..d81bbcf70 100644 --- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParseTreeToText.java +++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParseTreeToText.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.testutil; +package org.apache.olingo.odata4.server.core.uri.testutil; import java.util.Arrays; import java.util.List; diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserValidator.java similarity index 99% rename from odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserValidator.java rename to odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserValidator.java index b75c4ae18..dc4936e41 100644 --- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserValidator.java +++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserValidator.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.testutil; +package org.apache.olingo.odata4.server.core.uri.testutil; import static org.junit.Assert.assertEquals; diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserWithLogging.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserWithLogging.java similarity index 97% rename from odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserWithLogging.java rename to odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserWithLogging.java index 19fe38362..b006e8669 100644 --- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ParserWithLogging.java +++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ParserWithLogging.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.testutil; +package org.apache.olingo.odata4.server.core.uri.testutil; import org.antlr.v4.runtime.DefaultErrorStrategy; import org.antlr.v4.runtime.DiagnosticErrorListener; diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ResourceValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ResourceValidator.java similarity index 92% rename from odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ResourceValidator.java rename to odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ResourceValidator.java index c27b059ec..0e1b46a23 100644 --- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/ResourceValidator.java +++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/ResourceValidator.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.testutil; +package org.apache.olingo.odata4.server.core.uri.testutil; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -37,23 +37,24 @@ import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped; import org.apache.olingo.odata4.server.api.uri.queryoption.CustomQueryOption; import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem; import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitException; -import org.apache.olingo.odata4.server.core.uri.UriParserException; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceActionImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceComplexPropertyImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceEntitySetImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceFunctionImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceLambdaAllImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceLambdaAnyImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceNavigationPropertyImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourcePrimitivePropertyImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceSingletonImpl; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceWithKeysImpl; +import org.apache.olingo.odata4.server.core.uri.UriInfoImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceActionImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceComplexPropertyImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceEntitySetImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceFunctionImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceLambdaAllImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceLambdaAnyImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceNavigationPropertyImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourcePrimitivePropertyImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceSingletonImpl; +import org.apache.olingo.odata4.server.core.uri.UriResourceWithKeysImpl; +import org.apache.olingo.odata4.server.core.uri.parser.UriParserException; import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.SelectOptionImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.expression.ExpressionImpl; +import org.apache.olingo.odata4.server.core.uri.queryoption.expression.MemberImpl; public class ResourceValidator implements Validator { private Edm edm; @@ -124,7 +125,7 @@ public class ResourceValidator implements Validator { return new FilterValidator() .setEdm(edm) - .setExpression(function.getParameters().get(index).getExression()) + .setExpression(function.getParameters().get(index).getExpression()) .setValidator(this); } @@ -148,7 +149,7 @@ public class ResourceValidator implements Validator { SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption(); SelectItem item = select.getSelectItems().get(index); - UriInfoImpl uriInfo1 = (UriInfoImpl) item.getResourceInfo(); + UriInfoImpl uriInfo1 = (UriInfoImpl) item.getResourcePath(); return new ResourceValidator() .setUpValidator(this) @@ -568,4 +569,15 @@ public class ResourceValidator implements Validator { return this; } + public ResourceValidator isSelectStartType(final int index, FullQualifiedName fullName) { + SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption(); + SelectItem item = select.getSelectItems().get(index); + + EdmType actualType = item.getStartTypeFilter(); + + FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName()); + assertEquals(fullName, actualName); + return this; + } + } diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TestErrorLogger.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TestErrorLogger.java similarity index 98% rename from odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TestErrorLogger.java rename to odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TestErrorLogger.java index 04a26403e..8f9f202c8 100644 --- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TestErrorLogger.java +++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TestErrorLogger.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.testutil; +package org.apache.olingo.odata4.server.core.uri.testutil; import java.util.BitSet; import java.util.Collections; diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TokenValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TokenValidator.java similarity index 98% rename from odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TokenValidator.java rename to odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TokenValidator.java index 3269b9417..f9047af50 100644 --- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/TokenValidator.java +++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/TokenValidator.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.testutil; +package org.apache.olingo.odata4.server.core.uri.testutil; import static org.junit.Assert.assertEquals; diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriLexerWithTrace.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/UriLexerWithTrace.java similarity index 97% rename from odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriLexerWithTrace.java rename to odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/UriLexerWithTrace.java index 9802c686d..b9f8b36c7 100644 --- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriLexerWithTrace.java +++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/UriLexerWithTrace.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.testutil; +package org.apache.olingo.odata4.server.core.uri.testutil; import org.antlr.v4.runtime.ANTLRInputStream; import org.antlr.v4.runtime.Token; diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriValidator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/UriValidator.java similarity index 88% rename from odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriValidator.java rename to odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/UriValidator.java index b03ea65e8..fd1954b00 100644 --- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/UriValidator.java +++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/UriValidator.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.testutil; +package org.apache.olingo.odata4.server.core.uri.testutil; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; @@ -25,15 +25,16 @@ import java.util.List; import org.apache.olingo.odata4.commons.api.edm.Edm; import org.apache.olingo.odata4.commons.api.edm.EdmEntityType; +import org.apache.olingo.odata4.commons.api.edm.EdmType; import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName; import org.apache.olingo.odata4.server.api.uri.UriInfoKind; import org.apache.olingo.odata4.server.api.uri.queryoption.CustomQueryOption; import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem; -import org.apache.olingo.odata4.server.core.uri.UriParserException; -import org.apache.olingo.odata4.server.core.uri.UriParserSemanticException; -import org.apache.olingo.odata4.server.core.uri.UriParserSyntaxException; -import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl; +import org.apache.olingo.odata4.server.core.uri.UriInfoImpl; import org.apache.olingo.odata4.server.core.uri.parser.Parser; +import org.apache.olingo.odata4.server.core.uri.parser.UriParserException; +import org.apache.olingo.odata4.server.core.uri.parser.UriParserSemanticException; +import org.apache.olingo.odata4.server.core.uri.parser.UriParserSyntaxException; import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl; import org.apache.olingo.odata4.server.core.uri.queryoption.FilterOptionImpl; @@ -129,7 +130,7 @@ public class UriValidator implements Validator { SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption(); SelectItem item = select.getSelectItems().get(index); - UriInfoImpl uriInfo1 = (UriInfoImpl) item.getResourceInfo(); + UriInfoImpl uriInfo1 = (UriInfoImpl) item.getResourcePath(); return new ResourceValidator() .setUpValidator(this) @@ -137,6 +138,18 @@ public class UriValidator implements Validator { .setUriInfoImplPath(uriInfo1); } + + public UriValidator isSelectStartType(int index, final FullQualifiedName fullName) { + SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption(); + SelectItem item = select.getSelectItems().get(index); + EdmType actualType = item.getStartTypeFilter(); + + FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName()); + assertEquals(fullName, actualName); + return this; + + +} // Validation public UriValidator isKind(final UriInfoKind kind) { diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/Validator.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/Validator.java similarity index 93% rename from odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/Validator.java rename to odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/Validator.java index a3b97f5d9..c4325ba24 100644 --- a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/testutil/Validator.java +++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/uri/testutil/Validator.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.olingo.odata4.server.core.testutil; +package org.apache.olingo.odata4.server.core.uri.testutil; public interface Validator {