You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ko...@apache.org on 2014/01/23 12:30:39 UTC
[08/12] [OLINGO-63] Uri Parser: Add support for II
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserImpl.java
deleted file mode 100644
index 6af3f0f..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserImpl.java
+++ /dev/null
@@ -1,580 +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.producer.core.uri;
-
-import java.util.List;
-
-import org.antlr.v4.runtime.tree.ParseTree;
-import org.apache.olingo.odata4.commons.api.edm.Edm;
-import org.apache.olingo.odata4.commons.api.edm.EdmAction;
-import org.apache.olingo.odata4.commons.api.edm.EdmActionImport;
-import org.apache.olingo.odata4.commons.api.edm.EdmComplexType;
-import org.apache.olingo.odata4.commons.api.edm.EdmElement;
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.odata4.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
-import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
-import org.apache.olingo.odata4.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
-import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltAddContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltAliasContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltAndContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltBatchContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltComparismContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltEntityCastContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltEntityContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltEqualityContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltLiteralContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltMemberContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltMetadataContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltMethodContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltMultContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltOrContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltPharenthesisContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltResourcePathContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltRootContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.AltUnaryContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.CustomQueryOptionContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ExpandContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.FilterContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.FormatContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.IdContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.InlinecountContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.MemberExprContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.NameValueListContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.NameValueOptListContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.NameValuePairContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.OdataRelativeUriContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.OdataRelativeUriEOFContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.OrderbyContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.PathSegmentContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.PathSegmentsContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.QueryOptionContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.QueryOptionsContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.ResourcePathContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SearchContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SelectContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SkipContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SkiptokenContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.SystemQueryOptionContext;
-import org.apache.olingo.odata4.producer.core.uri.antlr.UriParserParser.TopContext;
-import org.apache.olingo.odata4.producer.core.uri.expression.Alias;
-import org.apache.olingo.odata4.producer.core.uri.expression.Binary;
-import org.apache.olingo.odata4.producer.core.uri.expression.Expression;
-import org.apache.olingo.odata4.producer.core.uri.expression.Literal;
-import org.apache.olingo.odata4.producer.core.uri.expression.Member;
-import org.apache.olingo.odata4.producer.core.uri.expression.MethodCall;
-import org.apache.olingo.odata4.producer.core.uri.expression.SupportedBinaryOperators;
-import org.apache.olingo.odata4.producer.core.uri.expression.SupportedMethodCalls;
-import org.apache.olingo.odata4.producer.core.uri.expression.SupportedUnaryOperators;
-import org.apache.olingo.odata4.producer.core.uri.expression.UnaryOperator;
-
-public class UriParserImpl {
- private Edm edm = null;
- private EdmEntityContainer edmEntityContainer = null;
- private UriPathInfoImpl lastUriPathInfo;
-
- public UriParserImpl(Edm edm) {
- this.edm = edm;
- this.edmEntityContainer = edm.getEntityContainer(null);
- }
-
- public UriInfoImpl ParseUri(String uri) throws UriParserException {
- OdataRelativeUriEOFContext root = ParserAdapter.parseInput(uri);
- return readODataRelativeUriEOF(root);
- }
-
- private UriInfoImpl readODataRelativeUriEOF(OdataRelativeUriEOFContext node) {
- OdataRelativeUriContext first = (OdataRelativeUriContext) node.getChild(0);
-
- UriInfoImpl uriInfo = readODataRelativeUri(first);
- return uriInfo;
- }
-
- private UriInfoImpl readODataRelativeUri(OdataRelativeUriContext node) {
- if (node instanceof AltBatchContext) {
- return new UriInfoImplBatch();
- } else if (node instanceof AltEntityContext) {
- // TODO read the entity options
- return new UriInfoImplEntity();
- } else if (node instanceof AltEntityCastContext) {
- // TODO read the entity options and the cast ns.odi
- return new UriInfoImplEntity();
- } else if (node instanceof AltMetadataContext) {
- // TODO read the metadata queryparameter and fragment
- return new UriInfoImplMetadata();
- } else if (node instanceof AltResourcePathContext) {
- return readAltResourcePath((AltResourcePathContext) node);
- }
- return null;
- }
-
- private UriInfoImpl readAltResourcePath(AltResourcePathContext node) {
- ResourcePathContext rpc = (ResourcePathContext) node.getChild(0);
- QueryOptionsContext qoc = (QueryOptionsContext) node.getChild(2); // is null if there are no options
-
- if (rpc.vPSs != null) {
- UriInfoImplPath uriInfo = readPathSegments(rpc.vPSs, null);
-
- if (qoc != null) {
- readQueryParameter(uriInfo, qoc);
- }
- return uriInfo;
- } else if (rpc.vCJ != null) {
- return new UriInfoImplCrossjoin();
- } else if (rpc.vAll != null) {
- return new UriInfoImplAll();
- }
-
- return null;
- }
-
- private void readQueryParameter(UriInfoImplPath uriInfoImplPath, QueryOptionsContext qoc) {
- for (QueryOptionContext queryOption : qoc.qo) {
- readQueryOption(uriInfoImplPath, queryOption);
- }
- }
-
- private void readQueryOption(UriInfoImplPath uriInfoImplPath, QueryOptionContext queryOption) {
- ParseTree firstChild = queryOption.getChild(0);
-
- if (firstChild instanceof SystemQueryOptionContext) {
- readSystemQueryOption(uriInfoImplPath, firstChild);
- } else if (firstChild instanceof CustomQueryOptionContext) {
- // TODO read custom request option
- } else if (firstChild.getText().equals("@")) {
- // TODO read alias and value
- }
-
- }
-
- private void readSystemQueryOption(UriInfoImplPath uriInfoImplPath, ParseTree systemQueryOption) {
- ParseTree firstChild = systemQueryOption.getChild(0);
- if (firstChild instanceof ExpandContext) {
- // TODO implement
- } else if (firstChild instanceof FilterContext) {
- Expression expression = readFilterOption(firstChild);
- uriInfoImplPath.setSystemParameter(SystemQueryParameter.FILTER, expression);
- return;
- } else if (firstChild instanceof FormatContext) {
- // TODO implement
- } else if (firstChild instanceof IdContext) {
- // TODO implement
- } else if (firstChild instanceof InlinecountContext) {
- // TODO implement
- } else if (firstChild instanceof OrderbyContext) {
- // TODO implement
- } else if (firstChild instanceof SearchContext) {
- // TODO implement
- } else if (firstChild instanceof SelectContext) {
- // TODO implement
- } else if (firstChild instanceof SkipContext) {
- // TODO implement
- } else if (firstChild instanceof SkiptokenContext) {
- // TODO implement
- } else if (firstChild instanceof TopContext) {
- // TODO implement
- }
- }
-
- private Expression readFilterOption(ParseTree filter) {
- return readCommonExpression(filter.getChild(2));
- }
-
- private Expression readCommonExpression(ParseTree expressionContext) {
- // Expression ret = null;
-
- if (expressionContext instanceof AltPharenthesisContext) {
- return readCommonExpression(expressionContext.getChild(1));
- } else if (expressionContext instanceof AltMethodContext) {
- return readMethod(expressionContext);
- } else if (expressionContext instanceof AltUnaryContext) {
- UnaryOperator unary = new UnaryOperator();
- unary.setOperator(SupportedUnaryOperators.get(expressionContext.getChild(0).getText()));
- unary.setOperand(readCommonExpression(expressionContext.getChild(1)));
- return unary;
- } else if (expressionContext instanceof AltMemberContext) {
- return readMember(expressionContext);
- } else if (expressionContext instanceof AltMultContext) {
- return readBinary(expressionContext);
- } else if (expressionContext instanceof AltAddContext) {
- return readBinary(expressionContext);
- } else if (expressionContext instanceof AltComparismContext) {
- return readBinary(expressionContext);
- } else if (expressionContext instanceof AltEqualityContext) {
- return readBinary(expressionContext);
- } else if (expressionContext instanceof AltAndContext) {
- return readBinary(expressionContext);
- } else if (expressionContext instanceof AltOrContext) {
- return readBinary(expressionContext);
- } else if (expressionContext instanceof AltRootContext) {
- // TODO
- } else if (expressionContext instanceof AltAliasContext) {
- Alias alias = new Alias();
- alias.setReference(expressionContext.getChild(1).getText());
- // TODO collect all aliases and verify them afterwards
- return alias;
- } else if (expressionContext instanceof AltLiteralContext) {
- Literal literal = new Literal();
- literal.setText(expressionContext.getText());
- return literal;
- }
- return null;
- }
-
- private Expression readMember(ParseTree expressionContext) {
- MemberExprContext context = (MemberExprContext) expressionContext.getChild(0);
-
- Member member = new Member();
-
- UriPathInfoIT pathInfoIT = new UriPathInfoIT();
-
-
- if (context.ps!= null) {
- if (context.getChild(0).getText().startsWith("$it/")) {
- member.setIT(true); // TODO check if this is required
- pathInfoIT.setIsExplicitIT(true);
- }
- UriParserImpl parser = new UriParserImpl(this.edm);
-
- UriInfoImplPath path = parser.readPathSegments(context.ps,
- new UriPathInfoIT().setType(lastUriPathInfo.getType()));
- member.setPath(path);
- } else {
- member.setIT(true);
- }
- return member;
-
- }
-
- private Expression readMethod(ParseTree expressionContext) {
- MethodCall expression = new MethodCall();
- expression.setMethod(SupportedMethodCalls.get(expressionContext.getChild(0).getText()));
- int i = 1;
- while (i < expressionContext.getChildCount()) {
- expression.addParameter(readCommonExpression(expressionContext.getChild(i)));
- i++;
- }
- return expression;
- }
-
- private Expression readBinary(ParseTree expressionContext) {
- Binary expression = new Binary();
- expression.setLeftOperand(readCommonExpression(expressionContext.getChild(0)));
- expression.setOperator(SupportedBinaryOperators.get(expressionContext.getChild(2).getText()));
- expression.setRightOperand(readCommonExpression(expressionContext.getChild(4)));
- return expression;
- }
-
- private UriInfoImplPath readPathSegments(PathSegmentsContext pathSegments, UriPathInfoImpl usePrevPathInfo) {
-
- UriPathInfoImpl prevPathInfo = usePrevPathInfo;
- UriInfoImplPath infoImpl = new UriInfoImplPath();
-
- int iSegment = 0;
-
- if (prevPathInfo == null) {
- PathSegmentContext firstChild = (PathSegmentContext) pathSegments.vlPS.get(iSegment);
- UriPathInfoImpl firstPathInfo = readFirstPathSegment(infoImpl, firstChild);
- iSegment++;
- prevPathInfo = firstPathInfo;
- } else {
- infoImpl.addPathInfo(prevPathInfo);
- }
-
- while (iSegment < pathSegments.vlPS.size()) {
- PathSegmentContext nextChild = (PathSegmentContext) pathSegments.vlPS.get(iSegment);
- prevPathInfo = readNextPathSegment(infoImpl, nextChild, prevPathInfo);
- iSegment++;
- }
- lastUriPathInfo = prevPathInfo;
- return infoImpl;
- }
-
- private UriPathInfoImpl readNextPathSegment(UriInfoImplPath infoImpl, PathSegmentContext pathSegment,
- UriPathInfoImpl prevPathInfo) {
-
- UriPathInfoImpl pathInfo = null;
-
- String odi = pathSegment.vODI.getText(); // not optional
-
- // check for properties
- if (pathSegment.vNS == null) {
-
- EdmType prevType = prevPathInfo.getType();
- if (prevType instanceof EdmStructuralType) {
- EdmStructuralType prevStructType = (EdmStructuralType) prevType;
-
- EdmElement element = prevStructType.getProperty(odi);
- if (element == null) {
- // TODO exception property not found
- }
-
- if (element instanceof EdmProperty) {
- prevPathInfo.addProperty((EdmProperty) element);
- return prevPathInfo;
- } else if (element instanceof EdmNavigationProperty) {
-
- prevPathInfo.addNavigationProperty((EdmNavigationProperty) element);
-
- UriPathInfoNavEntitySet pathInfoNav = new UriPathInfoNavEntitySet();
- pathInfoNav.addSourceNavigationProperty((EdmNavigationProperty) element);
- infoImpl.addPathInfo(pathInfoNav);
- return pathInfoNav;
-
- } else {
-
- }
-
- }
-
- } else {
- // check for namespace
- String namespace = pathSegment.vNS.getText();
- namespace = namespace.substring(0, namespace.length() - 1);
-
- FullQualifiedName fullName = new FullQualifiedName(namespace, odi);
-
- // check for typecasts
- if (prevPathInfo.getType() instanceof EdmEntityType) {
- EdmEntityType et = edm.getEntityType(fullName);
- if (et != null) {
- prevPathInfo.addTypeFilter(et);
-
- if (pathSegment.vlVPO.size() != 0) {
- UriKeyPredicateList keyPred = readKeyPredicateList(
- pathSegment.vlVPO.get(0), (EdmEntityType) prevPathInfo.getType());
- prevPathInfo.setKeyPredicates(keyPred);
- }
-
- return prevPathInfo;
- }
- } else if (prevPathInfo.getType() instanceof EdmComplexType) {
- EdmComplexType ct = edm.getComplexType(fullName);
- if (ct != null) {
- prevPathInfo.addTypeFilter(ct);
- return prevPathInfo;
- }
- }
-
- // check for bound action
- if (pathSegment.vlVPO == null) {
- EdmAction action = edm.getAction(fullName, prevPathInfo.getFullType(), false);
- pathInfo = new UriPathInfoActionImpl().setAction(action);
- infoImpl.addPathInfo(pathInfo);
- return pathInfo;
- } else {
- // check for bound functions
- UriParameterlist parameterList = readParameterList(pathSegment.vlVPO.get(0));
-
- EdmFunction function = edm.getFunction(fullName, prevPathInfo.getFullType(), false, parameterList.getNames());
- if (function != null) {
-
- UriPathInfoFunctionImpl pathInfoFunction = new UriPathInfoFunctionImpl();
- pathInfoFunction.setFunction(function);
- pathInfoFunction.setParameters(parameterList);
-
- if (pathSegment.vlVPO.size() > 1) {
- UriKeyPredicateList keyPred = readKeyPredicateList(
- pathSegment.vlVPO.get(1), (EdmEntityType) prevPathInfo.getType());
- pathInfoFunction.setKeyPredicates(keyPred);
- }
-
- infoImpl.addPathInfo(pathInfo);
-
- return pathInfo;
- }
- }
-
- // Exception unknown typeFilter/action or function
- }
-
- return null;
- }
-
- private UriPathInfoImpl readFirstPathSegment(UriInfoImplPath infoImpl, PathSegmentContext pathSegment) {
- UriPathInfoImpl pathInfo = null;
-
- // assert pathSegment.vNS = null;
- String odi = pathSegment.vODI.getText(); // not optional
-
- // EntitySet
- EdmEntitySet edmES = edmEntityContainer.getEntitySet(odi);
- if (edmES != null) {
- pathInfo = readEntitySet(pathSegment, edmES);
- }
-
- // Singleton
- EdmSingleton edmSI = edmEntityContainer.getSingleton(odi);
- if (edmSI != null) {
- pathInfo = readSingleton(pathSegment, edmSI);
- }
-
- // FunctionImport
- EdmFunctionImport edmFI = edmEntityContainer.getFunctionImport(odi);
- if (edmFI != null) {
- pathInfo = readFunctionImport(pathSegment, edmFI);
- }
-
- // ActionImport
- EdmActionImport edmAI = edmEntityContainer.getActionImport(odi);
- if (edmAI != null) {
- pathInfo = readActionImport(pathSegment, edmAI);
- }
-
- infoImpl.addPathInfo(pathInfo);
-
- return pathInfo;
- }
-
- private UriPathInfoImpl readActionImport(PathSegmentContext pathSegment, EdmActionImport edmFI) {
- UriPathInfoActionImpl uriPathInfo = new UriPathInfoActionImpl();
-
- EdmAction action = edmFI.getAction();
- uriPathInfo.setAction(action);
-
- int num = pathSegment.vlVPO.size();
- if (num == 2) {
- // TODO exception action parameters not allowed
- } else if (num == 1) {
-
- if (uriPathInfo.isCollection() == true) {
- if (uriPathInfo.getType() instanceof EdmEntityType) {
- uriPathInfo.setKeyPredicates(
- readKeyPredicateList(pathSegment.vlVPO.get(0), (EdmEntityType) uriPathInfo.getType()));
- } else {
- // TODO exception action keypreticates not allowed
- }
- } else {
- // TODO exception action parameters not allowed
- }
- }
-
- return uriPathInfo;
- }
-
- private UriPathInfoImpl readFunctionImport(PathSegmentContext pathSegment, EdmFunctionImport edmFI) {
- UriPathInfoFunctionImpl uriPathInfo = new UriPathInfoFunctionImpl();
-
- if (pathSegment.vlVPO == null) {
- // TODO exception function parameters missing
- }
-
- UriParameterlist parameterList = readParameterList(pathSegment.vlVPO.get(0));
- EdmFunction function = edmFI.getFunction(parameterList.getNames());
- uriPathInfo.setFunction(function);
- uriPathInfo.setParameters(parameterList);
-
- if (pathSegment.vlVPO.size() > 1) {
-
- if (!(uriPathInfo.getType() instanceof EdmEntityType)) {
- // TODO exception illegally used keypredicates on function impored returning not an entityset
- }
- uriPathInfo.setKeyPredicates(
- readKeyPredicateList(pathSegment.vlVPO.get(1), (EdmEntityType) uriPathInfo.getType()));
- }
-
- return null;
- }
-
- private UriPathInfoImpl readSingleton(PathSegmentContext pathSegment, EdmSingleton edmSI) {
- UriPathInfoSingletonImpl uriPathInfo = new UriPathInfoSingletonImpl();
-
- uriPathInfo.setSingleton(edmSI);
- return uriPathInfo;
- }
-
- private UriPathInfoImpl readEntitySet(PathSegmentContext pathSegment, EdmEntitySet edmES) {
-
- UriPathInfoEntitySetImpl uriPathInfo = new UriPathInfoEntitySetImpl();
- uriPathInfo.setEntitSet(edmES);
-
- // KeyPredicates
- if (pathSegment.vlVPO != null) {
- if (pathSegment.vlVPO.size() == 1) {
- uriPathInfo.setKeyPredicates(readKeyPredicateList(pathSegment.vlVPO.get(0), edmES.getEntityType()));
-
- } else if (pathSegment.vlVPO.size() > 1) {
- // TODO exception ( to much key predicates)
- }
-
- }
- return uriPathInfo;
- }
-
- private UriKeyPredicateList readKeyPredicateList(NameValueOptListContext parameterList, EdmEntityType entityType) {
- if (parameterList.vVO != null) {
- String value = parameterList.vVO.vV.getText();
- List<String> kp = entityType.getKeyPredicateNames();
-
- if (kp.size() != 1) {
- // TODO exception "for using a value only keyPredicate there must be exact ONE defined keyProperty
- }
-
- String keyName = kp.get(0); // there yhoul
-
- return new UriKeyPredicateList().add(keyName, value);
- }
-
- NameValueListContext vNVL = parameterList.vNVL;
- if (vNVL == null) {
- // TODO throw exception empty keypredicates not allowed
- }
- UriKeyPredicateList uriPrameterList1 = new UriKeyPredicateList();
-
- for (NameValuePairContext nvl : vNVL.vNVP) {
- String name = nvl.vODI.getText();
- String value = nvl.vVAL.getText();
- uriPrameterList1.add(name, value);
- }
- return uriPrameterList1;
-
- }
-
- private UriParameterlist readParameterList(NameValueOptListContext parameterList) {
- if (parameterList.vVO != null) {
- // TODO throw error "Value Only" not allowed for function/action parameters, only in keypredicates
- return null;
- }
-
- NameValueListContext vNVL = parameterList.vNVL;
- UriParameterlist uriPrameterList1 = new UriParameterlist();
-
- for (NameValuePairContext nvl : vNVL.vNVP) {
- String name = nvl.vODI.getText();
- if (nvl.vVAL != null) {
- String value = nvl.vVAL.getText();
- uriPrameterList1.add(name, value, null);
- } else {
- String alias = nvl.vALI.getText();
- uriPrameterList1.add(name, null, alias);
- }
-
- }
- return uriPrameterList1;
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSemanticException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSemanticException.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSemanticException.java
new file mode 100644
index 0000000..530b24f
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSemanticException.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * 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.producer.core.uri;
+
+//TODO Check name of this exception when implementing proper error handling
+public class UriParserSemanticException extends UriParserException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1813203179082217112L;
+
+ public UriParserSemanticException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public UriParserSemanticException(String message) {
+ super(message, null);
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSyntaxException.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSyntaxException.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSyntaxException.java
new file mode 100644
index 0000000..d3f9dcf
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParserSyntaxException.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.producer.core.uri;
+
+public class UriParserSyntaxException extends UriParserException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -975557346686301719L;
+
+ public UriParserSyntaxException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public UriParserSyntaxException(String message) {
+ super(message, null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoActionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoActionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoActionImpl.java
deleted file mode 100644
index 90ca1d6..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoActionImpl.java
+++ /dev/null
@@ -1,49 +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.producer.core.uri;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmAction;
-import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
-
-/**
- * Covers Functionimports and BoundFunction in URI
- */
-public class UriPathInfoActionImpl extends UriPathInfoImpl {
-
- private EdmAction action;
-
- public UriPathInfoActionImpl() {
- this.setKind(UriPathInfoKind.action);
- }
-
- public UriPathInfoActionImpl setAction(EdmAction action) {
-
- this.action = action;
- this.setType(action.getReturnType().getType());
- this.setCollection(action.getReturnType().isCollection());
-
- return this;
- }
-
- @Override
- public String toString() {
- return action.getName() + super.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoEntitySetImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoEntitySetImpl.java
deleted file mode 100644
index f8e1ca8..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoEntitySetImpl.java
+++ /dev/null
@@ -1,48 +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.producer.core.uri;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
-
-public class UriPathInfoEntitySetImpl extends UriPathInfoImpl {
- EdmEntitySet edmEntitySet = null;
-
- public UriPathInfoEntitySetImpl() {
- this.setKind(UriPathInfoKind.entitySet);
- }
-
- public UriPathInfoEntitySetImpl setEntitSet(EdmEntitySet edmES) {
-
- this.edmEntitySet = edmES;
- this.setType(edmES.getEntityType());
- this.setCollection(true);
-
- return this;
- }
-
-
- @Override
- public String toString() {
- return edmEntitySet.getName() + super.toString();
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoFunctionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoFunctionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoFunctionImpl.java
deleted file mode 100644
index f65f681..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoFunctionImpl.java
+++ /dev/null
@@ -1,64 +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.producer.core.uri;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
-import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
-
-/**
- * Covers Functionimports and BoundFunction in URI
- */
-public class UriPathInfoFunctionImpl extends UriPathInfoImpl {
-
- private UriParameterlist parameters;
- private EdmFunction function;
- private UriKeyPredicateList keyPredicates;
-
- public UriPathInfoFunctionImpl() {
- this.setKind(UriPathInfoKind.function);
- }
-
- public UriPathInfoFunctionImpl setParameters(UriParameterlist parameters) {
- this.parameters = parameters;
- return this;
- }
-
- public UriParameterlist getParameters() {
- return parameters;
- }
-
- public UriPathInfoFunctionImpl setFunction(EdmFunction function) {
- this.function = function;
- super.setType(function.getReturnType().getType());
- super.setCollection(function.getReturnType().isCollection());
- return this;
- }
-
- public UriPathInfoFunctionImpl setKeyPredicates(UriKeyPredicateList keyPredicates) {
- this.keyPredicates = keyPredicates;
- return this;
- }
-
- @Override
- public String toString() {
- return function.getName() + super.toString();
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoIT.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoIT.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoIT.java
deleted file mode 100644
index 12da4e3..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoIT.java
+++ /dev/null
@@ -1,53 +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.producer.core.uri;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmAction;
-import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
-
-/**
- * Covers Functionimports and BoundFunction in URI
- */
-public class UriPathInfoIT extends UriPathInfoImpl {
-
- private boolean explicitIT;
-
-
- public UriPathInfoIT() {
- this.setKind(UriPathInfoKind.it);
- this.setCollection(false);
- }
- @Override
- public String toString() {
-
- if (explicitIT) {
- return "$it" + super.toString();
- }
- return super.toString();
- }
-
-
- public UriPathInfoIT setIsExplicitIT(boolean explicitIT) {
- this.explicitIT =explicitIT;
- return this;
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImpl.java
deleted file mode 100644
index 8220a9f..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoImpl.java
+++ /dev/null
@@ -1,202 +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.producer.core.uri;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmElement;
-import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
-import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
-import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
-import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
-import org.apache.olingo.odata4.producer.core.uri.expression.Expression;
-
-public abstract class UriPathInfoImpl {
-
- private EdmType initialType = null;
- private EdmType finalType = null;
-
- private UriPathInfoKind kind;
- private EdmType collectionTypeFilter = null;
- private UriKeyPredicateList keyPredicates = null;
- private EdmType singleTypeFilter = null;
-
- private class PathListItem {
- private EdmElement property; // ia EdmProperty or EdmNavigationProperty
-
- private EdmType initialType;
- private EdmType finalType;
- private boolean isCollection;
- }
-
- private List<PathListItem> pathList = null;
- private boolean isCollection;
-
- public UriPathInfoImpl setType(EdmType edmType) {
- this.initialType = edmType;
- this.finalType = edmType;
- return this;
- }
-
- public EdmType getType() {
- return finalType;
- }
-
- public EdmType getInitialType() {
- return initialType;
- }
-
- public EdmType getCollectionTypeFilter() {
- return collectionTypeFilter;
- }
-
- public EdmType getSingleTypeFilter() {
- return singleTypeFilter;
- }
-
- public FullQualifiedName getFullType() {
- return new FullQualifiedName(finalType.getNamespace(), finalType.getName());
- }
-
- public UriPathInfoImpl setKind(UriPathInfoKind kind) {
- this.kind = kind;
- return this;
- }
-
- public UriPathInfoKind getKind() {
- return kind;
- }
-
- public UriPathInfoImpl setKeyPredicates(UriKeyPredicateList keyPredicates) {
- if (this.isCollection() != true) {
- // throw exception
- }
- this.keyPredicates = keyPredicates;
- this.setCollection(false);
- return this;
- }
-
- public UriKeyPredicateList getKeyPredicates() {
- return this.keyPredicates;
- }
-
- public UriPathInfoImpl addTypeFilter(EdmStructuralType targetType) {
- // TODO if there is a navigation path the type filter musst be applied to the last
- if (pathList == null) {
- if (keyPredicates == null) {
- if (collectionTypeFilter != null) {
- // TODO exception Type filters are not directy chainable
- }
- if (targetType.compatibleTo((EdmStructuralType) finalType)) {
- collectionTypeFilter = targetType;
- finalType = targetType;
- } else {
- // TODO throw exception
- }
- } else {
- if (singleTypeFilter != null) {
- // TODO exception Type filters are not directy chainable
- }
- if (targetType.compatibleTo((EdmStructuralType) finalType)) {
- singleTypeFilter = targetType;
- finalType = targetType;
- } else {
- // TODO throw exception
- }
- }
- } else {
- PathListItem last = pathList.get(pathList.size() - 1);
-
- if (targetType.compatibleTo(last.finalType)) {
- last.finalType = targetType;
- }
- }
- return this;
- }
-
- public UriPathInfoImpl addProperty(EdmProperty property) {
- if (pathList == null) {
- pathList = new ArrayList<PathListItem>();
- }
-
- PathListItem newItem = new PathListItem();
- newItem.property = property;
- newItem.initialType = property.getType();
- newItem.finalType = property.getType();
- newItem.isCollection = property.isCollection();
- pathList.add(newItem);
-
- this.finalType = newItem.finalType;
- this.isCollection = newItem.isCollection;
- return this;
- }
-
- public UriPathInfoImpl addNavigationProperty(EdmNavigationProperty property) {
- if (pathList == null) {
- pathList = new ArrayList<PathListItem>();
- }
- PathListItem newItem = new PathListItem();
- newItem.property = property;
- newItem.initialType = property.getType();
- newItem.finalType = property.getType();
- newItem.isCollection = property.isCollection();
- pathList.add(newItem);
-
- this.finalType = newItem.finalType;
- this.isCollection = newItem.isCollection;
- return this;
- }
-
- public int getPropertyCount() {
- return pathList.size();
- }
-
- public EdmElement getProperty(int index) {
- return pathList.get(index).property;
-
- }
-
- public UriPathInfoImpl setCollection(boolean isCollection) {
- this.isCollection = isCollection;
- return this;
- }
-
- public boolean isCollection() {
-
- return isCollection;
- }
-
- @Override
- public String toString() {
- String ret = "";
- int i = 0;
- while (i < pathList.size()) {
- if (i > 0) {
- ret += "/";
- }
- ret += pathList.get(i).property.getName();
- i++;
- }
- return ret;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoNavEntitySet.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoNavEntitySet.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoNavEntitySet.java
deleted file mode 100644
index d81e2bc..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoNavEntitySet.java
+++ /dev/null
@@ -1,43 +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.producer.core.uri;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
-
-public class UriPathInfoNavEntitySet extends UriPathInfoImpl {
-
- private EdmNavigationProperty sourceNavigationProperty;
-
- public UriPathInfoNavEntitySet() {
- this.setKind(UriPathInfoKind.navEntitySet);
- }
-
- public UriPathInfoNavEntitySet addSourceNavigationProperty(EdmNavigationProperty sourceNavigationProperty) {
- this.sourceNavigationProperty = sourceNavigationProperty;
- this.setType(sourceNavigationProperty.getType());
- return this;
- }
-
- @Override
- public String toString() {
- return sourceNavigationProperty.getName()+super.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoSingletonImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoSingletonImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoSingletonImpl.java
deleted file mode 100644
index 649860f..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriPathInfoSingletonImpl.java
+++ /dev/null
@@ -1,44 +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.producer.core.uri;
-
-import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
-import org.apache.olingo.odata4.producer.api.uri.UriPathInfoKind;
-
-public class UriPathInfoSingletonImpl extends UriPathInfoImpl {
-
- private EdmSingleton singleton;
-
- public UriPathInfoSingletonImpl() {
- this.setKind(UriPathInfoKind.singleton);
- }
-
- public UriPathInfoSingletonImpl setSingleton(EdmSingleton singleton) {
-
- this.singleton = singleton;
- this.setType(singleton.getEntityType());
- return this;
- }
-
- @Override
- public String toString() {
- return singleton.getName() + super.toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceActionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceActionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceActionImpl.java
new file mode 100644
index 0000000..d714969
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceActionImpl.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * 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.producer.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmAction;
+import org.apache.olingo.odata4.commons.api.edm.EdmActionImport;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceAction;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
+
+public class UriResourceActionImpl extends UriResourceImplTyped implements UriResourceAction {
+
+ protected EdmAction action;
+ protected EdmActionImport actionImport;
+
+ public UriResourceActionImpl() {
+ super(UriResourceKind.action);
+ }
+
+ @Override
+ public EdmAction getAction() {
+ return action;
+ }
+
+ public UriResourceActionImpl setAction(EdmAction action) {
+ this.action = action;
+ return this;
+ }
+
+ @Override
+ public EdmActionImport getActionImport() {
+ return actionImport;
+ }
+
+ public UriResourceActionImpl setActionImport(EdmActionImport actionImport) {
+ this.actionImport = actionImport;
+ this.setAction(actionImport.getAction());
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ return action.getName() + super.toString();
+ }
+
+ @Override
+ public boolean isCollection() {
+ if ( action != null) {
+ return action.getReturnType().isCollection();
+ }
+ return false;
+ }
+
+ @Override
+ public EdmType getType() {
+ return action.getReturnType().getType();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceAllImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceAllImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceAllImpl.java
new file mode 100644
index 0000000..6bc480d
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceAllImpl.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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.producer.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceAll;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
+
+public class UriResourceAllImpl extends UriResourceImplTyped implements UriResourceAll {
+ protected EdmProperty property;
+ private String lamdaVariable;
+ private ExpressionImpl expression;
+
+ public UriResourceAllImpl() {
+ super(UriResourceKind.lamdaAll);
+ }
+
+ @Override
+ public EdmType getType() {
+ return EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance();
+ }
+
+ @Override
+ public boolean isCollection() {
+ return false;
+ }
+
+ @Override
+ public String getLamdaVariable() {
+ return lamdaVariable;
+ }
+
+ public UriResourceAllImpl setLamdaVariable(String lamdaVariable) {
+ this.lamdaVariable = lamdaVariable;
+ return this;
+ };
+
+ @Override
+ public Expression getExpression() {
+ return expression;
+ }
+
+ public UriResourceAllImpl setExpression(ExpressionImpl expression) {
+ this.expression = expression;
+ return this;
+ };
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceAnyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceAnyImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceAnyImpl.java
new file mode 100644
index 0000000..eb1ce68
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceAnyImpl.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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.producer.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceAny;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
+
+public class UriResourceAnyImpl extends UriResourceImplTyped implements UriResourceAny {
+ protected EdmProperty property;
+ private String lamdaVariable;
+ private ExpressionImpl expression;
+
+ public UriResourceAnyImpl() {
+ super(UriResourceKind.lamdaAny);
+ }
+
+ @Override
+ public EdmType getType() {
+ return EdmPrimitiveTypeKind.Boolean.getEdmPrimitiveTypeInstance();
+ }
+
+ @Override
+ public boolean isCollection() {
+ return false;
+ }
+
+ @Override
+ public String getLamdaVariable() {
+ return lamdaVariable;
+ }
+
+ public UriResourceAnyImpl setLamdaVariable(String lamdaVariable) {
+ this.lamdaVariable = lamdaVariable;
+ return this;
+ };
+
+ @Override
+ public Expression getExpression() {
+ return expression;
+ }
+
+ public UriResourceAnyImpl setExpression(ExpressionImpl expression) {
+ this.expression = expression;
+ return this;
+ };
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceComplexPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceComplexPropertyImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceComplexPropertyImpl.java
new file mode 100644
index 0000000..9ce1afa
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceComplexPropertyImpl.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.producer.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmComplexType;
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceComplexProperty;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
+
+public class UriResourceComplexPropertyImpl extends UriResourceImplTyped implements UriResourceComplexProperty {
+
+ protected EdmProperty property;
+
+ public UriResourceComplexPropertyImpl() {
+ super(UriResourceKind.complexProperty);
+ }
+
+ @Override
+ public EdmProperty getProperty() {
+ return property;
+ }
+
+ public UriResourceComplexPropertyImpl setProperty(EdmProperty property) {
+ this.property = property;
+ return this;
+ }
+
+ @Override
+ public EdmComplexType getComplexType() {
+ return (EdmComplexType) this.getType();
+ }
+
+ @Override
+ public EdmComplexType getComplexTypeFilter() {
+ return (EdmComplexType) typeFilter;
+ }
+
+ @Override
+ public EdmType getType() {
+ return property.getType();
+ }
+
+ @Override
+ public boolean isCollection() {
+ return property.isCollection();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceCountImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceCountImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceCountImpl.java
new file mode 100644
index 0000000..f276d76
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceCountImpl.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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.producer.core.uri;
+
+import org.apache.olingo.odata4.producer.api.uri.UriResourceCount;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
+
+public class UriResourceCountImpl extends UriResourcePartImpl implements UriResourceCount {
+
+ public UriResourceCountImpl() {
+ super(UriResourceKind.count);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceEntitySetImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceEntitySetImpl.java
new file mode 100644
index 0000000..e997063
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceEntitySetImpl.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * 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.producer.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceEntitySet;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
+
+public class UriResourceEntitySetImpl extends UriResourceImplKeyPred implements UriResourceEntitySet {
+ protected EdmEntitySet edmEntitySet = null;
+
+ public UriResourceEntitySetImpl() {
+ super(UriResourceKind.entitySet);
+ }
+
+ @Override
+ public EdmEntitySet getEntitySet() {
+ return edmEntitySet;
+ }
+
+ public UriResourceEntitySetImpl setEntitSet(EdmEntitySet edmES) {
+ this.edmEntitySet = edmES;
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ return edmEntitySet.getName() + super.toString();
+ }
+
+ @Override
+ public EdmEntityType getEntityType() {
+ return edmEntitySet.getEntityType();
+ }
+
+ @Override
+ public EdmType getType() {
+ /*if (singleTypeFilter != null) {
+ return singleTypeFilter;
+ } else if (collectionTypeFilter != null) {
+ return collectionTypeFilter;
+ }*/
+ return edmEntitySet.getEntityType();
+
+ }
+
+ @Override
+ public boolean isCollection() {
+ if (keyPredicates == null) {
+ return true;
+ }
+ return false;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceFunctionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceFunctionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceFunctionImpl.java
new file mode 100644
index 0000000..0042f9c
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceFunctionImpl.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * 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.producer.core.uri;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
+import org.apache.olingo.odata4.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.producer.api.uri.UriParameter;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceFunction;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
+
+/**
+ * Covers Function imports and BoundFunction in URI
+ */
+public class UriResourceFunctionImpl extends UriResourceImplKeyPred implements UriResourceFunction {
+
+ protected List<UriParameterImpl> parameters;
+ protected EdmFunction function;
+ protected EdmFunctionImport functionImport;
+
+ public UriResourceFunctionImpl() {
+ super(UriResourceKind.function);
+ }
+
+ @Override
+ public List<UriParameter> getParameters() {
+ List<UriParameter> retList = new ArrayList<UriParameter>();
+ for (UriParameterImpl item : parameters) {
+ retList.add(item);
+ }
+ return retList;
+ }
+
+ public UriResourceFunctionImpl setParameters(List<UriParameterImpl> parameters) {
+ this.parameters = parameters;
+ return this;
+ }
+
+ @Override
+ public EdmFunction getFunction() {
+ return function;
+ }
+
+ public UriResourceFunctionImpl setFunction(EdmFunction function) {
+ this.function = function;
+ return this;
+ }
+
+ @Override
+ public EdmFunctionImport getFunctionImport() {
+ return functionImport;
+ }
+
+ public UriResourceFunctionImpl setFunctionImport(EdmFunctionImport edmFI, List<UriParameterImpl> parameters) {
+ this.functionImport = edmFI;
+ this.parameters = parameters;
+
+ List<String> names = new ArrayList<String>();
+ for (UriParameterImpl item : parameters) {
+ names.add(item.getName());
+ }
+
+ setFunction(edmFI.getFunction(names));
+
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ return function.getName() + super.toString();
+ }
+
+ @Override
+ public EdmType getType() {
+
+ return function.getReturnType().getType();
+
+ }
+
+ @Override
+ public boolean isCollection() {
+ if (keyPredicates != null ) {
+ return false;
+ }
+ return function.getReturnType().isCollection();
+ }
+
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplKeyPred.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplKeyPred.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplKeyPred.java
new file mode 100644
index 0000000..ab6d748
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplKeyPred.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * 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.producer.core.uri;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.producer.api.uri.UriParameter;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
+
+public abstract class UriResourceImplKeyPred extends UriResourceImplTyped {
+
+ protected EdmType collectionTypeFilter = null;
+ protected List<UriParameterImpl> keyPredicates = null;
+ protected EdmType singleTypeFilter = null;
+
+ public UriResourceImplKeyPred(UriResourceKind kind) {
+ super(kind);
+ }
+
+ public EdmType getComplexTypeFilter() {
+ if (singleTypeFilter != null) {
+ return singleTypeFilter;
+ }
+ return collectionTypeFilter;
+ }
+
+ public EdmType getTypeFilterOnCollection() {
+ return collectionTypeFilter;
+ }
+
+ public EdmType getTypeFilterOnEntry() {
+ return singleTypeFilter;
+ }
+
+ public List<UriParameter> getKeyPredicates() {
+ List<UriParameter> retList = new ArrayList<UriParameter>();
+ for (UriParameterImpl item : keyPredicates) {
+ retList.add(item);
+ }
+ return retList;
+ }
+
+ public UriResourceImplKeyPred setKeyPredicates(List<UriParameterImpl> list) {
+ keyPredicates = list;
+ return this;
+ }
+
+ public void setSingleTypeFilter(EdmType singleTypeFilter) {
+ this.singleTypeFilter = singleTypeFilter;
+ }
+
+ public void setCollectionTypeFilter(EdmType collectionTypeFilter) {
+ this.collectionTypeFilter = collectionTypeFilter;
+ }
+
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplTyped.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplTyped.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplTyped.java
new file mode 100644
index 0000000..7545e96
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplTyped.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * 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.producer.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.producer.api.uri.UriResourcePartTyped;
+
+public abstract class UriResourceImplTyped extends UriResourcePartImpl implements UriResourcePartTyped {
+
+ protected EdmType typeFilter = null;
+
+ public UriResourceImplTyped(UriResourceKind kind) {
+ super(kind);
+ }
+
+ public EdmType getComplexTypeFilter() {//TODO rename to TypeFilter
+ return typeFilter;
+ }
+
+ public UriResourceImplTyped setTypeFilter(EdmStructuralType typeFilter) {
+ this.typeFilter = typeFilter;
+ return this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceItImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceItImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceItImpl.java
new file mode 100644
index 0000000..3297660
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceItImpl.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * 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.producer.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceIt;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
+
+/**
+ * Covers Functionimports and BoundFunction in URI
+ */
+public class UriResourceItImpl extends UriResourceImplKeyPred implements UriResourceIt {
+
+ protected boolean explicitIT;
+ private EdmType type;
+ private boolean isCollection;
+
+
+ public UriResourceItImpl() {
+ super(UriResourceKind.it);
+ }
+
+ @Override
+ public String toString() {
+
+ if (explicitIT) {
+ return "$it" + super.toString();
+ }
+ return super.toString();
+ }
+
+ public UriResourceItImpl setIsExplicitIT(boolean explicitIT) {
+ this.explicitIT = explicitIT;
+ return this;
+ }
+
+ @Override
+ public boolean isExplicitIt() {
+ return explicitIT;
+ }
+
+ @Override
+ public EdmType getType() {
+ return type;
+ }
+
+ @Override
+ public boolean isCollection() {
+ if (keyPredicates != null ) {
+ return false;
+ }
+ return isCollection;
+ }
+
+ public UriResourceItImpl setType(EdmType type) {
+ this.type = type;
+ return this;
+ }
+
+ public UriResourceItImpl setCollection(boolean isCollection) {
+ this.isCollection = isCollection;
+ return this;
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceNavigationPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceNavigationPropertyImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceNavigationPropertyImpl.java
new file mode 100644
index 0000000..9da82c2
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceNavigationPropertyImpl.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * 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.producer.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceNavigation;
+
+public class UriResourceNavigationPropertyImpl extends UriResourceImplKeyPred implements UriResourceNavigation {
+
+ protected EdmNavigationProperty navigationProperty;
+
+ public UriResourceNavigationPropertyImpl() {
+ super(UriResourceKind.navigationProperty);
+ }
+
+ @Override
+ public String toString() {
+ return navigationProperty.getName() + super.toString();
+ }
+
+ @Override
+ public EdmNavigationProperty getNavigationProperty() {
+ return navigationProperty;
+ }
+
+ public UriResourceNavigationPropertyImpl addNavigationProperty(EdmNavigationProperty property) {
+ this.navigationProperty = property;
+ return this;
+
+ }
+
+ @Override
+ public EdmType getType() {
+ /*if (singleTypeFilter != null) {
+ return singleTypeFilter;
+ } else if (collectionTypeFilter != null) {
+ return collectionTypeFilter;
+ }*/
+ return navigationProperty.getType();
+ }
+
+ @Override
+ public boolean isCollection() {
+ if (keyPredicates != null ) {
+ return false;
+ }
+ return navigationProperty.isCollection();
+
+
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePartImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePartImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePartImpl.java
new file mode 100644
index 0000000..0a2e66f
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePartImpl.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * 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.producer.core.uri;
+
+import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.producer.api.uri.UriResourcePart;
+
+/**
+ * Covers Functionimports and BoundFunction in URI
+ */
+public class UriResourcePartImpl implements UriResourcePart {
+ protected UriResourceKind kind;
+
+ public UriResourcePartImpl(UriResourceKind kind) {
+ this.kind = kind;
+ }
+
+ @Override
+ public UriResourceKind getKind() {
+ return kind;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/7955eadf/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePropertyImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePropertyImpl.java
new file mode 100644
index 0000000..8ba9037
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourcePropertyImpl.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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.producer.core.uri;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceKind;
+import org.apache.olingo.odata4.producer.api.uri.UriResourceSimpleProperty;
+
+public class UriResourcePropertyImpl extends UriResourceImplTyped implements UriResourceSimpleProperty {
+ protected EdmProperty property;
+
+ public UriResourcePropertyImpl(UriResourceKind kind) {
+ super(kind);
+ }
+
+ @Override
+ public EdmProperty getProperty() {
+ return property;
+ }
+
+ public UriResourcePropertyImpl setProperty(EdmProperty property) {
+ this.property = property;
+ return this;
+ }
+
+ @Override
+ public EdmType getType() {
+ return property.getType();
+ }
+
+ @Override
+ public boolean isCollection() {
+ return property.isCollection();
+
+ }
+
+}