You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ar...@apache.org on 2018/04/02 11:32:04 UTC
[23/24] olingo-odata2 git commit: [OLINGO-1253]Client Module for
Olingo v2
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/pom.xml
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/pom.xml b/odata2-lib/odata-client-core/pom.xml
new file mode 100644
index 0000000..e63401b
--- /dev/null
+++ b/odata2-lib/odata-client-core/pom.xml
@@ -0,0 +1,90 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>olingo-odata2-lib</artifactId>
+ <version>2.0.11-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <artifactId>olingo-odata2-client-core</artifactId>
+ <packaging>jar</packaging>
+ <name>${project.artifactId}</name>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>olingo-odata2-client-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>olingo-odata2-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>olingo-odata2-testutil</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>xmlunit</groupId>
+ <artifactId>xmlunit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpcore</artifactId>
+ <version>${httpcore.version}</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <executions>
+ <execution>
+ <id>bundle-manifest</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>manifest</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <instructions>
+ <Import-Package>
+ *
+ </Import-Package>
+ <Export-Package>
+ </Export-Package>
+ <Bundle-DocURL>${project.url}</Bundle-DocURL>
+ <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/ODataClientImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/ODataClientImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/ODataClientImpl.java
new file mode 100644
index 0000000..1a51999
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/ODataClientImpl.java
@@ -0,0 +1,199 @@
+package org.apache.olingo.odata2.client.core;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.ep.EntityProviderException;
+import org.apache.olingo.odata2.api.exception.ODataNotAcceptableException;
+import org.apache.olingo.odata2.api.uri.PathSegment;
+import org.apache.olingo.odata2.api.uri.UriInfo;
+import org.apache.olingo.odata2.api.uri.UriNotMatchingException;
+import org.apache.olingo.odata2.api.uri.UriSyntaxException;
+import org.apache.olingo.odata2.client.api.ODataClient;
+import org.apache.olingo.odata2.client.api.edm.EdmDataServices;
+import org.apache.olingo.odata2.client.api.ep.ContentTypeBasedDeserializer;
+import org.apache.olingo.odata2.client.api.ep.ContentTypeBasedSerializer;
+import org.apache.olingo.odata2.client.api.ep.DeserializerMetadataProviderInterface;
+import org.apache.olingo.odata2.client.api.uri.EdmURIBuilder;
+import org.apache.olingo.odata2.client.api.uri.URIBuilder;
+import org.apache.olingo.odata2.client.core.ep.AtomSerializerDeserializer;
+import org.apache.olingo.odata2.client.core.ep.JsonSerializerDeserializer;
+import org.apache.olingo.odata2.client.core.ep.deserializer.XmlMetadataDeserializer;
+import org.apache.olingo.odata2.client.core.uri.EdmURIBuilderImpl;
+import org.apache.olingo.odata2.client.core.uri.URIBuilderImpl;
+import org.apache.olingo.odata2.core.ODataPathSegmentImpl;
+import org.apache.olingo.odata2.core.commons.ContentType;
+import org.apache.olingo.odata2.core.uri.UriParserImpl;
+
+/**
+ * Implementation class to obtain serializers and deserializers based on content type
+ *
+ */
+public class ODataClientImpl extends ODataClient implements DeserializerMetadataProviderInterface{
+
+ private static final String AMP = "&";
+ private static final String EQUAL = "=";
+ private static final String QUESTIONMARK = "\\?";
+ private static final String SLASH = "/";
+
+ @Override
+ public ContentTypeBasedSerializer createSerializer(final String contentType)
+ throws EntityProviderException {
+ return createSerializer(ContentType.createAsCustom(contentType));
+
+ }
+
+ private ContentTypeBasedSerializer createSerializer(ContentType contentType)
+ throws EntityProviderException {
+ try {
+ switch (contentType.getODataFormat()) {
+ case ATOM:
+ case XML:
+ return new AtomSerializerDeserializer(contentType.getODataFormat());
+ case JSON:
+ return new JsonSerializerDeserializer();
+ default:
+ throw new ODataNotAcceptableException(ODataNotAcceptableException.NOT_SUPPORTED_CONTENT_TYPE
+ .addContent(contentType));
+ }
+ } catch (final ODataNotAcceptableException e) {
+ throw new EntityProviderException(EntityProviderException.COMMON, e);
+ }
+ }
+
+ @Override
+ public ContentTypeBasedDeserializer createDeserializer(final String contentType)
+ throws EntityProviderException {
+ return createDeserializer(ContentType.createAsCustom(contentType));
+
+ }
+
+ private ContentTypeBasedDeserializer createDeserializer(ContentType contentType)
+ throws EntityProviderException {
+ try {
+ switch (contentType.getODataFormat()) {
+ case ATOM:
+ case XML:
+ return new AtomSerializerDeserializer(contentType.getODataFormat());
+ case JSON:
+ return new JsonSerializerDeserializer();
+ default:
+ throw new ODataNotAcceptableException(ODataNotAcceptableException.NOT_SUPPORTED_CONTENT_TYPE
+ .addContent(contentType));
+ }
+ } catch (final ODataNotAcceptableException e) {
+ throw new EntityProviderException(EntityProviderException.COMMON, e);
+ }
+ }
+
+ @Override
+ public EdmDataServices readMetadata(InputStream content, boolean validate)
+ throws EntityProviderException, EdmException {
+ return new XmlMetadataDeserializer().readMetadata(content, validate);
+ }
+
+ @Override
+ public UriInfo parseUri(Edm edm, List<PathSegment> pathSegments, Map<String, List<String>> queryParameters)
+ throws UriSyntaxException, UriNotMatchingException, EdmException {
+ return new UriParserImpl(edm).parseAll(pathSegments, queryParameters);
+ }
+
+ @Override
+ public UriInfo parseUri(Edm edm, String uri) throws UriSyntaxException, UriNotMatchingException, EdmException {
+ final String[] path = uri.split(QUESTIONMARK, -1);
+ if (path.length > 2) {
+ throw new UriSyntaxException(UriSyntaxException.URISYNTAX);
+ }
+
+ final List<PathSegment> pathSegments = getPathSegments(path[0]);
+
+ Map<String, List<String>> queryParameters;
+ if (path.length == 2) {
+ queryParameters = getQueryParameters(unescape(path[1]));
+ } else {
+ queryParameters = new HashMap<String, List<String>>();
+ }
+
+ return new UriParserImpl(edm).parseAll(pathSegments, queryParameters);
+ }
+ /**
+ * Fetch query parameters
+ * @param uri
+ * @return
+ */
+ private Map<String, List<String>> getQueryParameters(final String uri) {
+ Map<String, List<String>> allQueryParameters = new HashMap<String, List<String>>();
+
+ for (final String option : uri.split(AMP)) {
+ final String[] keyAndValue = option.split(EQUAL);
+ List<String> list = allQueryParameters.containsKey(keyAndValue[0]) ?
+ allQueryParameters.get(keyAndValue[0]) : new LinkedList<String>();
+
+ list.add(keyAndValue.length == 2 ? keyAndValue[1] : "");
+
+ allQueryParameters.put(keyAndValue[0], list);
+ }
+
+ return allQueryParameters;
+ }
+ /**
+ * Fetch path segments
+ * @param uri
+ * @return
+ * @throws UriSyntaxException
+ */
+ private List<PathSegment> getPathSegments(final String uri) throws UriSyntaxException {
+ List<PathSegment> pathSegments = new ArrayList<PathSegment>();
+ for (final String segment : uri.split(SLASH, -1)) {
+ final String unescapedSegment = unescape(segment);
+ PathSegment oDataSegment = new ODataPathSegmentImpl(unescapedSegment, null);
+ pathSegments.add(oDataSegment);
+ }
+ return pathSegments;
+ }
+
+ private String unescape(final String s) throws UriSyntaxException {
+ try {
+ return new URI(s).getPath();
+ } catch (URISyntaxException e) {
+ throw new UriSyntaxException(UriSyntaxException.NOTEXT, e);
+ }
+ }
+
+
+/**
+ * Fetch Query parameters
+ * @param uri
+ * @return
+ */
+ private Map<String, String> getQueryParametersWithStrictFilter(String uri) {
+ Map<String, String> queryParameters = new HashMap<String, String>();
+ for (final String option : uri.split(AMP)) {
+ final String[] keyAndValue = option.split(EQUAL);
+ if (keyAndValue.length == 2) {
+ queryParameters.put(keyAndValue[0], keyAndValue[1]);
+ } else {
+ queryParameters.put(keyAndValue[0], "");
+ }
+ }
+ return queryParameters;
+ }
+
+@Override
+ public EdmURIBuilder edmUriBuilder(String serviceRoot) {
+ return new EdmURIBuilderImpl(serviceRoot);
+ }
+
+@Override
+ public URIBuilder uriBuilder(String serviceRoot) {
+ return new URIBuilderImpl(serviceRoot);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/EdmMetadataAssociationEnd.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/EdmMetadataAssociationEnd.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/EdmMetadataAssociationEnd.java
new file mode 100644
index 0000000..dacb8d3
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/EdmMetadataAssociationEnd.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.client.core.edm;
+
+import org.apache.olingo.odata2.api.edm.EdmAssociationEnd;
+
+/**
+ * @org.apache.olingo.odata2.DoNotImplement
+ * A CSDL AssociationEnd element
+ *
+ * <p>EdmAssociationEnd defines one side of the relationship of two entity types.
+ *
+ */
+public interface EdmMetadataAssociationEnd extends EdmAssociationEnd {
+
+
+ /**
+ * @return {@link OnDelete} on delete
+ */
+ public EdmOnDelete getOnDelete() ;
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/EdmOnDelete.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/EdmOnDelete.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/EdmOnDelete.java
new file mode 100644
index 0000000..0a39db6
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/EdmOnDelete.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.client.core.edm;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.edm.EdmAction;
+import org.apache.olingo.odata2.api.edm.EdmAnnotationAttribute;
+import org.apache.olingo.odata2.api.edm.EdmAnnotationElement;
+import org.apache.olingo.odata2.client.api.edm.EdmDocumentation;
+
+/**
+ * Objects of this class represent an OnDelete Action
+ *
+ */
+public interface EdmOnDelete {
+ /**
+ * @return {@link EdmAction} action
+ */
+ public EdmAction getAction() ;
+
+ /**
+ * @return {@link Documentation} documentation
+ */
+ public EdmDocumentation getDocumentation() ;
+
+ /**
+ * @return List of {@link AnnotationAttribute} annotation attributes
+ */
+ public List<EdmAnnotationAttribute> getAnnotationAttributes();
+
+ /**
+ * @return List of {@link AnnotationElement} annotation elements
+ */
+ public List<EdmAnnotationElement> getAnnotationElements() ;
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAnnotationAttributeImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAnnotationAttributeImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAnnotationAttributeImpl.java
new file mode 100644
index 0000000..7675a41
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAnnotationAttributeImpl.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * 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.client.core.edm.Impl;
+
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.apache.olingo.odata2.api.edm.EdmAnnotationAttribute;
+
+/**
+ * Objects of this class represent an annotation attribute
+ *
+ */
+public class EdmAnnotationAttributeImpl implements EdmAnnotationAttribute {
+
+ 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;
+ }
+
+ /**
+ * Sets the namespace for this {@link EdmAnnotationAttributeImpl}.
+ * @param namespace
+ * @return {@link EdmAnnotationAttributeImpl} for method chaining
+ */
+ public EdmAnnotationAttributeImpl setNamespace(final String namespace) {
+ this.namespace = namespace;
+ return this;
+ }
+
+ /**
+ * Sets the prefix for this {@link EdmAnnotationAttributeImpl}.
+ * @param prefix
+ * @return {@link EdmAnnotationAttributeImpl} for method chaining
+ */
+ public EdmAnnotationAttributeImpl setPrefix(final String prefix) {
+ this.prefix = prefix;
+ return this;
+ }
+
+ /**
+ * Sets the name for this {@link EdmAnnotationAttributeImpl}.
+ * @param name
+ * @return {@link EdmAnnotationAttributeImpl} for method chaining
+ */
+ public EdmAnnotationAttributeImpl setName(final String name) {
+ this.name = name;
+ return this;
+ }
+
+ /**
+ * Sets the text for this {@link EdmAnnotationAttributeImpl}.
+ * @param text
+ * @return {@link EdmAnnotationAttributeImpl} for method chaining
+ */
+ public EdmAnnotationAttributeImpl setText(final String text) {
+ this.text = text;
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ return namespace + Edm.DELIMITER + name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAnnotationElementImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAnnotationElementImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAnnotationElementImpl.java
new file mode 100644
index 0000000..ae117c1
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAnnotationElementImpl.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * 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.client.core.edm.Impl;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.apache.olingo.odata2.api.edm.EdmAnnotationAttribute;
+import org.apache.olingo.odata2.api.edm.EdmAnnotationElement;
+
+/**
+ * Objects of this class represent AnnotationElement
+ *
+ */
+public class EdmAnnotationElementImpl implements EdmAnnotationElement {
+
+ List<EdmAnnotationElement> childElements;
+ List<EdmAnnotationAttribute> attributes;
+ private String namespace;
+ private String prefix;
+ private String name;
+ private String text;
+
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+ public void setPrefix(String prefix) {
+ this.prefix = prefix;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public void setChildElements(List<EdmAnnotationElement> childElements) {
+ this.childElements = childElements;
+ }
+ public void setAttributes(List<EdmAnnotationAttribute> attributes) {
+ this.attributes = attributes;
+ }
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String getNamespace() {
+ return namespace;
+ }
+
+ @Override
+ public String getPrefix() {
+ return prefix;
+ }
+
+ @Override
+ public String getText() {
+ return text;
+ }
+
+ @Override
+ public List<EdmAnnotationElement> getChildElements() {
+ return childElements;
+ }
+
+ @Override
+ public List<EdmAnnotationAttribute> getAttributes() {
+ return attributes;
+ }
+
+ @Override
+ public String toString() {
+ return namespace + Edm.DELIMITER + name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAnnotationsImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAnnotationsImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAnnotationsImpl.java
new file mode 100644
index 0000000..95ac630
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAnnotationsImpl.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * 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.client.core.edm.Impl;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.edm.EdmAnnotationAttribute;
+import org.apache.olingo.odata2.api.edm.EdmAnnotationElement;
+import org.apache.olingo.odata2.api.edm.EdmAnnotations;
+
+/**
+ * Objects of this class represent annotation elements and attributes
+ *
+ */
+public class EdmAnnotationsImpl implements EdmAnnotations {
+
+ private List<EdmAnnotationAttribute> annotationAttributes;
+ private List<EdmAnnotationElement> annotationElements;
+
+ @Override
+ public List<EdmAnnotationElement> getAnnotationElements() {
+ return annotationElements;
+ }
+
+ @Override
+ public EdmAnnotationElement getAnnotationElement(final String name, final String namespace) {
+ if (annotationElements != null) {
+ for (EdmAnnotationElement element : annotationElements) {
+ if (element.getName().equals(name) && element.getNamespace().equals(namespace)) {
+ return element;
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public List<EdmAnnotationAttribute> getAnnotationAttributes() {
+ return annotationAttributes;
+ }
+
+ @Override
+ public EdmAnnotationAttribute getAnnotationAttribute(final String name, final String namespace) {
+ if (annotationAttributes != null) {
+ for (EdmAnnotationAttribute attribute : annotationAttributes) {
+ if (attribute.getName().equals(name) && attribute.getNamespace().equals(namespace)) {
+ return attribute;
+ }
+ }
+ }
+ return null;
+ }
+
+ public void setAnnotationAttributes(List<EdmAnnotationAttribute> annotationAttributes) {
+ this.annotationAttributes = annotationAttributes;
+ }
+
+ public void setAnnotationElements(List<EdmAnnotationElement> annotationElements) {
+ this.annotationElements = annotationElements;
+ }
+ @Override
+ public String toString() {
+ return String.format(annotationAttributes + " " +annotationElements);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAssociationEndImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAssociationEndImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAssociationEndImpl.java
new file mode 100644
index 0000000..3f7a161
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAssociationEndImpl.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * 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.client.core.edm.Impl;
+
+import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
+import org.apache.olingo.odata2.api.edm.EdmAnnotations;
+import org.apache.olingo.odata2.api.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
+import org.apache.olingo.odata2.api.edm.FullQualifiedName;
+import org.apache.olingo.odata2.client.core.edm.EdmMetadataAssociationEnd;
+import org.apache.olingo.odata2.client.core.edm.EdmOnDelete;
+
+/**
+ * Objects of this class represent AssociationEnds
+ *
+ */
+public class EdmAssociationEndImpl implements EdmMetadataAssociationEnd, EdmAnnotatable {
+
+ private EdmImpl edm;
+ private EdmAnnotations annotations;
+ private String role;
+ private EdmMultiplicity edmMultiplicity;
+ private FullQualifiedName associationEndTypeName;
+ private EdmOnDelete onDelete;
+
+ @Override
+ public String getRole() {
+ return role;
+ }
+
+ /**
+ * @param edm the edm to set
+ */
+ public void setEdm(EdmImpl edm) {
+ this.edm = edm;
+ }
+
+
+ @Override
+ public EdmEntityType getEntityType() throws EdmException {
+ EdmEntityType entityType = edm.getEntityType(
+ associationEndTypeName.getNamespace(),
+ associationEndTypeName.getName());
+ if (entityType == null) {
+ throw new EdmException(EdmException.ENTITYTYPEPROBLEM);
+ }
+ return entityType;
+ }
+
+ @Override
+ public EdmMultiplicity getMultiplicity() {
+ return edmMultiplicity;
+ }
+
+ @Override
+ public EdmAnnotations getAnnotations() throws EdmException {
+ return annotations;
+ }
+
+ public void setRole(String role) {
+ this.role = role;
+ }
+
+ public void setMultiplicity(EdmMultiplicity edmMultiplicity) {
+ this.edmMultiplicity = edmMultiplicity;
+ }
+
+ public void setType(FullQualifiedName associationEndTypeName) {
+ this.associationEndTypeName = associationEndTypeName;
+ }
+
+ public void setAnnotations(EdmAnnotations annotations) {
+ this.annotations = annotations;
+ }
+
+ public void setOnDelete(EdmOnDelete onDelete) {
+ this.onDelete = onDelete;
+ }
+
+ @Override
+ public EdmOnDelete getOnDelete() {
+ return onDelete;
+ }
+
+ @Override
+ public String toString() {
+ return String.format(annotations.toString());
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAssociationImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAssociationImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAssociationImpl.java
new file mode 100644
index 0000000..a885f94
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAssociationImpl.java
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * 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.client.core.edm.Impl;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
+import org.apache.olingo.odata2.api.edm.EdmAnnotations;
+import org.apache.olingo.odata2.api.edm.EdmAssociation;
+import org.apache.olingo.odata2.api.edm.EdmAssociationEnd;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmMultiplicity;
+import org.apache.olingo.odata2.api.edm.EdmReferentialConstraint;
+import org.apache.olingo.odata2.api.edm.EdmTypeKind;
+import org.apache.olingo.odata2.client.api.edm.EdmDocumentation;
+import org.apache.olingo.odata2.client.core.edm.EdmMetadataAssociationEnd;
+
+/**
+ * Objects of this class represent Asociation
+ *
+ */
+public class EdmAssociationImpl extends EdmNamedImpl implements EdmAssociation, EdmAnnotatable {
+
+ private String namespace;
+ private EdmAnnotations annotations;
+ private EdmReferentialConstraintImpl referentialConstraint;
+ private List<EdmMetadataAssociationEnd> associationEnds;
+ private EdmDocumentation documentation;
+
+
+ public EdmDocumentation getDocumentation() {
+ return documentation;
+ }
+
+
+
+ public void setDocumentation(EdmDocumentation documentation) {
+ this.documentation = documentation;
+ }
+
+
+
+ public List<EdmMetadataAssociationEnd> getAssociationEnds() {
+ return associationEnds;
+ }
+
+
+ @Override
+ public String getNamespace() throws EdmException {
+ return namespace;
+ }
+
+
+
+ /**
+ * @param namespace the namespace to set
+ */
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+
+ @Override
+ public EdmTypeKind getKind() {
+ return EdmTypeKind.ASSOCIATION;
+ }
+
+ @Override
+ public EdmAssociationEnd getEnd(final String role) throws EdmException {
+ if (!associationEnds.isEmpty()) {
+ EdmAssociationEnd end = associationEnds.get(0);
+ if (role.equals(end.getRole())) {
+ return end;
+ }
+ end = associationEnds.get(1);
+ if (role.equals(end.getRole())) {
+ return end;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public EdmAnnotations getAnnotations() throws EdmException {
+ return annotations;
+ }
+
+ public EdmMultiplicity getEndMultiplicity(final String role) throws EdmException {
+ EdmMetadataAssociationEnd end = getEnd1();
+ if (end!=null && role.equals(end.getRole())) {
+ return end.getMultiplicity();
+ }
+ end = getEnd2();
+ if (end!=null && role.equals(end.getRole())) {
+ return end.getMultiplicity();
+ }
+
+ return null;
+ }
+
+ @Override
+ public EdmMetadataAssociationEnd getEnd1() throws EdmException {
+ return associationEnds.isEmpty()?null:associationEnds.get(0);
+ }
+
+ @Override
+ public EdmMetadataAssociationEnd getEnd2() throws EdmException {
+ return associationEnds.isEmpty()?null:associationEnds.get(1);
+ }
+
+ @Override
+ public EdmReferentialConstraint getReferentialConstraint() throws EdmException {
+ return this.referentialConstraint;
+ }
+
+ public void setReferentialConstraint(EdmReferentialConstraint referentialConstraint) {
+ this.referentialConstraint = (EdmReferentialConstraintImpl) referentialConstraint;
+ }
+
+ public void setAnnotations(EdmAnnotations annotations) {
+ this.annotations = annotations;
+ }
+
+ public void setAssociationEnds(List<EdmMetadataAssociationEnd> associationEnds) {
+ this.associationEnds = associationEnds;
+ }
+
+ @Override
+ public String toString() {
+ return namespace + Edm.DELIMITER + name;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAssociationSetEndImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAssociationSetEndImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAssociationSetEndImpl.java
new file mode 100644
index 0000000..024c8ca
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAssociationSetEndImpl.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * 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.client.core.edm.Impl;
+
+import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
+import org.apache.olingo.odata2.api.edm.EdmAnnotations;
+import org.apache.olingo.odata2.api.edm.EdmAssociationSetEnd;
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmException;
+
+/**
+ * Objects of this class represent AssociationSetEnd
+ *
+ */
+public class EdmAssociationSetEndImpl implements EdmAssociationSetEnd, EdmAnnotatable {
+
+ private EdmEntitySet entitySet;
+ private String role;
+ private EdmAssociationSetEnd end;
+ private EdmAnnotations annotations;
+ private String entitySetName;
+
+ @Override
+ public EdmEntitySet getEntitySet() throws EdmException {
+ return entitySet;
+ }
+
+ public EdmAssociationSetEnd getEnd() {
+ return end;
+ }
+
+ public void setEnd(EdmAssociationSetEnd end) {
+ this.end = end;
+ }
+
+ public void setRole(String role) {
+ this.role = role;
+ }
+
+ public void setAnnotations(EdmAnnotations annotations) {
+ this.annotations = annotations;
+ }
+
+ @Override
+ public String getRole() {
+ return role;
+ }
+
+ @Override
+ public EdmAnnotations getAnnotations() throws EdmException {
+ return annotations;
+ }
+
+ public void setEntitySetName(String entitySetName) {
+ this.entitySetName = entitySetName;
+ }
+
+ /**
+ * @return the entitySetName
+ */
+ public String getEntitySetName() {
+ return entitySetName;
+ }
+
+ /**
+ * @param entitySet the entitySet to set
+ */
+ public void setEntitySet(EdmEntitySet entitySet) {
+ this.entitySet = entitySet;
+ }
+
+ @Override
+ public String toString() {
+ return String.format(end.toString());
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAssociationSetImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAssociationSetImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAssociationSetImpl.java
new file mode 100644
index 0000000..4df79b7
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmAssociationSetImpl.java
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * 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.client.core.edm.Impl;
+
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
+import org.apache.olingo.odata2.api.edm.EdmAnnotations;
+import org.apache.olingo.odata2.api.edm.EdmAssociation;
+import org.apache.olingo.odata2.api.edm.EdmAssociationSet;
+import org.apache.olingo.odata2.api.edm.EdmAssociationSetEnd;
+import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.FullQualifiedName;
+import org.apache.olingo.odata2.client.api.edm.EdmDocumentation;
+
+/**
+ * Objects of this class represent AssociationSet
+ *
+ */
+public class EdmAssociationSetImpl extends EdmNamedImpl implements EdmAssociationSet, EdmAnnotatable {
+
+ private EdmEntityContainer edmEntityContainer;
+ private EdmAnnotations annotations;
+ private FullQualifiedName associationSetFQName;
+ private EdmAssociationSetEnd end2;
+ private EdmAssociationSetEnd end1;
+ private EdmDocumentation documentation;
+
+
+ public FullQualifiedName getAssociationSetFQName() {
+ return associationSetFQName ;
+ }
+ public void setDocumentation(EdmDocumentation documentation) {
+ this.documentation = documentation;
+ }
+
+ @Override
+ public EdmAssociation getAssociation() throws EdmException {
+ EdmAssociation association =
+ edm.getAssociation(this.associationSetFQName.getNamespace(),
+ this.associationSetFQName.getName());
+ if (association == null) {
+ throw new EdmException(EdmException.ASSOCIATIONNOTFOUND);
+ }
+ return association;
+ }
+
+ /**
+ * @param annotations the annotations to set
+ */
+ public void setAnnotations(EdmAnnotations annotations) {
+ this.annotations = annotations;
+ }
+
+ /**
+ * @param edmEntityContainer the edmEntityContainer to set
+ */
+ public void setEdmEntityContainer(EdmEntityContainer edmEntityContainer) {
+ this.edmEntityContainer = edmEntityContainer;
+ }
+
+ @Override
+ public EdmAssociationSetEnd getEnd(final String role) throws EdmException {
+ EdmAssociationSetEnd end;
+ if (end1.getRole().equals(role)) {
+ end = this.end1;
+ } else if (end2.getRole().equals(role)) {
+ end = this.end2;
+ } else {
+ return null;
+ }
+ EdmEntitySet entitySet = edmEntityContainer.getEntitySet(((EdmAssociationSetEndImpl)end).getEntitySetName());
+ if (entitySet == null) {
+ throw new EdmException(EdmException.COMMON);//TODO
+ }
+ return end;
+ }
+
+ @Override
+ public EdmEntityContainer getEntityContainer() throws EdmException {
+ return edmEntityContainer;
+ }
+
+ @Override
+ public EdmAnnotations getAnnotations() throws EdmException {
+ return annotations;
+ }
+
+ public void setAssociation(FullQualifiedName associationSetFQName) {
+ this.associationSetFQName = associationSetFQName;
+ }
+
+ public void setEnd1(EdmAssociationSetEnd end1) {
+ this.end1 = end1;
+ }
+
+ public void setEnd2(EdmAssociationSetEnd end2) {
+ this.end2 = end2;
+ }
+
+ /**
+ * @return the end2
+ */
+ public EdmAssociationSetEnd getEnd2() {
+ return end2;
+ }
+
+ /**
+ * @return the end1
+ */
+ public EdmAssociationSetEnd getEnd1() {
+ return end1;
+ }
+
+ @Override
+ public String toString() {
+ return associationSetFQName.getNamespace() + Edm.DELIMITER + associationSetFQName.getName();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmComplexPropertyImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmComplexPropertyImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmComplexPropertyImpl.java
new file mode 100644
index 0000000..8d9692d
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmComplexPropertyImpl.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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.client.core.edm.Impl;
+
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmType;
+
+/**
+ * Objects of this class represent ComplexProperty
+ */
+public class EdmComplexPropertyImpl extends EdmPropertyImpl {
+
+
+
+ @Override
+ public EdmType getType() throws EdmException {
+ if (edmType == null) {
+ edmType = edm.getComplexType(typeName.getNamespace(), typeName.getName());
+ }
+ if (edmType == null) {
+ throw new EdmException(EdmException.TYPEPROBLEM);
+ }
+ return edmType;
+ }
+
+
+ public boolean isSimple() {
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ try {
+ return edmType.getNamespace()+ Edm.DELIMITER + edmType.getName();
+ } catch (EdmException e) { //NOPMD - suppressed
+ return null; //NOSONAR
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmComplexTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmComplexTypeImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmComplexTypeImpl.java
new file mode 100644
index 0000000..3fc7c1a
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmComplexTypeImpl.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.odata2.client.core.edm.Impl;
+
+import org.apache.olingo.odata2.api.edm.EdmComplexType;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmMapping;
+import org.apache.olingo.odata2.api.edm.EdmTypeKind;
+import org.apache.olingo.odata2.api.edm.FullQualifiedName;
+
+/**
+ * Objects of this class represent ComplexType
+ *
+ */
+public class EdmComplexTypeImpl extends EdmStructuralTypeImpl implements EdmComplexType{
+
+ private boolean isAbstract;
+
+ private FullQualifiedName baseType;
+ private EdmMapping mapping;
+
+ public EdmMapping getMapping() {
+ return mapping;
+ }
+ public void setMapping(EdmMapping mapping) {
+ this.mapping = mapping;
+ }
+ public void setAbstract(boolean isAbstract) {
+ this.isAbstract = isAbstract;
+ }
+ @Override
+ public EdmComplexType getBaseType() throws EdmException {
+ if(edmBaseType!=null){
+ return (EdmComplexTypeImpl) edmBaseType;
+ } else {
+ return null;
+ }
+ }
+ public FullQualifiedName getEdmBaseTypeName() {
+ return baseType;
+ }
+ public void setBaseTypeName(FullQualifiedName baseType) {
+ this.baseType = baseType;
+ }
+
+ public boolean isAbstract() {
+ return isAbstract;
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+
+ @Override
+ public EdmTypeKind getKind() {
+ return EdmTypeKind.COMPLEX;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmCustomizableFeedMappingsImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmCustomizableFeedMappingsImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmCustomizableFeedMappingsImpl.java
new file mode 100644
index 0000000..180cb47
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmCustomizableFeedMappingsImpl.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * 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.client.core.edm.Impl;
+
+import org.apache.olingo.odata2.api.edm.EdmContentKind;
+import org.apache.olingo.odata2.api.edm.EdmCustomizableFeedMappings;
+
+/**
+ * Objects of this class represent customizable feed mappings.
+ *
+ */
+public class EdmCustomizableFeedMappingsImpl implements EdmCustomizableFeedMappings {
+
+ private Boolean fcKeepInContent;
+ private EdmContentKind fcContentKind;
+ private String fcNsPrefix;
+ private String fcNsUri;
+ private String fcSourcePath;
+ private String fcTargetPath;
+
+ @Override
+ public Boolean isFcKeepInContent() {
+ return fcKeepInContent;
+ }
+
+ @Override
+ public EdmContentKind getFcContentKind() {
+ return fcContentKind;
+ }
+
+ @Override
+ public String getFcNsPrefix() {
+ return fcNsPrefix;
+ }
+
+ @Override
+ public String getFcNsUri() {
+ return fcNsUri;
+ }
+
+ @Override
+ public String getFcSourcePath() {
+ return fcSourcePath;
+ }
+
+ @Override
+ public String getFcTargetPath() {
+ return fcTargetPath;
+ }
+
+ /**
+ * @return <b>boolean</b>
+ */
+ public Boolean getFcKeepInContent() {
+ return fcKeepInContent;
+ }
+
+ /**
+ * Sets if this is kept in content.
+ * @param fcKeepInContent
+ * @return {@link EdmCustomizableFeedMappingsImpl} for method chaining
+ */
+ public EdmCustomizableFeedMappingsImpl setFcKeepInContent(final Boolean fcKeepInContent) {
+ this.fcKeepInContent = fcKeepInContent;
+ return this;
+ }
+
+ /**
+ * Sets the {@link EdmContentKind}.
+ * @param fcContentKind
+ * @return {@link EdmCustomizableFeedMappingsImpl} for method chaining
+ */
+ public EdmCustomizableFeedMappingsImpl setFcContentKind(final EdmContentKind fcContentKind) {
+ this.fcContentKind = fcContentKind;
+ return this;
+ }
+
+ /**
+ * Sets the prefix.
+ * @param fcNsPrefix
+ * @return {@link EdmCustomizableFeedMappingsImpl} for method chaining
+ */
+ public EdmCustomizableFeedMappingsImpl setFcNsPrefix(final String fcNsPrefix) {
+ this.fcNsPrefix = fcNsPrefix;
+ return this;
+ }
+
+ /**
+ * Sets the Uri.
+ * @param fcNsUri
+ * @return {@link EdmCustomizableFeedMappingsImpl} for method chaining
+ */
+ public EdmCustomizableFeedMappingsImpl setFcNsUri(final String fcNsUri) {
+ this.fcNsUri = fcNsUri;
+ return this;
+ }
+
+ /**
+ * Sets the source path.
+ * @param fcSourcePath
+ * @return {@link EdmCustomizableFeedMappingsImpl} for method chaining
+ */
+ public EdmCustomizableFeedMappingsImpl setFcSourcePath(final String fcSourcePath) {
+ this.fcSourcePath = fcSourcePath;
+ return this;
+ }
+
+ /**
+ * <p>Sets the target path.</p>
+ * <p>For standard Atom elements, constants are available in {@link org.apache.olingo.odata2.api.edm.EdmTargetPath
+ * EdmTargetPath}.</p>
+ * @param fcTargetPath
+ * @return {@link EdmCustomizableFeedMappingsImpl} for method chaining
+ */
+ public EdmCustomizableFeedMappingsImpl setFcTargetPath(final String fcTargetPath) {
+ this.fcTargetPath = fcTargetPath;
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ return String.format(fcNsPrefix + " " + fcNsUri);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmDocumentationImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmDocumentationImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmDocumentationImpl.java
new file mode 100644
index 0000000..f65c4ba
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmDocumentationImpl.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.odata2.client.core.edm.Impl;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.edm.EdmAnnotationAttribute;
+import org.apache.olingo.odata2.api.edm.EdmAnnotationElement;
+import org.apache.olingo.odata2.client.api.edm.EdmDocumentation;
+
+/**
+ * Objects of this class represent documentation
+ *
+ */
+public class EdmDocumentationImpl implements EdmDocumentation{
+
+ private String summary;
+ private String longDescription;
+ private List<EdmAnnotationAttribute> annotationAttributes;
+ private List<EdmAnnotationElement> annotationElements;
+
+ /**
+ * @return <b>String</b> summary
+ */
+ public String getSummary() {
+ return summary;
+ }
+
+ /**
+ * @return <b>String</b> the long description
+ */
+ public String getLongDescription() {
+ return longDescription;
+ }
+
+ /**
+ * @return collection of {@link EdmAnnotationAttributeImpl} annotation attributes
+ */
+ public List<EdmAnnotationAttribute> getAnnotationAttributes() {
+ return annotationAttributes;
+ }
+
+ /**
+ * @return collection of {@link AnnotationElement} annotation elements
+ */
+ public List<EdmAnnotationElement> getAnnotationElements() {
+ return annotationElements;
+ }
+
+ /**
+ * Sets the summary for this {@link EdmDocumentationImpl}
+ * @param summary
+ * @return {@link EdmDocumentationImpl} for method chaining
+ */
+ public EdmDocumentationImpl setSummary(final String summary) {
+ this.summary = summary;
+ return this;
+ }
+
+ /**
+ * Sets the long description for this {@link EdmDocumentationImpl}
+ * @param longDescription
+ * @return {@link EdmDocumentationImpl} for method chaining
+ */
+ public EdmDocumentationImpl setLongDescription(final String longDescription) {
+ this.longDescription = longDescription;
+ return this;
+ }
+
+ /**
+ * Sets the collection of {@link EdmAnnotationAttributeImpl} for this {@link EdmDocumentationImpl}
+ * @param annotationAttributes
+ * @return {@link EdmDocumentationImpl} for method chaining
+ */
+ public EdmDocumentationImpl setAnnotationAttributes(final List<EdmAnnotationAttribute> annotationAttributes) {
+ this.annotationAttributes = annotationAttributes;
+ return this;
+ }
+
+ /**
+ * Sets the collection of {@link AnnotationElement} for this {@link EdmDocumentationImpl}
+ * @param annotationElements
+ * @return {@link EdmDocumentationImpl} for method chaining
+ */
+ public EdmDocumentationImpl setAnnotationElements(final List<EdmAnnotationElement> annotationElements) {
+ this.annotationElements = annotationElements;
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ return String.format(summary);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmElementImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmElementImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmElementImpl.java
new file mode 100644
index 0000000..480af98
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmElementImpl.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.client.core.edm.Impl;
+
+import org.apache.olingo.odata2.api.edm.EdmElement;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmFacets;
+import org.apache.olingo.odata2.api.edm.EdmMapping;
+
+/**
+ * Objects of this class represent EdmElement
+ */
+public abstract class EdmElementImpl extends EdmTypedImpl implements EdmElement {
+
+ private EdmFacets edmFacets;
+ private EdmMapping edmMapping;
+
+ @Override
+ public EdmMapping getMapping() throws EdmException {
+ return edmMapping;
+ }
+
+ public void setFacets(EdmFacets edmFacets) {
+ this.edmFacets = edmFacets;
+ }
+
+ public void setMapping(EdmMapping edmMapping) {
+ this.edmMapping = edmMapping;
+ }
+
+ @Override
+ public EdmFacets getFacets() throws EdmException {
+ return edmFacets;
+ }
+ @Override
+ public String toString() {
+ return String.format(name);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmEntityContainerImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmEntityContainerImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmEntityContainerImpl.java
new file mode 100644
index 0000000..bed4d44
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmEntityContainerImpl.java
@@ -0,0 +1,222 @@
+/*******************************************************************************
+ * 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.client.core.edm.Impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
+import org.apache.olingo.odata2.api.edm.EdmAnnotations;
+import org.apache.olingo.odata2.api.edm.EdmAssociation;
+import org.apache.olingo.odata2.api.edm.EdmAssociationSet;
+import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmFunctionImport;
+import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.exception.ODataException;
+import org.apache.olingo.odata2.client.api.edm.ClientEdm;
+import org.apache.olingo.odata2.client.api.edm.EdmDocumentation;
+
+/**
+ * Objects of this class represent EdmEntityContainer
+ */
+public class EdmEntityContainerImpl implements EdmEntityContainer, EdmAnnotatable {
+
+ private EdmImpl edm;
+ private List<EdmEntityContainer> entityContainerHierachy;
+ private List<EdmEntitySet> edmEntitySets;
+ private Map<String, EdmAssociationSet> edmAssociationSetMap;
+ private List<EdmAssociationSet> edmAssociationSets;
+ private List<EdmFunctionImport> edmFunctionImports;
+ private EdmEntityContainer edmExtendedEntityContainer;
+ private boolean isDefaultContainer;
+ private EdmAnnotations annotations;
+ private EdmDocumentation documentation;
+ private String name;
+ private String extendz;
+
+ public Map<String, EdmAssociationSet> getEdmAssociationSetMap() {
+ return edmAssociationSetMap;
+ }
+
+ public void setEdmAssociationSetMap(Map<String, EdmAssociationSet> associationSetMap) {
+ this.edmAssociationSetMap = associationSetMap;
+ }
+
+ public EdmDocumentation getDocumentation() {
+ return documentation;
+ }
+
+ public void setDocumentation(EdmDocumentation documentation) {
+ this.documentation = documentation;
+ }
+
+ public void setEdm(EdmImpl edm) {
+ this.edm = edm;
+ }
+
+ public ClientEdm getEdm() {
+ return edm;
+ }
+
+ public EdmEntityContainer getEdmExtendedEntityContainer() {
+ return edmExtendedEntityContainer;
+ }
+
+ public void setEdmExtendedEntityContainer(EdmEntityContainer edmExtendedEntityContainer) {
+ this.edmExtendedEntityContainer = edmExtendedEntityContainer;
+ }
+
+ public void setEntityContainerHierachy(List<EdmEntityContainer> entityContainerHierachy) {
+ this.entityContainerHierachy = entityContainerHierachy;
+ }
+
+ public String getExtendz() {
+ return extendz;
+ }
+
+ public void setExtendz(String extendz) {
+ this.extendz = extendz;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setAnnotations(EdmAnnotations annotations) {
+ this.annotations = annotations;
+ }
+ public EdmEntityContainerImpl(final EdmImpl edm)
+ throws EdmException {
+ this.edm = edm;
+ edmEntitySets = new ArrayList<EdmEntitySet>();
+ edmAssociationSets = new ArrayList<EdmAssociationSet>();
+ edmFunctionImports = new ArrayList<EdmFunctionImport>();
+ }
+
+ public boolean isDefaultContainer() {
+ return isDefaultContainer;
+ }
+
+ public void setDefaultContainer(boolean isDefaultContainer) {
+ this.isDefaultContainer = isDefaultContainer;
+ }
+ @Override
+ public String getName() throws EdmException {
+ return name;
+ }
+
+ @Override
+ public EdmEntitySet getEntitySet(final String name) throws EdmException {
+ EdmEntitySet edmEntitySet = null;
+ for(EdmEntitySet entity:edmEntitySets){
+ if(name.equals(entity.getName())){
+ edmEntitySet = entity;
+
+ }
+ }
+ return edmEntitySet;
+
+ }
+
+ @Override
+ public EdmFunctionImport getFunctionImport(final String name) throws EdmException {
+ for (EdmFunctionImport edmFunctionImport : edmFunctionImports) {
+ if (edmFunctionImport.getName().equalsIgnoreCase(name)) {
+ return edmFunctionImport;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public EdmAssociationSet getAssociationSet(final EdmEntitySet sourceEntitySet,
+ final EdmNavigationProperty navigationProperty) throws EdmException {
+ EdmAssociation edmAssociation = navigationProperty.getRelationship();
+ String association = edmAssociation.getNamespace() + "." + edmAssociation.getName();
+ String entitySetName = sourceEntitySet.getName();
+ String entitySetFromRole = navigationProperty.getFromRole();
+
+ String key = entitySetName + ">>" + association + ">>" + entitySetFromRole;
+
+ for (Entry<String, EdmAssociationSet> edmAssociationSet : edmAssociationSetMap.entrySet()) {
+ if (edmAssociationSet.getKey().equalsIgnoreCase(key)) {
+ return edmAssociationSet.getValue();
+ }
+ }
+ return null;
+
+ }
+
+ @Override
+ public boolean isDefaultEntityContainer() {
+ return isDefaultContainer;
+ }
+
+ @Override
+ public EdmAnnotations getAnnotations() throws EdmException {
+ return annotations;
+ }
+
+ @Override
+ public List<EdmEntitySet> getEntitySets() throws EdmException {
+ return edmEntitySets;
+ }
+
+
+
+ @Override
+ public List<EdmAssociationSet> getAssociationSets() throws EdmException {
+ return edmAssociationSets;
+ }
+
+ public List<EdmEntitySet> getEdmEntitySets() {
+ return edmEntitySets;
+ }
+
+ public EdmEntityContainerImpl setEdmEntitySets( List<EdmEntitySet> edmEntitySets) {
+ this.edmEntitySets = edmEntitySets;
+ return this;
+ }
+
+ public List<EdmAssociationSet> getEdmAssociationSets() {
+ return edmAssociationSets;
+ }
+
+ public EdmEntityContainerImpl setEdmAssociationSets(List<EdmAssociationSet> edmAssociationSets) {
+ this.edmAssociationSets = edmAssociationSets;
+ return this;
+ }
+
+ public List<EdmFunctionImport> getEdmFunctionImports() {
+ return edmFunctionImports;
+ }
+
+ public EdmEntityContainerImpl setEdmFunctionImports(List<EdmFunctionImport> edmFunctionImports) {
+ this.edmFunctionImports = edmFunctionImports;
+ return this;
+ }
+ @Override
+ public String toString() {
+ return String.format(name);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmEntitySetImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmEntitySetImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmEntitySetImpl.java
new file mode 100644
index 0000000..103ab0a
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmEntitySetImpl.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * 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.client.core.edm.Impl;
+
+import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
+import org.apache.olingo.odata2.api.edm.EdmAnnotations;
+import org.apache.olingo.odata2.api.edm.EdmAssociationSet;
+import org.apache.olingo.odata2.api.edm.EdmAssociationSetEnd;
+import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmMapping;
+import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.edm.FullQualifiedName;
+import org.apache.olingo.odata2.client.api.edm.EdmDocumentation;
+
+/**
+ * Objects of this class represent EdmEntitySet
+ *
+ */
+public class EdmEntitySetImpl extends EdmNamedImpl implements EdmEntitySet, EdmAnnotatable {
+
+ private EdmEntityContainer edmEntityContainer;
+ private EdmEntityType edmEntityType;
+ private EdmAnnotationsImpl annotations;
+ private FullQualifiedName entityTypeName;
+
+ private EdmMapping mapping;
+ private EdmDocumentation documentation;
+
+
+ public FullQualifiedName getEntityTypeName() {
+ return entityTypeName;
+ }
+
+ public void setEntityTypeName(FullQualifiedName entityTypeName) {
+ this.entityTypeName = entityTypeName;
+ }
+
+ @Override
+ public EdmEntityType getEntityType() throws EdmException {
+ return edmEntityType;
+ }
+
+ public EdmEntityContainer getEdmEntityContainer() {
+ return edmEntityContainer;
+ }
+
+ public void setEdmEntityContainer(EdmEntityContainer edmEntityContainer) {
+ this.edmEntityContainer = edmEntityContainer;
+ }
+
+ public EdmEntityType getEdmEntityType() {
+ return edmEntityType;
+ }
+
+ public void setEdmEntityType(EdmEntityType edmEntityType) {
+ this.edmEntityType = edmEntityType;
+ }
+
+ public void setAnnotations(EdmAnnotationsImpl annotations) {
+ this.annotations = annotations;
+ }
+
+ public EdmDocumentation getDocumentation() {
+ return documentation;
+ }
+
+ public void setDocumentation(EdmDocumentation documentation) {
+ this.documentation = documentation;
+ }
+
+ public void setMapping(EdmMapping mapping) {
+ this.mapping = mapping;
+ }
+
+ @Override
+ public EdmEntitySet getRelatedEntitySet(final EdmNavigationProperty navigationProperty) throws EdmException {
+ EdmAssociationSet associationSet =
+ edmEntityContainer.getAssociationSet(edmEntityContainer.getEntitySet(name), navigationProperty);
+ if(associationSet == null){
+ return null;
+ }
+ EdmAssociationSetEnd toEnd = associationSet.getEnd(navigationProperty.getToRole());
+ if (toEnd == null) {
+ throw new EdmException(EdmException.NAVIGATIONPROPERTYNOTFOUND,navigationProperty.getName());
+ }
+ EdmEntitySet targetEntitySet = toEnd.getEntitySet();
+ if (targetEntitySet == null) {
+ throw new EdmException(EdmException.NAVIGATIONPROPERTYNOTFOUND,navigationProperty.getName());
+ }
+ return targetEntitySet;
+ }
+
+ @Override
+ public EdmEntityContainer getEntityContainer() throws EdmException {
+ return edmEntityContainer;
+ }
+
+ @Override
+ public EdmAnnotations getAnnotations() throws EdmException {
+ return annotations;
+ }
+
+ @Override
+ public EdmMapping getMapping() throws EdmException {
+ return mapping;
+ }
+
+ public void setEdmEntityTypeName(FullQualifiedName fqName) {
+ this.entityTypeName = fqName;
+ }
+
+ @Override
+ public String toString() {
+ return String.format(name);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmEntityTypeImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmEntityTypeImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmEntityTypeImpl.java
new file mode 100644
index 0000000..d4f1032
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmEntityTypeImpl.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * 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.client.core.edm.Impl;
+
+import java.util.List;
+
+import org.apache.olingo.odata2.api.edm.Edm;
+import org.apache.olingo.odata2.api.edm.EdmCustomizableFeedMappings;
+import org.apache.olingo.odata2.api.edm.EdmEntityType;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmNavigationProperty;
+import org.apache.olingo.odata2.api.edm.EdmProperty;
+import org.apache.olingo.odata2.api.edm.EdmTyped;
+import org.apache.olingo.odata2.api.edm.FullQualifiedName;
+
+/**
+ * Objects of this class represent EdmEntityType
+ *
+ */
+public class EdmEntityTypeImpl extends EdmStructuralTypeImpl implements EdmEntityType {
+
+ private List<EdmProperty> edmKeyProperties;
+ private List<String> edmKeyPropertyNames;
+ private List<EdmNavigationProperty> navigationProperties;
+ private List<String> edmNavigationPropertyNames;
+ private boolean hasStream;
+ private boolean isAbstract;
+ private FullQualifiedName baseType;
+ private EdmCustomizableFeedMappings customizableFeedMappings;
+
+ public void setBaseType(FullQualifiedName baseType) {
+ this.baseType = baseType;
+ }
+
+ public void setAbstract(boolean isAbstract) {
+ this.isAbstract = isAbstract;
+ }
+
+ public void setEdmKeyProperties(List<EdmProperty> edmKeyProperties) {
+ this.edmKeyProperties = edmKeyProperties;
+ }
+
+ public void setNavigationProperties(List<EdmNavigationProperty> navigationProperties) {
+ this.navigationProperties = navigationProperties;
+ }
+
+ public void setEdmNavigationPropertyNames(List<String> edmNavigationPropertyNames) {
+ this.edmNavigationPropertyNames = edmNavigationPropertyNames;
+ }
+
+ public void setHasStream(boolean hasStream) {
+ this.hasStream = hasStream;
+ }
+
+ @Override
+ public List<String> getKeyPropertyNames() throws EdmException {
+ return edmKeyPropertyNames;
+ }
+
+ public void setEdmKeyPropertyNames(List<String> edmKeyPropertyNames) {
+ this.edmKeyPropertyNames = edmKeyPropertyNames;
+ }
+
+ @Override
+ public List<EdmProperty> getKeyProperties() throws EdmException {
+ return edmKeyProperties;
+ }
+
+ @Override
+ public boolean hasStream() throws EdmException {
+ return hasStream;
+ }
+
+ @Override
+ public EdmCustomizableFeedMappings getCustomizableFeedMappings() throws EdmException {
+ return customizableFeedMappings;
+ }
+
+ @Override
+ public List<String> getNavigationPropertyNames() throws EdmException {
+ return edmNavigationPropertyNames;
+ }
+
+ @Override
+ public EdmEntityType getBaseType() throws EdmException {
+ return (EdmEntityType) edmBaseType;
+ }
+
+ public FullQualifiedName getBaseTypeName() throws EdmException {
+ return baseType;
+ }
+
+ @Override
+ protected EdmTyped getPropertyInternal(final String name) throws EdmException {
+ EdmTyped edmProperty = super.getPropertyInternal(name);
+
+ if (edmProperty != null) {
+ return edmProperty;
+ }
+ for (EdmNavigationProperty navigations : navigationProperties) {
+ if (navigations.getName().equals(name)) {
+ return navigations;
+ }
+ }
+ return edmProperty;
+ }
+
+ public void setCustomizableFeedMappings(EdmCustomizableFeedMappings edmCustomizableFeedMappings) {
+ this.customizableFeedMappings = edmCustomizableFeedMappings;
+ }
+
+ @Override
+ public String toString() {
+ return String.format(namespace+ Edm.DELIMITER +name);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata2/blob/9e949e40/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmFunctionImportImpl.java
----------------------------------------------------------------------
diff --git a/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmFunctionImportImpl.java b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmFunctionImportImpl.java
new file mode 100644
index 0000000..8521ad7
--- /dev/null
+++ b/odata2-lib/odata-client-core/src/main/java/org/apache/olingo/odata2/client/core/edm/Impl/EdmFunctionImportImpl.java
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * 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.client.core.edm.Impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.olingo.odata2.api.edm.EdmAnnotatable;
+import org.apache.olingo.odata2.api.edm.EdmAnnotations;
+import org.apache.olingo.odata2.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
+import org.apache.olingo.odata2.api.edm.EdmException;
+import org.apache.olingo.odata2.api.edm.EdmFunctionImport;
+import org.apache.olingo.odata2.api.edm.EdmMapping;
+import org.apache.olingo.odata2.api.edm.EdmParameter;
+import org.apache.olingo.odata2.api.edm.EdmTyped;
+import org.apache.olingo.odata2.client.api.edm.EdmDocumentation;
+
+/**
+ * Objects of this class represent EdmFunctionImport
+ */
+public class EdmFunctionImportImpl extends EdmNamedImpl implements EdmFunctionImport, EdmAnnotatable {
+
+ private EdmEntityContainer edmEntityContainer;
+ private Map<String, EdmParameter> edmParameters;
+ private Map<String, ArrayList<EdmFunctionImportParameter>> parameters;
+ private List<String> parametersList;
+ private EdmAnnotations annotations;
+ private EdmTyped edmReturnType;
+ private String entitySet;
+ private String httpMethod;
+ private EdmMapping mapping;
+ private EdmDocumentation documentation;
+
+ public EdmTyped getEdmReturnType() {
+ return edmReturnType;
+ }
+
+ public void setEdmReturnType(EdmTyped edmReturnType) {
+ this.edmReturnType = edmReturnType;
+ }
+
+ public EdmDocumentation getDocumentation() {
+ return documentation;
+ }
+
+ public void setDocumentation(EdmDocumentation documentation) {
+ this.documentation = documentation;
+ }
+
+ public void setMapping(EdmMapping mapping) {
+ this.mapping = mapping;
+ }
+
+ /**
+ * @param returnType the returnType to set
+ */
+ public void setReturnType(EdmTyped returnType) {
+ this.edmReturnType = returnType;
+ }
+
+ /**
+ * @param edmEntitySet the entitySet to set
+ */
+ public void setEntitySet(String edmEntitySet) {
+ this.entitySet = edmEntitySet;
+ }
+
+ /**
+ * @param httpMethod the httpMethod to set
+ */
+ public void setHttpMethod(String httpMethod) {
+ this.httpMethod = httpMethod;
+ }
+
+ public EdmEntityContainer getEdmEntityContainer() {
+ return edmEntityContainer;
+ }
+
+ public void setEdmEntityContainer(EdmEntityContainer edmEntityContainer) {
+ this.edmEntityContainer = edmEntityContainer;
+ }
+
+ public Map<String, EdmParameter> getEdmParameters() {
+ return edmParameters;
+ }
+
+ public void setEdmParameters(Map<String, EdmParameter> edmParameters) {
+ this.edmParameters = edmParameters;
+ }
+
+ public Map<String, ArrayList<EdmFunctionImportParameter>> getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(Map<String, ArrayList<EdmFunctionImportParameter>> parameters) {
+ this.parameters = parameters;
+ }
+
+ public List<String> getParametersList() {
+ return parametersList;
+ }
+
+ public void setParametersList(List<String> parametersList) {
+ this.parametersList = parametersList;
+ }
+
+ public void setAnnotations(EdmAnnotations annotations) {
+ this.annotations = annotations;
+ }
+
+ @Override
+ public EdmParameter getParameter(final String name) throws EdmException {
+ for (Entry<String, EdmParameter> param : edmParameters.entrySet()) {
+ if (param.getKey().equalsIgnoreCase(name)) {
+ return param.getValue();
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public List<String> getParameterNames() throws EdmException {
+ return parametersList;
+ }
+
+ @Override
+ public EdmEntitySet getEntitySet() throws EdmException {
+ return edmEntityContainer.getEntitySet(entitySet);
+ }
+
+ @Override
+ public String getHttpMethod() throws EdmException {
+ return this.httpMethod;
+ }
+
+ @Override
+ public EdmTyped getReturnType() throws EdmException {
+ return edmReturnType;
+ }
+
+ @Override
+ public EdmEntityContainer getEntityContainer() throws EdmException {
+ return edmEntityContainer;
+ }
+
+ @Override
+ public EdmAnnotations getAnnotations() throws EdmException {
+ return annotations;
+ }
+
+ @Override
+ public EdmMapping getMapping() throws EdmException {
+ return mapping;
+ }
+ @Override
+ public String toString() {
+ return String.format(name);
+ }
+
+}