You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by il...@apache.org on 2014/03/07 10:08:54 UTC
[05/57] [abbrv] [OLINGO-169] First huge import from ODataJClient: for
the moment,
it just build (no tests yet) and dummy Edm interfaces are used instead of the
ones from commons-api
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/SchemaDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/SchemaDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/SchemaDeserializer.java
new file mode 100644
index 0000000..cd622ce
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/SchemaDeserializer.java
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.data.impl;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.edm.AbstractSchema;
+import org.apache.olingo.odata4.client.core.edm.v3.AssociationImpl;
+import org.apache.olingo.odata4.client.core.edm.v3.UsingImpl;
+import org.apache.olingo.odata4.client.core.edm.v3.ValueTermImpl;
+import org.apache.olingo.odata4.client.core.edm.v4.ActionImpl;
+import org.apache.olingo.odata4.client.core.edm.v4.AnnotationImpl;
+import org.apache.olingo.odata4.client.core.edm.v4.FunctionImpl;
+import org.apache.olingo.odata4.client.core.edm.v4.TypeDefinitionImpl;
+import org.apache.olingo.odata4.commons.api.edm.constants.ODataServiceVersion;
+
+@SuppressWarnings("rawtypes")
+public class SchemaDeserializer extends AbstractEdmDeserializer<AbstractSchema> {
+
+ @Override
+ protected AbstractSchema doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final AbstractSchema schema = ODataServiceVersion.V30 == client.getServiceVersion()
+ ? new org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl()
+ : new org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Namespace".equals(jp.getCurrentName())) {
+ schema.setNamespace(jp.nextTextValue());
+ } else if ("Alias".equals(jp.getCurrentName())) {
+ schema.setAlias(jp.nextTextValue());
+ } else if ("Using".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) schema).
+ getUsings().add(jp.getCodec().readValue(jp, UsingImpl.class));
+ } else if ("Association".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) schema).
+ getAssociations().add(jp.getCodec().readValue(jp, AssociationImpl.class));
+ } else if ("ComplexType".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (schema instanceof org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) {
+ ((org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) schema).
+ getComplexTypes().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v3.ComplexTypeImpl.class));
+ } else {
+ ((org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl) schema).
+ getComplexTypes().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v4.ComplexTypeImpl.class));
+ }
+ } else if ("EntityType".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (schema instanceof org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) {
+ ((org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) schema).
+ getEntityTypes().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v3.EntityTypeImpl.class));
+ } else {
+ ((org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl) schema).
+ getEntityTypes().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v4.EntityTypeImpl.class));
+ }
+ } else if ("EnumType".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (schema instanceof org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) {
+ ((org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) schema).
+ getEnumTypes().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v3.EnumTypeImpl.class));
+ } else {
+ ((org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl) schema).
+ getEnumTypes().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v4.EnumTypeImpl.class));
+ }
+ } else if ("ValueTerm".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) schema).
+ getValueTerms().add(jp.getCodec().readValue(jp, ValueTermImpl.class));
+ } else if ("EntityContainer".equals(jp.getCurrentName())) {
+ jp.nextToken();
+
+ if (schema instanceof org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) {
+ ((org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) schema).
+ getEntityContainers().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v3.EntityContainerImpl.class));
+ } else {
+ org.apache.olingo.odata4.client.core.edm.v4.EntityContainerImpl entityContainer
+ = jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v4.EntityContainerImpl.class);
+ entityContainer.setDefaultEntityContainer(true);
+ ((org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl) schema).
+ setEntityContainer(entityContainer);
+ }
+ } else if ("Annotations".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (schema instanceof org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) {
+ ((org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl) schema).getAnnotationsList().
+ add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v3.AnnotationsImpl.class));
+ } else {
+ ((org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl) schema).getAnnotationsList().
+ add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v4.AnnotationsImpl.class));
+ }
+ } else if ("Action".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl) schema).getActions().
+ add(jp.getCodec().readValue(jp, ActionImpl.class));
+ } else if ("Annotation".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl) schema).getAnnotations().
+ add(jp.getCodec().readValue(jp, AnnotationImpl.class));
+ } else if ("Function".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl) schema).getFunctions().
+ add(jp.getCodec().readValue(jp, FunctionImpl.class));
+ } else if ("TypeDefinition".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl) schema).
+ getTypeDefinitions().add(jp.getCodec().readValue(jp, TypeDefinitionImpl.class));
+ }
+ }
+ }
+
+ return schema;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataDeserializerImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataDeserializerImpl.java
new file mode 100644
index 0000000..962f4b7
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataDeserializerImpl.java
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.data.impl.v3;
+
+import java.io.InputStream;
+import org.apache.olingo.odata4.client.api.ODataClient;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractODataDeserializer;
+import org.apache.olingo.odata4.client.core.edm.v3.EdmxImpl;
+
+public class ODataDeserializerImpl extends AbstractODataDeserializer {
+
+ private static final long serialVersionUID = -8221085862548914611L;
+
+ public ODataDeserializerImpl(final ODataClient client) {
+ super(client);
+ }
+
+ @Override
+ public EdmxImpl toMetadata(final InputStream input) {
+ try {
+ return getXmlMapper().readValue(input, EdmxImpl.class);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Could not parse as Edmx document", e);
+ }
+ }
+
+// @Override
+// public AbstractServiceDocument toServiceDocument(final InputStream input, final ODataFormat format) {
+// try {
+// return format == ODataFormat.XML
+// ? getXmlMapper().readValue(input, XMLServiceDocument.class)
+// : getObjectMapper().readValue(input, JSONServiceDocument.class);
+// } catch (IOException e) {
+// throw new IllegalArgumentException("Could not parse Service Document", e);
+// }
+// }
+//
+// @Override
+// protected JSONEntry toJSONEntry(final InputStream input) {
+// try {
+// return getObjectMapper().readValue(input, JSONEntry.class);
+// } catch (IOException e) {
+// throw new IllegalArgumentException("While deserializing JSON entry", e);
+// }
+// }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataReaderImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataReaderImpl.java
new file mode 100644
index 0000000..28898de
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataReaderImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.data.impl.v3;
+
+import java.io.InputStream;
+import org.apache.olingo.odata4.client.core.ODataV3Client;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractODataReader;
+import org.apache.olingo.odata4.client.core.edm.v3.EdmMetadataImpl;
+
+public class ODataReaderImpl extends AbstractODataReader {
+
+ private static final long serialVersionUID = -2481293269536406956L;
+
+ public ODataReaderImpl(final ODataV3Client client) {
+ super(client);
+ }
+
+ @Override
+ public EdmMetadataImpl readMetadata(final InputStream input) {
+ return new EdmMetadataImpl(client, input);
+ }
+
+// @Override
+// public ODataServiceDocument readServiceDocument(final InputStream input, final ODataFormat format) {
+// return ((ODataV3Client) client).getBinder().getODataServiceDocument(
+// ((ODataV3Client) client).getDeserializer().toServiceDocument(input, format));
+// }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataSerializerImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataSerializerImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataSerializerImpl.java
new file mode 100644
index 0000000..d13bca5
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v3/ODataSerializerImpl.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.data.impl.v3;
+
+import org.apache.olingo.odata4.client.api.ODataClient;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractODataSerializer;
+
+public class ODataSerializerImpl extends AbstractODataSerializer {
+
+ private static final long serialVersionUID = -8861908250297989806L;
+
+ public ODataSerializerImpl(final ODataClient client) {
+ super(client);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataDeserializerImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataDeserializerImpl.java
new file mode 100644
index 0000000..1b12016
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataDeserializerImpl.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.data.impl.v4;
+
+import java.io.InputStream;
+import org.apache.olingo.odata4.client.api.ODataClient;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractODataDeserializer;
+import org.apache.olingo.odata4.client.core.edm.v4.EdmxImpl;
+
+public class ODataDeserializerImpl extends AbstractODataDeserializer {
+
+ private static final long serialVersionUID = 8593081342440470415L;
+
+ public ODataDeserializerImpl(final ODataClient client) {
+ super(client);
+ }
+
+ @Override
+ public EdmxImpl toMetadata(final InputStream input) {
+ try {
+ return getXmlMapper().readValue(input, EdmxImpl.class);
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Could not parse as Edmx document", e);
+ }
+ }
+
+// @Override
+// public AbstractServiceDocument toServiceDocument(final InputStream input, final ODataFormat format) {
+// try {
+// return format == ODataFormat.XML
+// ? getXmlMapper().readValue(input, XMLServiceDocument.class)
+// : null;
+//// : getObjectMapper().readValue(input, JSONServiceDocument.class);
+// } catch (IOException e) {
+// throw new IllegalArgumentException("Could not parse Service Document", e);
+// }
+// }
+//
+// @Override
+// protected JSONEntry toJSONEntry(final InputStream input) {
+// try {
+// return getObjectMapper().readValue(input, JSONEntry.class);
+// } catch (IOException e) {
+// throw new IllegalArgumentException("While deserializing JSON entry", e);
+// }
+// }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataReaderImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataReaderImpl.java
new file mode 100644
index 0000000..10904ea
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataReaderImpl.java
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.data.impl.v4;
+
+import java.io.InputStream;
+import org.apache.olingo.odata4.client.core.ODataV4Client;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractODataReader;
+import org.apache.olingo.odata4.client.core.edm.v4.EdmMetadataImpl;
+
+public class ODataReaderImpl extends AbstractODataReader {
+
+ private static final long serialVersionUID = -2481293269536406956L;
+
+ public ODataReaderImpl(final ODataV4Client client) {
+ super(client);
+ }
+
+ @Override
+ public EdmMetadataImpl readMetadata(final InputStream input) {
+ return new EdmMetadataImpl(client, input);
+ }
+
+// @Override
+// public ODataServiceDocument readServiceDocument(final InputStream input, final ODataFormat format) {
+// return ((ODataV4Client) client).getBinder().getODataServiceDocument(
+// ((ODataV4Client) client).getDeserializer().toServiceDocument(input, format));
+// }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataSerializerImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataSerializerImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataSerializerImpl.java
new file mode 100644
index 0000000..a56afc1
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/data/impl/v4/ODataSerializerImpl.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.data.impl.v4;
+
+import org.apache.olingo.odata4.client.api.ODataClient;
+import org.apache.olingo.odata4.client.core.data.impl.AbstractODataSerializer;
+
+public class ODataSerializerImpl extends AbstractODataSerializer {
+
+ private static final long serialVersionUID = 7587265188399685309L;
+
+ public ODataSerializerImpl(final ODataClient client) {
+ super(client);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollectionBuilder.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollectionBuilder.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollectionBuilder.java
index 90733b2..30f048d 100644
--- a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollectionBuilder.java
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/deserializer/PropertyCollectionBuilder.java
@@ -34,9 +34,13 @@ import org.apache.olingo.odata4.client.api.deserializer.Value;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class PropertyCollectionBuilder extends PropertyCollection {
+ private static final Logger LOG = LoggerFactory.getLogger(PropertyCollectionBuilder.class);
+
private JsonParser parser;
private EntitySetImpl enclosingEntitySet;
@@ -95,10 +99,9 @@ public class PropertyCollectionBuilder extends PropertyCollection {
return true;
}
} catch (JsonParseException e) {
- // TODO: SLF4J Logging!
- e.printStackTrace();
+ LOG.error("While parsing", e);
} catch (IOException e) {
- e.printStackTrace();
+ LOG.error("While parsing", e);
}
return false;
@@ -193,7 +196,7 @@ public class PropertyCollectionBuilder extends PropertyCollection {
case VALUE_STRING:
enclosingEntitySet.addAnnotation(jp.getCurrentName(), jp.getValueAsString());
break;
-
+
default:
break;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractAnnotations.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractAnnotations.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractAnnotations.java
new file mode 100644
index 0000000..5d1d7a4
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractAnnotations.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.v3.Annotations;
+
+public abstract class AbstractAnnotations extends AbstractEdmItem implements Annotations {
+
+ private static final long serialVersionUID = 4926640428016042620L;
+
+ @JsonProperty(value = "Target", required = true)
+ private String target;
+
+ @JsonProperty("Qualifier")
+ private String qualifier;
+
+ public String getTarget() {
+ return target;
+ }
+
+ public void setTarget(final String target) {
+ this.target = target;
+ }
+
+ public String getQualifier() {
+ return qualifier;
+ }
+
+ public void setQualifier(final String qualifier) {
+ this.qualifier = qualifier;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractComplexType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractComplexType.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractComplexType.java
new file mode 100644
index 0000000..ebda229
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractComplexType.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.olingo.odata4.client.api.edm.ComplexType;
+import org.apache.olingo.odata4.client.core.data.impl.ComplexTypeDeserializer;
+
+@JsonDeserialize(using = ComplexTypeDeserializer.class)
+public abstract class AbstractComplexType extends AbstractEdmItem implements ComplexType {
+
+ private static final long serialVersionUID = -4765071294433482957L;
+
+ private String name;
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public void setName(final String name) {
+ this.name = name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractDataServices.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractDataServices.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractDataServices.java
new file mode 100644
index 0000000..feda3a5
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractDataServices.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.odata4.client.core.edm;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.List;
+
+@JsonDeserialize(using = DataServicesDeserializer.class)
+public abstract class AbstractDataServices<S extends AbstractSchema<EC, E, C, FI>, EC extends AbstractEntityContainer<
+ FI>, E extends AbstractEntityType, C extends AbstractComplexType, FI extends AbstractFunctionImport>
+ extends AbstractEdmItem {
+
+ private static final long serialVersionUID = -9126377222393876166L;
+
+ private String dataServiceVersion;
+
+ private String maxDataServiceVersion;
+
+ public String getDataServiceVersion() {
+ return dataServiceVersion;
+ }
+
+ public void setDataServiceVersion(final String dataServiceVersion) {
+ this.dataServiceVersion = dataServiceVersion;
+ }
+
+ public String getMaxDataServiceVersion() {
+ return maxDataServiceVersion;
+ }
+
+ public void setMaxDataServiceVersion(final String maxDataServiceVersion) {
+ this.maxDataServiceVersion = maxDataServiceVersion;
+ }
+
+ public abstract List<S> getSchemas();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmItem.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmItem.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmItem.java
new file mode 100644
index 0000000..da6dca9
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmItem.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+public abstract class AbstractEdmItem {
+
+ @Override
+ public boolean equals(final Object obj) {
+ return EqualsBuilder.reflectionEquals(this, obj);
+ }
+
+ @Override
+ public int hashCode() {
+ return HashCodeBuilder.reflectionHashCode(this);
+ }
+
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmMetadata.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmMetadata.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmMetadata.java
new file mode 100644
index 0000000..cf94a7b
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmMetadata.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.odata4.client.core.edm;
+
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.olingo.odata4.client.api.ODataClient;
+import org.apache.olingo.odata4.client.api.edm.EdmMetadata;
+
+/**
+ * Entry point for access information about EDM metadata.
+ */
+public abstract class AbstractEdmMetadata<
+ EDMX extends AbstractEdmx<DS, S, EC, E, C, FI>, DS extends AbstractDataServices<
+ S, EC, E, C, FI>, S extends AbstractSchema<EC, E, C, FI>, EC extends AbstractEntityContainer<
+ FI>, E extends AbstractEntityType, C extends AbstractComplexType, FI extends AbstractFunctionImport>
+ extends AbstractEdmItem implements EdmMetadata {
+
+ private static final long serialVersionUID = -1214173426671503187L;
+
+ protected final EDMX edmx;
+
+ protected final Map<String, S> schemaByNsOrAlias;
+
+ /**
+ * Constructor.
+ *
+ * @param client OData client
+ * @param inputStream source stream.
+ */
+ @SuppressWarnings("unchecked")
+ public AbstractEdmMetadata(final ODataClient client, final InputStream inputStream) {
+ edmx = (EDMX) client.getDeserializer().toMetadata(inputStream);
+
+ this.schemaByNsOrAlias = new HashMap<String, S>();
+ for (S schema : edmx.getDataServices().getSchemas()) {
+ this.schemaByNsOrAlias.put(schema.getNamespace(), schema);
+ if (StringUtils.isNotBlank(schema.getAlias())) {
+ this.schemaByNsOrAlias.put(schema.getAlias(), schema);
+ }
+ }
+ }
+
+ /**
+ * Checks whether the given key is a valid namespace or alias in the EdM metadata document.
+ *
+ * @param key namespace or alias
+ * @return true if key is valid namespace or alias
+ */
+ @Override
+ public boolean isNsOrAlias(final String key) {
+ return this.schemaByNsOrAlias.keySet().contains(key);
+ }
+
+ /**
+ * Returns the Schema at the specified position in the EdM metadata document.
+ *
+ * @param index index of the Schema to return
+ * @return the Schema at the specified position in the EdM metadata document
+ */
+ @Override
+ public S getSchema(final int index) {
+ return this.edmx.getDataServices().getSchemas().get(index);
+ }
+
+ /**
+ * Returns the Schema with the specified key (namespace or alias) in the EdM metadata document.
+ *
+ * @param key namespace or alias
+ * @return the Schema with the specified key in the EdM metadata document
+ */
+ @Override
+ public S getSchema(final String key) {
+ return this.schemaByNsOrAlias.get(key);
+ }
+
+ /**
+ * Returns all Schema objects defined in the EdM metadata document.
+ *
+ * @return all Schema objects defined in the EdM metadata document
+ */
+ @Override
+ public List<S> getSchemas() {
+ return this.edmx.getDataServices().getSchemas();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmx.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmx.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmx.java
new file mode 100644
index 0000000..3a379f2
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEdmx.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.olingo.odata4.client.api.edm.Edmx;
+
+@JsonDeserialize(using = EdmxDeserializer.class)
+public abstract class AbstractEdmx<DS extends AbstractDataServices<S, EC, E, C, FI>, S extends AbstractSchema<
+ EC, E, C, FI>, EC extends AbstractEntityContainer<
+ FI>, E extends AbstractEntityType, C extends AbstractComplexType, FI extends AbstractFunctionImport>
+ extends AbstractEdmItem implements Edmx {
+
+ private static final long serialVersionUID = -5480835122183091469L;
+
+ private String version;
+
+ private DS dataServices;
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(final String version) {
+ this.version = version;
+ }
+
+ public DS getDataServices() {
+ return dataServices;
+ }
+
+ public void setDataServices(final DS dataServices) {
+ this.dataServices = dataServices;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityContainer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityContainer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityContainer.java
new file mode 100644
index 0000000..588e0ea
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityContainer.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.EntityContainer;
+import org.apache.olingo.odata4.client.core.data.impl.EntityContainerDeserializer;
+
+@JsonDeserialize(using = EntityContainerDeserializer.class)
+public abstract class AbstractEntityContainer<FI extends AbstractFunctionImport>
+ extends AbstractEdmItem implements EntityContainer {
+
+ private static final long serialVersionUID = 4121974387552855032L;
+
+ private String name;
+
+ private String _extends;
+
+ private boolean lazyLoadingEnabled;
+
+ private boolean defaultEntityContainer;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getExtends() {
+ return _extends;
+ }
+
+ public void setExtends(final String _extends) {
+ this._extends = _extends;
+ }
+
+ public boolean isLazyLoadingEnabled() {
+ return lazyLoadingEnabled;
+ }
+
+ public void setLazyLoadingEnabled(final boolean lazyLoadingEnabled) {
+ this.lazyLoadingEnabled = lazyLoadingEnabled;
+ }
+
+ public boolean isDefaultEntityContainer() {
+ return defaultEntityContainer;
+ }
+
+ public void setDefaultEntityContainer(final boolean defaultEntityContainer) {
+ this.defaultEntityContainer = defaultEntityContainer;
+ }
+
+ public abstract List<? extends AbstractEntitySet> getEntitySets();
+
+ public abstract AbstractEntitySet getEntitySet(String name);
+
+ /**
+ * Gets the first function import with given name.
+ *
+ * @param name name.
+ * @return function import.
+ */
+ public FI getFunctionImport(final String name) {
+ final List<FI> funcImps = getFunctionImports(name);
+ return funcImps.isEmpty()
+ ? null
+ : funcImps.get(0);
+ }
+
+ /**
+ * Gets all function imports with given name.
+ *
+ * @param name name.
+ * @return function imports.
+ */
+ public List<FI> getFunctionImports(final String name) {
+ final List<FI> result = new ArrayList<FI>();
+ for (FI functionImport : getFunctionImports()) {
+ if (name.equals(functionImport.getName())) {
+ result.add(functionImport);
+ }
+ }
+ return result;
+ }
+
+ public abstract List<FI> getFunctionImports();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntitySet.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntitySet.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntitySet.java
new file mode 100644
index 0000000..bf01649
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntitySet.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.olingo.odata4.client.api.edm.EntitySet;
+import org.apache.olingo.odata4.client.core.data.impl.EntitySetDeserializer;
+
+@JsonDeserialize(using = EntitySetDeserializer.class)
+public abstract class AbstractEntitySet extends AbstractEdmItem implements EntitySet {
+
+ private static final long serialVersionUID = -6577263439520376420L;
+
+ private String name;
+
+ private String entityType;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getEntityType() {
+ return entityType;
+ }
+
+ public void setEntityType(final String entityType) {
+ this.entityType = entityType;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityType.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityType.java
new file mode 100644
index 0000000..3db1dd2
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEntityType.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.EntityType;
+import org.apache.olingo.odata4.client.core.data.impl.EntityTypeDeserializer;
+
+@JsonDeserialize(using = EntityTypeDeserializer.class)
+public abstract class AbstractEntityType extends AbstractComplexType implements EntityType {
+
+ private static final long serialVersionUID = -1579462552966168139L;
+
+ private boolean abstractEntityType = false;
+
+ private String baseType;
+
+ private boolean openType = false;
+
+ private boolean hasStream = false;
+
+ private EntityKeyImpl key;
+
+ public boolean isAbstractEntityType() {
+ return abstractEntityType;
+ }
+
+ public void setAbstractEntityType(final boolean abstractEntityType) {
+ this.abstractEntityType = abstractEntityType;
+ }
+
+ public String getBaseType() {
+ return baseType;
+ }
+
+ public void setBaseType(final String baseType) {
+ this.baseType = baseType;
+ }
+
+ public boolean isOpenType() {
+ return openType;
+ }
+
+ public void setOpenType(final boolean openType) {
+ this.openType = openType;
+ }
+
+ public EntityKeyImpl getKey() {
+ return key;
+ }
+
+ public void setKey(final EntityKeyImpl key) {
+ this.key = key;
+ }
+
+ public boolean isHasStream() {
+ return hasStream;
+ }
+
+ public void setHasStream(final boolean hasStream) {
+ this.hasStream = hasStream;
+ }
+
+ public abstract List<? extends AbstractNavigationProperty> getNavigationProperties();
+
+ public abstract AbstractNavigationProperty getNavigationProperty(String name);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEnumType.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEnumType.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEnumType.java
new file mode 100644
index 0000000..50075f8
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractEnumType.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import org.apache.olingo.odata4.client.api.edm.EnumType;
+import org.apache.olingo.odata4.client.core.data.impl.EnumTypeDeserializer;
+
+@JsonDeserialize(using = EnumTypeDeserializer.class)
+public abstract class AbstractEnumType extends AbstractEdmItem implements EnumType {
+
+ private static final long serialVersionUID = 2688487586103418210L;
+
+ private String name;
+
+ private String underlyingType;
+
+ private boolean flags;
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getUnderlyingType() {
+ return underlyingType;
+ }
+
+ @Override
+ public void setUnderlyingType(final String underlyingType) {
+ this.underlyingType = underlyingType;
+ }
+
+ @Override
+ public boolean isFlags() {
+ return flags;
+ }
+
+ @Override
+ public void setFlags(final boolean flags) {
+ this.flags = flags;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractFunctionImport.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractFunctionImport.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractFunctionImport.java
new file mode 100644
index 0000000..fc6e9e4
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractFunctionImport.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm;
+
+import org.apache.olingo.odata4.client.api.edm.FunctionImport;
+
+public abstract class AbstractFunctionImport extends AbstractEdmItem implements FunctionImport {
+
+ private static final long serialVersionUID = 4154308065211315663L;
+
+ public abstract String getName();
+
+ public abstract String getEntitySet();
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractMember.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractMember.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractMember.java
new file mode 100644
index 0000000..7f53394
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractMember.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.Member;
+
+public abstract class AbstractMember extends AbstractEdmItem implements Member {
+
+ private static final long serialVersionUID = -1852481655317148552L;
+
+ @JsonProperty(value = "Name", required = true)
+ private String name;
+
+ @JsonProperty("Value")
+ private Integer value;
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public Integer getValue() {
+ return value;
+ }
+
+ public void setValue(final Integer value) {
+ this.value = value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractNavigationProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractNavigationProperty.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractNavigationProperty.java
new file mode 100644
index 0000000..b02bbda
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractNavigationProperty.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.odata4.client.core.edm;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.NavigationProperty;
+
+public class AbstractNavigationProperty extends AbstractEdmItem implements NavigationProperty {
+
+ private static final long serialVersionUID = 3112463683071069594L;
+
+ @JsonProperty(value = "Name", required = true)
+ private String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractParameter.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractParameter.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractParameter.java
new file mode 100644
index 0000000..7be7977
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractParameter.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.math.BigInteger;
+import org.apache.olingo.odata4.client.api.edm.Parameter;
+
+public abstract class AbstractParameter extends AbstractEdmItem implements Parameter {
+
+ private static final long serialVersionUID = -4305016554930334342L;
+
+ @JsonProperty(value = "Name", required = true)
+ private String name;
+
+ @JsonProperty(value = "Type", required = true)
+ private String type;
+
+ @JsonProperty(value = "Nullable")
+ private boolean nullable = true;
+
+ @JsonProperty("MaxLength")
+ private String maxLength;
+
+ @JsonProperty("Precision")
+ private BigInteger precision;
+
+ @JsonProperty("Scale")
+ private BigInteger scale;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ public boolean isNullable() {
+ return nullable;
+ }
+
+ public void setNullable(final boolean nullable) {
+ this.nullable = nullable;
+ }
+
+ public String getMaxLength() {
+ return maxLength;
+ }
+
+ public void setMaxLength(final String maxLength) {
+ this.maxLength = maxLength;
+ }
+
+ public BigInteger getPrecision() {
+ return precision;
+ }
+
+ public void setPrecision(final BigInteger precision) {
+ this.precision = precision;
+ }
+
+ public BigInteger getScale() {
+ return scale;
+ }
+
+ public void setScale(final BigInteger scale) {
+ this.scale = scale;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractProperty.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractProperty.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractProperty.java
new file mode 100644
index 0000000..473d265
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractProperty.java
@@ -0,0 +1,240 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.math.BigInteger;
+import org.apache.olingo.odata4.client.api.edm.Property;
+import org.apache.olingo.odata4.commons.api.edm.constants.ConcurrencyMode;
+import org.apache.olingo.odata4.commons.api.edm.constants.EdmContentKind;
+import org.apache.olingo.odata4.commons.api.edm.constants.StoreGeneratedPattern;
+
+public abstract class AbstractProperty extends AbstractEdmItem implements Property {
+
+ private static final long serialVersionUID = -6004492361142315153L;
+
+ @JsonProperty(value = "Name", required = true)
+ private String name;
+
+ @JsonProperty(value = "Type", required = true)
+ private String type;
+
+ @JsonProperty(value = "Nullable")
+ private boolean nullable = true;
+
+ @JsonProperty(value = "DefaultValue")
+ private String defaultValue;
+
+ @JsonProperty(value = "MaxLength")
+ private String maxLength;
+
+ @JsonProperty(value = "FixedLength")
+ private boolean fixedLength;
+
+ @JsonProperty(value = "Precision")
+ private BigInteger precision;
+
+ @JsonProperty(value = "Scale")
+ private BigInteger scale;
+
+ @JsonProperty(value = "Unicode")
+ private boolean unicode = true;
+
+ @JsonProperty(value = "Collation")
+ private String collation;
+
+ @JsonProperty(value = "SRID")
+ private String srid;
+
+ @JsonProperty(value = "ConcurrencyMode")
+ private ConcurrencyMode concurrencyMode;
+
+ @JsonProperty("FC_SourcePath")
+ private String fcSourcePath;
+
+ @JsonProperty("FC_TargetPath")
+ private String fcTargetPath;
+
+ @JsonProperty("FC_ContentKind")
+ private EdmContentKind fcContentKind = EdmContentKind.text;
+
+ @JsonProperty("FC_NsPrefix")
+ private String fcNSPrefix;
+
+ @JsonProperty("FC_NsUri")
+ private String fcNSURI;
+
+ @JsonProperty("FC_KeepInContent")
+ private boolean fcKeepInContent = true;
+
+ @JsonProperty("StoreGeneratedPattern")
+ private StoreGeneratedPattern storeGeneratedPattern = StoreGeneratedPattern.None;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ public boolean isNullable() {
+ return nullable;
+ }
+
+ public void setNullable(final boolean nullable) {
+ this.nullable = nullable;
+ }
+
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ public void setDefaultValue(final String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ public String getMaxLength() {
+ return maxLength;
+ }
+
+ public void setMaxLength(final String maxLength) {
+ this.maxLength = maxLength;
+ }
+
+ public boolean isFixedLength() {
+ return fixedLength;
+ }
+
+ public void setFixedLength(final boolean fixedLength) {
+ this.fixedLength = fixedLength;
+ }
+
+ public BigInteger getPrecision() {
+ return precision;
+ }
+
+ public void setPrecision(final BigInteger precision) {
+ this.precision = precision;
+ }
+
+ public BigInteger getScale() {
+ return scale;
+ }
+
+ public void setScale(final BigInteger scale) {
+ this.scale = scale;
+ }
+
+ public boolean isUnicode() {
+ return unicode;
+ }
+
+ public void setUnicode(final boolean unicode) {
+ this.unicode = unicode;
+ }
+
+ public String getCollation() {
+ return collation;
+ }
+
+ public void setCollation(final String collation) {
+ this.collation = collation;
+ }
+
+ public String getSrid() {
+ return srid;
+ }
+
+ public void setSrid(final String srid) {
+ this.srid = srid;
+ }
+
+ public ConcurrencyMode getConcurrencyMode() {
+ return concurrencyMode;
+ }
+
+ public void setConcurrencyMode(final ConcurrencyMode concurrencyMode) {
+ this.concurrencyMode = concurrencyMode;
+ }
+
+ public String getFcSourcePath() {
+ return fcSourcePath;
+ }
+
+ public void setFcSourcePath(final String fcSourcePath) {
+ this.fcSourcePath = fcSourcePath;
+ }
+
+ public String getFcTargetPath() {
+ return fcTargetPath;
+ }
+
+ public void setFcTargetPath(final String fcTargetPath) {
+ this.fcTargetPath = fcTargetPath;
+ }
+
+ public EdmContentKind getFcContentKind() {
+ return fcContentKind;
+ }
+
+ public void setFcContentKind(final EdmContentKind fcContentKind) {
+ this.fcContentKind = fcContentKind;
+ }
+
+ public String getFcNSPrefix() {
+ return fcNSPrefix;
+ }
+
+ public void setFcNSPrefix(final String fcNSPrefix) {
+ this.fcNSPrefix = fcNSPrefix;
+ }
+
+ public String getFcNSURI() {
+ return fcNSURI;
+ }
+
+ public void setFcNSURI(final String fcNSURI) {
+ this.fcNSURI = fcNSURI;
+ }
+
+ public boolean isFcKeepInContent() {
+ return fcKeepInContent;
+ }
+
+ public void setFcKeepInContent(final boolean fcKeepInContent) {
+ this.fcKeepInContent = fcKeepInContent;
+ }
+
+ public StoreGeneratedPattern getStoreGeneratedPattern() {
+ return storeGeneratedPattern;
+ }
+
+ public void setStoreGeneratedPattern(final StoreGeneratedPattern storeGeneratedPattern) {
+ this.storeGeneratedPattern = storeGeneratedPattern;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractSchema.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractSchema.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractSchema.java
new file mode 100644
index 0000000..d297ae9
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/AbstractSchema.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.Schema;
+import org.apache.olingo.odata4.client.core.data.impl.SchemaDeserializer;
+
+@JsonDeserialize(using = SchemaDeserializer.class)
+public abstract class AbstractSchema<EC extends AbstractEntityContainer<
+ FI>, E extends AbstractEntityType, C extends AbstractComplexType, FI extends AbstractFunctionImport>
+ extends AbstractEdmItem implements Schema {
+
+ private static final long serialVersionUID = -1356392748971378455L;
+
+ private String namespace;
+
+ private String alias;
+
+ @Override
+ public String getNamespace() {
+ return namespace;
+ }
+
+ @Override
+ public void setNamespace(final String namespace) {
+ this.namespace = namespace;
+ }
+
+ @Override
+ public String getAlias() {
+ return alias;
+ }
+
+ @Override
+ public void setAlias(final String alias) {
+ this.alias = alias;
+ }
+
+ @Override
+ public abstract List<E> getEntityTypes();
+
+ @Override
+ public abstract List<? extends AbstractEnumType> getEnumTypes();
+
+ @Override
+ public abstract AbstractEnumType getEnumType(String name);
+
+ @Override
+ public abstract List<? extends AbstractAnnotations> getAnnotationsList();
+
+ @Override
+ public abstract AbstractAnnotations getAnnotationsList(String target);
+
+ @Override
+ public abstract List<C> getComplexTypes();
+
+ @Override
+ public abstract List<EC> getEntityContainers();
+
+ /**
+ * Gets default entity container.
+ *
+ * @return default entity container.
+ */
+ @Override
+ public abstract EC getDefaultEntityContainer();
+
+ /**
+ * Gets entity container with the given name.
+ *
+ * @param name name.
+ * @return entity container.
+ */
+ @Override
+ public abstract EC getEntityContainer(String name);
+
+ /**
+ * Gets entity type with the given name.
+ *
+ * @param name name.
+ * @return entity type.
+ */
+ @Override
+ public E getEntityType(final String name) {
+ E result = null;
+ for (E type : getEntityTypes()) {
+ if (name.equals(type.getName())) {
+ result = type;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Gets complex type with the given name.
+ *
+ * @param name name.
+ * @return complex type.
+ */
+ @Override
+ public C getComplexType(final String name) {
+ C result = null;
+ for (C type : getComplexTypes()) {
+ if (name.equals(type.getName())) {
+ result = type;
+ }
+ }
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/DataServicesDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/DataServicesDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/DataServicesDeserializer.java
new file mode 100644
index 0000000..3b87d06
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/DataServicesDeserializer.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm;
+
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.commons.api.edm.constants.ODataServiceVersion;
+
+public class DataServicesDeserializer extends AbstractEdmDeserializer<AbstractDataServices> {
+
+ @Override
+ protected AbstractDataServices doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final AbstractDataServices dataServices = ODataServiceVersion.V30 == client.getServiceVersion()
+ ? new org.apache.olingo.odata4.client.core.edm.v3.DataServicesImpl()
+ : new org.apache.olingo.odata4.client.core.edm.v4.DataServicesImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("DataServiceVersion".equals(jp.getCurrentName())) {
+ dataServices.setDataServiceVersion(jp.nextTextValue());
+ } else if ("MaxDataServiceVersion".equals(jp.getCurrentName())) {
+ dataServices.setMaxDataServiceVersion(jp.nextTextValue());
+ } else if ("Schema".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (dataServices instanceof org.apache.olingo.odata4.client.core.edm.v3.DataServicesImpl) {
+ ((org.apache.olingo.odata4.client.core.edm.v3.DataServicesImpl) dataServices).
+ getSchemas().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v3.SchemaImpl.class));
+
+ } else {
+ ((org.apache.olingo.odata4.client.core.edm.v4.DataServicesImpl) dataServices).
+ getSchemas().add(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v4.SchemaImpl.class));
+ }
+ }
+ }
+ }
+
+ return dataServices;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmxDeserializer.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmxDeserializer.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmxDeserializer.java
new file mode 100644
index 0000000..db6607c
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EdmxDeserializer.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm;
+
+import org.apache.olingo.odata4.client.core.data.impl.AbstractEdmDeserializer;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import java.io.IOException;
+import org.apache.olingo.odata4.client.core.edm.v4.ReferenceImpl;
+import org.apache.olingo.odata4.commons.api.edm.constants.ODataServiceVersion;
+
+@SuppressWarnings("rawtypes")
+public class EdmxDeserializer extends AbstractEdmDeserializer<AbstractEdmx> {
+
+ @Override
+ protected AbstractEdmx doDeserialize(final JsonParser jp, final DeserializationContext ctxt)
+ throws IOException, JsonProcessingException {
+
+ final AbstractEdmx edmx = ODataServiceVersion.V30 == client.getServiceVersion()
+ ? new org.apache.olingo.odata4.client.core.edm.v3.EdmxImpl()
+ : new org.apache.olingo.odata4.client.core.edm.v4.EdmxImpl();
+
+ for (; jp.getCurrentToken() != JsonToken.END_OBJECT; jp.nextToken()) {
+ final JsonToken token = jp.getCurrentToken();
+ if (token == JsonToken.FIELD_NAME) {
+ if ("Version".equals(jp.getCurrentName())) {
+ edmx.setVersion(jp.nextTextValue());
+ } else if ("DataServices".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ if (edmx instanceof org.apache.olingo.odata4.client.core.edm.v3.EdmxImpl) {
+ ((org.apache.olingo.odata4.client.core.edm.v3.EdmxImpl) edmx).
+ setDataServices(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v3.DataServicesImpl.class));
+ } else {
+ ((org.apache.olingo.odata4.client.core.edm.v4.EdmxImpl) edmx).
+ setDataServices(jp.getCodec().readValue(jp,
+ org.apache.olingo.odata4.client.core.edm.v4.DataServicesImpl.class));
+ }
+ } else if ("Reference".equals(jp.getCurrentName())) {
+ jp.nextToken();
+ ((org.apache.olingo.odata4.client.core.edm.v4.EdmxImpl) edmx).getReferences().
+ add(jp.getCodec().readValue(jp, ReferenceImpl.class));
+ }
+ }
+ }
+
+ return edmx;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EntityKeyImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EntityKeyImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EntityKeyImpl.java
new file mode 100644
index 0000000..3baadf3
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EntityKeyImpl.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.olingo.odata4.client.api.edm.EntityKey;
+import org.apache.olingo.odata4.client.core.data.impl.EntityKeyDeserializer;
+
+@JsonDeserialize(using = EntityKeyDeserializer.class)
+public class EntityKeyImpl extends AbstractEdmItem implements EntityKey {
+
+ private static final long serialVersionUID = 2586047015894794685L;
+
+ private List<PropertyRefImpl> propertyRefs = new ArrayList<PropertyRefImpl>();
+
+ public List<PropertyRefImpl> getPropertyRefs() {
+ return propertyRefs;
+ }
+
+ public void setPropertyRefs(final List<PropertyRefImpl> propertyRefs) {
+ this.propertyRefs = propertyRefs;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EntitySetImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EntitySetImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EntitySetImpl.java
new file mode 100644
index 0000000..e65e3d2
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/EntitySetImpl.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm;
+
+public class EntitySetImpl extends AbstractEntitySet {
+
+ private static final long serialVersionUID = 5570833733884884012L;
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/4f927e76/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/OnDeleteImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/OnDeleteImpl.java b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/OnDeleteImpl.java
new file mode 100644
index 0000000..f3ba343
--- /dev/null
+++ b/odata4-lib/odata4-client-core/src/main/java/org/apache/olingo/odata4/client/core/edm/OnDeleteImpl.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.odata4.client.core.edm;
+
+import org.apache.olingo.odata4.client.api.edm.v4.OnDeleteAction;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.olingo.odata4.client.api.edm.OnDelete;
+
+public class OnDeleteImpl extends AbstractEdmItem implements OnDelete {
+
+ private static final long serialVersionUID = -5321523424474336347L;
+
+ @JsonProperty(value = "Action", required = true)
+ private OnDeleteAction action = OnDeleteAction.None;
+
+ public OnDeleteAction getAction() {
+ return action;
+ }
+
+ public void setAction(final OnDeleteAction action) {
+ this.action = action;
+ }
+
+}