You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by fm...@apache.org on 2013/07/26 13:22:17 UTC

[12/51] [partial] initial commit

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/CollectionImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/CollectionImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/CollectionImpl.java
new file mode 100644
index 0000000..5467e79
--- /dev/null
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/CollectionImpl.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * 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.odata2.core.servicedocument;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.servicedocument.Accept;
+import org.apache.olingo.odata2.api.servicedocument.Categories;
+import org.apache.olingo.odata2.api.servicedocument.Collection;
+import org.apache.olingo.odata2.api.servicedocument.CommonAttributes;
+import org.apache.olingo.odata2.api.servicedocument.ExtensionElement;
+import org.apache.olingo.odata2.api.servicedocument.Title;
+
+/**
+ * @author SAP AG
+ */
+public class CollectionImpl implements Collection {
+  private Title title;
+  private String href;
+  private List<Accept> acceptElements;
+  private List<Categories> categories;
+  private CommonAttributes attributes;
+  private List<ExtensionElement> extensionElements;
+
+  @Override
+  public CommonAttributes getCommonAttributes() {
+    return attributes;
+  }
+
+  @Override
+  public Title getTitle() {
+    return title;
+  }
+
+  @Override
+  public String getHref() {
+    return href;
+  }
+
+  @Override
+  public List<Accept> getAcceptElements() {
+    return acceptElements;
+  }
+
+  @Override
+  public List<Categories> getCategories() {
+    return categories;
+  }
+
+  @Override
+  public List<ExtensionElement> getExtesionElements() {
+    return extensionElements;
+  }
+
+  public CollectionImpl setTitle(final Title title) {
+    this.title = title;
+    return this;
+  }
+
+  public CollectionImpl setHref(final String href) {
+    this.href = href;
+    return this;
+  }
+
+  public CollectionImpl setAcceptElements(final List<Accept> acceptElements) {
+    this.acceptElements = acceptElements;
+    return this;
+  }
+
+  public CollectionImpl setCategories(final List<Categories> categories) {
+    this.categories = categories;
+    return this;
+  }
+
+  public CollectionImpl setCommonAttributes(final CommonAttributes attributes) {
+    this.attributes = attributes;
+    return this;
+  }
+
+  public CollectionImpl setExtesionElements(final List<ExtensionElement> elements) {
+    extensionElements = elements;
+    return this;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/CommonAttributesImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/CommonAttributesImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/CommonAttributesImpl.java
new file mode 100644
index 0000000..ec1a1fe
--- /dev/null
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/CommonAttributesImpl.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.odata2.core.servicedocument;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.odata2.api.servicedocument.CommonAttributes;
+import org.apache.olingo.odata2.api.servicedocument.ExtensionAttribute;
+
+/**
+ * @author SAP AG
+ */
+public class CommonAttributesImpl implements CommonAttributes {
+  private String base;
+  private String lang;
+  private List<ExtensionAttribute> attributes;
+
+  @Override
+  public String getBase() {
+    return base;
+  }
+
+  @Override
+  public String getLang() {
+    return lang;
+  }
+
+  @Override
+  public List<ExtensionAttribute> getAttributes() {
+    return Collections.unmodifiableList(attributes);
+  }
+
+  public CommonAttributesImpl setBase(final String base) {
+    this.base = base;
+    return this;
+  }
+
+  public CommonAttributesImpl setLang(final String lang) {
+    this.lang = lang;
+    return this;
+  }
+
+  public CommonAttributesImpl setAttributes(final List<ExtensionAttribute> attributes) {
+    this.attributes = attributes;
+    return this;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/ExtensionAttributeImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/ExtensionAttributeImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/ExtensionAttributeImpl.java
new file mode 100644
index 0000000..08a1c8f
--- /dev/null
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/ExtensionAttributeImpl.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.odata2.core.servicedocument;
+
+import org.apache.olingo.odata2.api.servicedocument.ExtensionAttribute;
+
+/**
+ * @author SAP AG
+ */
+public class ExtensionAttributeImpl implements ExtensionAttribute {
+  private String namespace;
+  private String prefix;
+  private String name;
+  private String text;
+
+  @Override
+  public String getNamespace() {
+    return namespace;
+  }
+
+  @Override
+  public String getPrefix() {
+    return prefix;
+  }
+
+  @Override
+  public String getName() {
+    return name;
+  }
+
+  @Override
+  public String getText() {
+    return text;
+  }
+
+  public ExtensionAttributeImpl setNamespace(final String namespace) {
+    this.namespace = namespace;
+    return this;
+  }
+
+  public ExtensionAttributeImpl setPrefix(final String prefix) {
+    this.prefix = prefix;
+    return this;
+  }
+
+  public ExtensionAttributeImpl setName(final String name) {
+    this.name = name;
+    return this;
+  }
+
+  public ExtensionAttributeImpl setText(final String text) {
+    this.text = text;
+    return this;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/ExtensionElementImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/ExtensionElementImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/ExtensionElementImpl.java
new file mode 100644
index 0000000..fc1ee15
--- /dev/null
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/ExtensionElementImpl.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * 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.odata2.core.servicedocument;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.servicedocument.ExtensionAttribute;
+import org.apache.olingo.odata2.api.servicedocument.ExtensionElement;
+
+/**
+ * @author SAP AG
+ */
+public class ExtensionElementImpl implements ExtensionElement {
+  private String namespace;
+  private String prefix;
+  private String name;
+  private String text;
+  private List<ExtensionElement> anyElements;
+  private List<ExtensionAttribute> attributes;
+
+  @Override
+  public String getNamespace() {
+    return namespace;
+  }
+
+  @Override
+  public String getPrefix() {
+    return prefix;
+  }
+
+  @Override
+  public String getName() {
+    return name;
+  }
+
+  @Override
+  public String getText() {
+    return text;
+  }
+
+  @Override
+  public List<ExtensionElement> getElements() {
+    return anyElements;
+  }
+
+  @Override
+  public List<ExtensionAttribute> getAttributes() {
+    return attributes;
+  }
+
+  public ExtensionElementImpl setNamespace(final String namespace) {
+    this.namespace = namespace;
+    return this;
+  }
+
+  public ExtensionElementImpl setPrefix(final String prefix) {
+    this.prefix = prefix;
+    return this;
+  }
+
+  public ExtensionElementImpl setName(final String name) {
+    this.name = name;
+    return this;
+  }
+
+  public ExtensionElementImpl setText(final String text) {
+    this.text = text;
+    return this;
+
+  }
+
+  public ExtensionElementImpl setElements(final List<ExtensionElement> anyElements) {
+    this.anyElements = anyElements;
+    return this;
+  }
+
+  public ExtensionElementImpl setAttributes(final List<ExtensionAttribute> attributes) {
+    this.attributes = attributes;
+    return this;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/ServiceDocumentImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/ServiceDocumentImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/ServiceDocumentImpl.java
new file mode 100644
index 0000000..2eb3ff7
--- /dev/null
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/ServiceDocumentImpl.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * 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.odata2.core.servicedocument;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata2.api.edm.EdmEntitySetInfo;
+import org.apache.olingo.odata2.api.ep.EntityProviderException;
+import org.apache.olingo.odata2.api.servicedocument.AtomInfo;
+import org.apache.olingo.odata2.api.servicedocument.ServiceDocument;
+
+/**
+ * @author SAP AG
+ */
+public class ServiceDocumentImpl implements ServiceDocument {
+  private AtomInfo atomInfo;
+  private List<EdmEntitySetInfo> entitySets = new ArrayList<EdmEntitySetInfo>();
+
+  public ServiceDocumentImpl setEntitySetsInfo(final List<EdmEntitySetInfo> entitySets) {
+    this.entitySets = entitySets;
+    return this;
+  }
+
+  @Override
+  public List<EdmEntitySetInfo> getEntitySetsInfo() throws EntityProviderException {
+    return entitySets;
+  }
+
+  @Override
+  public AtomInfo getAtomInfo() {
+    return atomInfo;
+  }
+
+  public void setAtomInfo(final AtomInfo atomInfo) {
+    this.atomInfo = atomInfo;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/TitleImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/TitleImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/TitleImpl.java
new file mode 100644
index 0000000..5fc6c3c
--- /dev/null
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/TitleImpl.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * 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.odata2.core.servicedocument;
+
+import org.apache.olingo.odata2.api.servicedocument.Title;
+
+/**
+ * @author SAP AG
+ */
+public class TitleImpl implements Title {
+  private String text;
+
+  @Override
+  public String getText() {
+    return text;
+  }
+
+  public TitleImpl setText(final String text) {
+    this.text = text;
+    return this;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/WorkspaceImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/WorkspaceImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/WorkspaceImpl.java
new file mode 100644
index 0000000..fa44081
--- /dev/null
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/servicedocument/WorkspaceImpl.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * 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.odata2.core.servicedocument;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.servicedocument.Collection;
+import org.apache.olingo.odata2.api.servicedocument.CommonAttributes;
+import org.apache.olingo.odata2.api.servicedocument.ExtensionElement;
+import org.apache.olingo.odata2.api.servicedocument.Title;
+import org.apache.olingo.odata2.api.servicedocument.Workspace;
+
+/**
+ * @author SAP AG
+ */
+public class WorkspaceImpl implements Workspace {
+  private Title title;
+  private List<Collection> collections;
+  private CommonAttributes attributes;
+  private List<ExtensionElement> extensionElements;
+
+  @Override
+  public Title getTitle() {
+    return title;
+  }
+
+  @Override
+  public List<Collection> getCollections() {
+    return collections;
+  }
+
+  @Override
+  public CommonAttributes getCommonAttributes() {
+    return attributes;
+  }
+
+  @Override
+  public List<ExtensionElement> getExtesionElements() {
+    return extensionElements;
+  }
+
+  public WorkspaceImpl setTitle(final Title title) {
+    this.title = title;
+    return this;
+  }
+
+  public WorkspaceImpl setCollections(final List<Collection> collections) {
+    this.collections = collections;
+    return this;
+  }
+
+  public WorkspaceImpl setAttributes(final CommonAttributes attributes) {
+    this.attributes = attributes;
+    return this;
+  }
+
+  public WorkspaceImpl setExtesionElements(final List<ExtensionElement> elements) {
+    extensionElements = elements;
+    return this;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreator.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreator.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreator.java
new file mode 100644
index 0000000..9120d14
--- /dev/null
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeCreator.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * 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.odata2.core.uri;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.uri.ExpandSelectTreeNode;
+import org.apache.olingo.odata2.api.uri.NavigationPropertySegment;
+import org.apache.olingo.odata2.api.uri.SelectItem;
+import org.apache.olingo.odata2.core.uri.ExpandSelectTreeNodeImpl.AllKinds;
+
+/**
+ * @author SAP AG
+ */
+public class ExpandSelectTreeCreator {
+
+  private List<SelectItem> initialSelect;
+  private List<ArrayList<NavigationPropertySegment>> initialExpand;
+
+  public ExpandSelectTreeCreator(final List<SelectItem> select, final List<ArrayList<NavigationPropertySegment>> expand) {
+    if (select != null) {
+      initialSelect = select;
+    } else {
+      initialSelect = Collections.emptyList();
+    }
+
+    if (expand != null) {
+      initialExpand = expand;
+    } else {
+      initialExpand = Collections.emptyList();
+    }
+  }
+
+  public ExpandSelectTreeNodeImpl create() throws EdmException {
+
+    //Initial node
+    ExpandSelectTreeNodeImpl root = new ExpandSelectTreeNodeImpl();
+    if (!initialSelect.isEmpty()) {
+      //Create a full expand tree
+      createSelectTree(root);
+    } else {
+      //If no select is given the root node is explicitly selected for all expand clauses
+      root.setExplicitlySelected();
+    }
+    //Merge in the expand tree
+    mergeExpandTree(root);
+
+    //consolidate the tree
+    consolidate(root);
+    return root;
+  }
+
+  private void consolidate(final ExpandSelectTreeNodeImpl node) {
+    switch (node.getAllKind()) {
+    case EXPLICITLYTRUE:
+    case IMPLICITLYTRUE:
+      consolidateTrueNode(node);
+      break;
+    case FALSE:
+      consolidateFalseNode(node);
+    }
+
+  }
+
+  private void consolidateFalseNode(final ExpandSelectTreeNodeImpl node) {
+    Iterator<Map.Entry<String, ExpandSelectTreeNode>> iterator = node.getLinks().entrySet().iterator();
+    while (iterator.hasNext()) {
+      Map.Entry<String, ExpandSelectTreeNode> entry = iterator.next();
+      ExpandSelectTreeNodeImpl subNode = (ExpandSelectTreeNodeImpl) entry.getValue();
+      if (!subNode.isExpanded()) {
+        node.putLink(entry.getKey(), null);
+      } else {
+        consolidate(subNode);
+      }
+    }
+  }
+
+  private void consolidateTrueNode(final ExpandSelectTreeNodeImpl node) {
+    Map<String, ExpandSelectTreeNode> links = node.getLinks();
+    Set<Entry<String, ExpandSelectTreeNode>> linkEntries = links.entrySet();
+    List<String> toRemove = new ArrayList<String>();
+
+    for (Entry<String, ExpandSelectTreeNode> entry : linkEntries) {
+      ExpandSelectTreeNodeImpl subNode = (ExpandSelectTreeNodeImpl) entry.getValue();
+      if (subNode.isExpanded() && node.isExplicitlySelected()) {
+        subNode.setExplicitlySelected();
+        consolidate(subNode);
+      } else if (subNode.isExpanded()) {
+        consolidate(subNode);
+      } else {
+        toRemove.add(entry.getKey());
+      }
+    }
+
+    //
+    for (String key : toRemove) {
+      node.removeLink(key);
+    }
+  }
+
+  private void createSelectTree(final ExpandSelectTreeNodeImpl root) throws EdmException {
+    for (SelectItem item : initialSelect) {
+      ExpandSelectTreeNodeImpl actualNode = root;
+
+      for (NavigationPropertySegment navSegement : item.getNavigationPropertySegments()) {
+        actualNode = addSelectNode(actualNode, navSegement.getNavigationProperty().getName());
+      }
+
+      if (item.getProperty() != null) {
+        actualNode.addProperty(item.getProperty());
+      } else if (item.isStar()) {
+        actualNode.setAllExplicitly();
+      } else {
+        //The actual node is a navigation property and has no property or star so it is explicitly selected
+        actualNode.setExplicitlySelected();
+      }
+    }
+  }
+
+  private ExpandSelectTreeNodeImpl addSelectNode(final ExpandSelectTreeNodeImpl actualNode, final String navigationPropertyName) {
+    Map<String, ExpandSelectTreeNode> links = actualNode.getLinks();
+    if (!links.containsKey(navigationPropertyName)) {
+      ExpandSelectTreeNodeImpl subNode = new ExpandSelectTreeNodeImpl();
+      actualNode.putLink(navigationPropertyName, subNode);
+      if (actualNode.isExplicitlySelected()) {
+        //if a node was explicitly selected all sub nodes are explicitly selected
+        subNode.setExplicitlySelected();
+      } else {
+        if (actualNode.getAllKind() == AllKinds.IMPLICITLYTRUE) {
+          actualNode.setAllKindFalse();
+        }
+      }
+      return subNode;
+    } else {
+      return (ExpandSelectTreeNodeImpl) links.get(navigationPropertyName);
+    }
+  }
+
+  private void mergeExpandTree(final ExpandSelectTreeNodeImpl root) throws EdmException {
+    for (ArrayList<NavigationPropertySegment> singleExpand : initialExpand) {
+      ExpandSelectTreeNodeImpl actualNode = root;
+      for (NavigationPropertySegment navSegment : singleExpand) {
+        actualNode = addExpandNode(actualNode, navSegment.getNavigationProperty().getName());
+        if (actualNode == null) {
+          break;
+        }
+      }
+    }
+
+  }
+
+  private ExpandSelectTreeNodeImpl addExpandNode(final ExpandSelectTreeNodeImpl actualNode, final String navigationPropertyName) {
+    Map<String, ExpandSelectTreeNode> links = actualNode.getLinks();
+    if (!links.containsKey(navigationPropertyName)) {
+      if (actualNode.isExplicitlySelected() || (actualNode.isExplicitlySelected() && actualNode.isExpanded())) {
+        ExpandSelectTreeNodeImpl subNode = new ExpandSelectTreeNodeImpl();
+        subNode.setExpanded();
+        subNode.setExplicitlySelected();
+        actualNode.putLink(navigationPropertyName, subNode);
+        return subNode;
+      } else {
+        return null;
+      }
+    } else {
+      ExpandSelectTreeNodeImpl subNode = (ExpandSelectTreeNodeImpl) links.get(navigationPropertyName);
+      subNode.setExpanded();
+      return subNode;
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeNodeImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeNodeImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeNodeImpl.java
new file mode 100644
index 0000000..bc49590
--- /dev/null
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/ExpandSelectTreeNodeImpl.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * 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.odata2.core.uri;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmProperty;
+import org.apache.olingo.odata2.api.uri.ExpandSelectTreeNode;
+import org.apache.olingo.odata2.core.ep.util.JsonStreamWriter;
+import org.apache.olingo.odata2.core.exception.ODataRuntimeException;
+
+/**
+ * @author SAP AG
+ */
+public class ExpandSelectTreeNodeImpl implements ExpandSelectTreeNode {
+
+  public enum AllKinds {
+    IMPLICITLYTRUE(true), EXPLICITLYTRUE(true), FALSE(false);
+
+    private boolean booleanRepresentation;
+
+    private AllKinds(final boolean booleanRepresentation) {
+      this.booleanRepresentation = booleanRepresentation;
+    }
+
+    public boolean getBoolean() {
+      return booleanRepresentation;
+    }
+  }
+
+  private AllKinds isAll = AllKinds.IMPLICITLYTRUE;
+  private boolean isExplicitlySelected = false;
+  private boolean isExpanded = false;
+  private final List<EdmProperty> properties = new ArrayList<EdmProperty>();
+  private final Map<String, ExpandSelectTreeNodeImpl> links = new HashMap<String, ExpandSelectTreeNodeImpl>();
+
+  @Override
+  public boolean isAll() {
+    return isAll.getBoolean();
+  }
+
+  @Override
+  public List<EdmProperty> getProperties() {
+    return properties;
+  }
+
+  @SuppressWarnings("unchecked")
+  @Override
+  public Map<String, ExpandSelectTreeNode> getLinks() {
+    return (Map<String, ExpandSelectTreeNode>) ((Map<String, ? extends ExpandSelectTreeNode>) Collections.unmodifiableMap(links));
+  }
+
+  public void putLink(final String name, final ExpandSelectTreeNodeImpl node) {
+    links.put(name, node);
+  }
+
+  public void removeLink(final String name) {
+    links.remove(name);
+  }
+
+  public boolean isExplicitlySelected() {
+    return isExplicitlySelected;
+  }
+
+  public void setExplicitlySelected() {
+    isExplicitlySelected = true;
+    setAllExplicitly();
+  }
+
+  public boolean isExpanded() {
+    return isExpanded;
+  }
+
+  public void setExpanded() {
+    isExpanded = true;
+  }
+
+  public void addProperty(final EdmProperty property) {
+    if (property != null && isAll != AllKinds.EXPLICITLYTRUE && !properties.contains(property)) {
+      properties.add(property);
+      isAll = AllKinds.FALSE;
+    }
+  }
+
+  public void setAllExplicitly() {
+    properties.clear();
+    isAll = AllKinds.EXPLICITLYTRUE;
+  }
+
+  public AllKinds getAllKind() {
+    return isAll;
+  }
+
+  public void setAllKindFalse() {
+    isAll = AllKinds.FALSE;
+  }
+
+  public String toJsonString() {
+    try {
+      StringWriter writer = new StringWriter();
+      JsonStreamWriter jsonStreamWriter = new JsonStreamWriter(writer);
+      jsonStreamWriter.beginObject()
+          .name("all").unquotedValue(Boolean.toString(isAll())).separator()
+          .name("properties")
+          .beginArray();
+      boolean first = true;
+      for (EdmProperty property : properties) {
+        if (first) {
+          first = false;
+        } else {
+          jsonStreamWriter.separator();
+        }
+        jsonStreamWriter.stringValueRaw(property.getName());
+      }
+      jsonStreamWriter.endArray().separator()
+          .name("links")
+          .beginArray();
+      first = true;
+      for (Map.Entry<String, ExpandSelectTreeNodeImpl> entry : links.entrySet()) {
+        if (first) {
+          first = false;
+        } else {
+          jsonStreamWriter.separator();
+        }
+        final String nodeString = entry.getValue() == null ? null : entry.getValue().toJsonString();
+        jsonStreamWriter.beginObject()
+            .name(entry.getKey()).unquotedValue(nodeString)
+            .endObject();
+      }
+      jsonStreamWriter.endArray()
+          .endObject();
+      writer.flush();
+      return writer.toString();
+    } catch (final IOException e) {
+      throw new ODataRuntimeException("IOException: ", e);
+    } catch (final EdmException e) {
+      throw new ODataRuntimeException("EdmException: ", e);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/KeyPredicateImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/KeyPredicateImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/KeyPredicateImpl.java
new file mode 100644
index 0000000..c7b3386
--- /dev/null
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/KeyPredicateImpl.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * 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.odata2.core.uri;
+
+import org.apache.olingo.odata2.api.edm.EdmProperty;
+import org.apache.olingo.odata2.api.uri.KeyPredicate;
+
+/**
+ * @author SAP AG
+ */
+public class KeyPredicateImpl implements KeyPredicate {
+
+  public KeyPredicateImpl(final String literal, final EdmProperty property) {
+    super();
+    this.literal = literal;
+    this.property = property;
+  }
+
+  private String literal;
+  private EdmProperty property;
+
+  @Override
+  public String getLiteral() {
+    return literal;
+  }
+
+  public void setValue(final String value) {
+    literal = value;
+  }
+
+  @Override
+  public EdmProperty getProperty() {
+    return property;
+  }
+
+  public void setProperty(final EdmProperty property) {
+    this.property = property;
+  }
+
+  @Override
+  public String toString() {
+    return "KeyPredicate: literal=" + literal + ", propertyName=" + property;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/NavigationPropertySegmentImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/NavigationPropertySegmentImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/NavigationPropertySegmentImpl.java
new file mode 100644
index 0000000..0f1ebe7
--- /dev/null
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/NavigationPropertySegmentImpl.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * 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.odata2.core.uri;
+
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.uri.NavigationPropertySegment;
+
+/**
+ * @author SAP AG
+ */
+public class NavigationPropertySegmentImpl implements NavigationPropertySegment {
+
+  private EdmNavigationProperty navigationProperty;
+  private EdmEntitySet targetEntitySet;
+
+  @Override
+  public EdmNavigationProperty getNavigationProperty() {
+    return navigationProperty;
+  }
+
+  public void setNavigationProperty(final EdmNavigationProperty navigationProperty) {
+    this.navigationProperty = navigationProperty;
+  }
+
+  @Override
+  public EdmEntitySet getTargetEntitySet() {
+    return targetEntitySet;
+  }
+
+  public void setTargetEntitySet(final EdmEntitySet targetEntitySet) {
+    this.targetEntitySet = targetEntitySet;
+  }
+
+  @Override
+  public String toString() {
+    return "Navigation Property: " + navigationProperty + ", Target Entity Set: " + targetEntitySet;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/NavigationSegmentImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/NavigationSegmentImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/NavigationSegmentImpl.java
new file mode 100644
index 0000000..ce4a935
--- /dev/null
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/NavigationSegmentImpl.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.odata2.core.uri;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.uri.KeyPredicate;
+import org.apache.olingo.odata2.api.uri.NavigationSegment;
+
+/**
+ * @author SAP AG
+ */
+public class NavigationSegmentImpl implements NavigationSegment {
+
+  private EdmNavigationProperty navigationProperty;
+  private EdmEntitySet targetEntitySet;
+  private List<KeyPredicate> keyPredicates = Collections.emptyList();
+
+  @Override
+  public List<KeyPredicate> getKeyPredicates() {
+    return keyPredicates;
+  }
+
+  public void setKeyPredicates(final List<KeyPredicate> keyPredicates) {
+    this.keyPredicates = keyPredicates;
+  }
+
+  @Override
+  public EdmNavigationProperty getNavigationProperty() {
+    return navigationProperty;
+  }
+
+  public void setNavigationProperty(final EdmNavigationProperty edmNavigationProperty) {
+    navigationProperty = edmNavigationProperty;
+  }
+
+  @Override
+  public EdmEntitySet getEntitySet() {
+    return targetEntitySet;
+  }
+
+  public void setEntitySet(final EdmEntitySet edmEntitySet) {
+    targetEntitySet = edmEntitySet;
+  }
+
+  @Override
+  public String toString() {
+    return "Navigation Property: " + navigationProperty + ", "
+        + "Target Entity Set: " + targetEntitySet + ", "
+        + "Key Predicates: " + keyPredicates;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/SelectItemImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/SelectItemImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/SelectItemImpl.java
new file mode 100644
index 0000000..b25879b
--- /dev/null
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/SelectItemImpl.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * 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.odata2.core.uri;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.olingo.odata2.api.edm.EdmProperty;
+import org.apache.olingo.odata2.api.uri.NavigationPropertySegment;
+import org.apache.olingo.odata2.api.uri.SelectItem;
+
+/**
+ * @author SAP AG
+ */
+public class SelectItemImpl implements SelectItem {
+
+  private List<NavigationPropertySegment> navigationPropertySegments = Collections.emptyList();
+  private EdmProperty property;
+  private boolean star;
+
+  @Override
+  public boolean isStar() {
+    return star;
+  }
+
+  public void setStar(final boolean star) {
+    this.star = star;
+  }
+
+  @Override
+  public EdmProperty getProperty() {
+    return property;
+  }
+
+  public void setProperty(final EdmProperty property) {
+    this.property = property;
+  }
+
+  public void addNavigationPropertySegment(final NavigationPropertySegment segment) {
+    if (navigationPropertySegments.equals(Collections.EMPTY_LIST)) {
+      navigationPropertySegments = new ArrayList<NavigationPropertySegment>();
+    }
+
+    navigationPropertySegments.add(segment);
+  }
+
+  @Override
+  public List<NavigationPropertySegment> getNavigationPropertySegments() {
+    return navigationPropertySegments;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/SystemQueryOption.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/SystemQueryOption.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/SystemQueryOption.java
new file mode 100644
index 0000000..e30bee7
--- /dev/null
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/SystemQueryOption.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.odata2.core.uri;
+
+/**
+ * @author SAP AG
+ */
+public enum SystemQueryOption {
+  $format, $filter, $inlinecount, $orderby, $skiptoken, $skip, $top, $expand, $select;
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata2/blob/ff2b0a0e/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/UriInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/UriInfoImpl.java b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/UriInfoImpl.java
new file mode 100644
index 0000000..9db2427
--- /dev/null
+++ b/odata-core/src/main/java/org/apache/olingo/odata2/core/uri/UriInfoImpl.java
@@ -0,0 +1,324 @@
+/*******************************************************************************
+ * 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.odata2.core.uri;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.commons.InlineCount;
+import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmFunctionImport;
+import org.apache.olingo.odata2.api.edm.EdmLiteral;
+import org.apache.olingo.odata2.api.edm.EdmProperty;
+import org.apache.olingo.odata2.api.edm.EdmType;
+import org.apache.olingo.odata2.api.uri.KeyPredicate;
+import org.apache.olingo.odata2.api.uri.NavigationPropertySegment;
+import org.apache.olingo.odata2.api.uri.NavigationSegment;
+import org.apache.olingo.odata2.api.uri.SelectItem;
+import org.apache.olingo.odata2.api.uri.UriInfo;
+import org.apache.olingo.odata2.api.uri.expression.FilterExpression;
+import org.apache.olingo.odata2.api.uri.expression.OrderByExpression;
+
+/**
+ * @author SAP AG
+ */
+public class UriInfoImpl implements UriInfo {
+
+  private UriType uriType;
+
+  private EdmEntityContainer entityContainer;
+  private EdmEntitySet startEntitySet;
+  private EdmEntitySet targetEntitySet;
+  private EdmFunctionImport functionImport;
+  private EdmType targetType;
+  private List<KeyPredicate> keyPredicates = Collections.emptyList();
+  private List<NavigationSegment> navigationSegments = Collections.emptyList();
+  private List<EdmProperty> propertyPath = Collections.emptyList();
+  private boolean count;
+  private boolean value;
+  private boolean links;
+
+  private String format;
+  private FilterExpression filter;
+  private InlineCount inlineCount;
+  private OrderByExpression orderBy;
+  private String skipToken;
+  private Integer skip;
+  private Integer top;
+  private List<ArrayList<NavigationPropertySegment>> expand = Collections.emptyList();
+  private List<SelectItem> select = Collections.emptyList();
+  private Map<String, EdmLiteral> functionImportParameters = Collections.emptyMap();
+  private Map<String, String> customQueryOptions = Collections.emptyMap();
+
+  public UriType getUriType() {
+    return uriType;
+  }
+
+  public void setUriType(final UriType uriType) {
+    this.uriType = uriType;
+  }
+
+  public void setEntityContainer(final EdmEntityContainer entityContainer) {
+    this.entityContainer = entityContainer;
+  }
+
+  @Override
+  public EdmEntityContainer getEntityContainer() {
+    return entityContainer;
+  }
+
+  public void setStartEntitySet(final EdmEntitySet edmEntitySet) {
+    startEntitySet = edmEntitySet;
+  }
+
+  @Override
+  public EdmEntitySet getStartEntitySet() {
+    return startEntitySet;
+  }
+
+  public void setTargetEntitySet(final EdmEntitySet targetEntitySet) {
+    this.targetEntitySet = targetEntitySet;
+  }
+
+  @Override
+  public EdmEntitySet getTargetEntitySet() {
+    return targetEntitySet;
+  }
+
+  public void setFunctionImport(final EdmFunctionImport functionImport) {
+    this.functionImport = functionImport;
+  }
+
+  @Override
+  public EdmFunctionImport getFunctionImport() {
+    return functionImport;
+  }
+
+  public void setTargetType(final EdmType targetType) {
+    this.targetType = targetType;
+  }
+
+  @Override
+  public EdmType getTargetType() {
+    return targetType;
+  }
+
+  public void setKeyPredicates(final List<KeyPredicate> keyPredicates) {
+    this.keyPredicates = keyPredicates;
+  }
+
+  @Override
+  public List<KeyPredicate> getKeyPredicates() {
+    return keyPredicates;
+  }
+
+  @Override
+  public List<KeyPredicate> getTargetKeyPredicates() {
+    return navigationSegments.isEmpty() ?
+        keyPredicates :
+        navigationSegments.get(navigationSegments.size() - 1).getKeyPredicates();
+  }
+
+  public void addNavigationSegment(final NavigationSegment navigationSegment) {
+    if (navigationSegments.equals(Collections.EMPTY_LIST)) {
+      navigationSegments = new ArrayList<NavigationSegment>();
+    }
+
+    navigationSegments.add(navigationSegment);
+  }
+
+  @Override
+  public List<NavigationSegment> getNavigationSegments() {
+    return navigationSegments;
+  }
+
+  public void addProperty(final EdmProperty property) {
+    if (propertyPath.equals(Collections.EMPTY_LIST)) {
+      propertyPath = new ArrayList<EdmProperty>();
+    }
+
+    propertyPath.add(property);
+  }
+
+  @Override
+  public List<EdmProperty> getPropertyPath() {
+    return propertyPath;
+  }
+
+  public void setCount(final boolean count) {
+    this.count = count;
+  }
+
+  @Override
+  public boolean isCount() {
+    return count;
+  }
+
+  public void setValue(final boolean value) {
+    this.value = value;
+  }
+
+  @Override
+  public boolean isValue() {
+    return value;
+  }
+
+  public void setLinks(final boolean links) {
+    this.links = links;
+  }
+
+  @Override
+  public boolean isLinks() {
+    return links;
+  }
+
+  public void setFormat(final String contentType) {
+    format = contentType;
+  }
+
+  @Override
+  public String getFormat() {
+    return format;
+  }
+
+  public void setFilter(final FilterExpression filter) {
+    this.filter = filter;
+  }
+
+  @Override
+  public FilterExpression getFilter() {
+    return filter;
+  }
+
+  public void setInlineCount(final InlineCount inlineCount) {
+    this.inlineCount = inlineCount;
+  }
+
+  @Override
+  public InlineCount getInlineCount() {
+    return inlineCount;
+  }
+
+  public void setOrderBy(final OrderByExpression orderBy) {
+    this.orderBy = orderBy;
+  }
+
+  @Override
+  public OrderByExpression getOrderBy() {
+    return orderBy;
+  }
+
+  public void setSkipToken(final String skipToken) {
+    this.skipToken = skipToken;
+  }
+
+  @Override
+  public String getSkipToken() {
+    return skipToken;
+  }
+
+  public void setSkip(final Integer skip) {
+    this.skip = skip;
+  }
+
+  @Override
+  public Integer getSkip() {
+    return skip;
+  }
+
+  public void setTop(final Integer top) {
+    this.top = top;
+  }
+
+  @Override
+  public Integer getTop() {
+    return top;
+  }
+
+  public void setExpand(final List<ArrayList<NavigationPropertySegment>> expand) {
+    this.expand = expand;
+  }
+
+  @Override
+  public List<ArrayList<NavigationPropertySegment>> getExpand() {
+    return expand;
+  }
+
+  public void setSelect(final List<SelectItem> select) {
+    this.select = select;
+  }
+
+  @Override
+  public List<SelectItem> getSelect() {
+    return select;
+  }
+
+  public void addFunctionImportParameter(final String name, final EdmLiteral value) {
+    if (functionImportParameters.equals(Collections.EMPTY_MAP)) {
+      functionImportParameters = new HashMap<String, EdmLiteral>();
+    }
+
+    functionImportParameters.put(name, value);
+  }
+
+  @Override
+  public Map<String, EdmLiteral> getFunctionImportParameters() {
+    return functionImportParameters;
+  }
+
+  @Override
+  public Map<String, String> getCustomQueryOptions() {
+    return customQueryOptions;
+  }
+
+  public void setCustomQueryOptions(final Map<String, String> customQueryOptions) {
+    this.customQueryOptions = customQueryOptions;
+  }
+
+  @Override
+  public String toString() {
+    return "UriParserResult: uriType=" + uriType + ", "
+        + "entityContainer=" + entityContainer + ", "
+        + "entitySet=" + startEntitySet + ", "
+        + "targetEntitySet=" + targetEntitySet + ", "
+        + "functionImport=" + functionImport + ", "
+        + "targetType=" + targetType + ", "
+        + "keyPredicates=" + keyPredicates + ", "
+        + "navigationSegments=" + navigationSegments + ", "
+        + "propertyPath=" + propertyPath + ", "
+        + "isCount=" + count + ", "
+        + "isValue=" + value + ", "
+        + "isLinks=" + links + ", "
+        + "contentType=" + format + ", "
+        + "filter=" + filter + ", "
+        + "inlineCount=" + inlineCount + ", "
+        + "orderBy=" + orderBy + ", "
+        + "skipToken=" + skipToken + ", "
+        + "skip=" + skip + ", "
+        + "top=" + top + ", "
+        + "expand=" + expand + ", "
+        + "select=" + select + ", "
+        + "functionImportParameters=" + functionImportParameters + ", "
+        + "customQueryOptions=" + customQueryOptions;
+  }
+}