You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/04/01 11:00:53 UTC

[41/52] [abbrv] [OLINGO-205, OLINGO-200] provided atom v4 deserialization for entity type/set + entity set request

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
index d48fda4..a807052 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/AbstractEdmStructuredType.java
@@ -34,96 +34,99 @@ import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
 
 public abstract class AbstractEdmStructuredType extends EdmTypeImpl implements EdmStructuredType {
 
-  protected EdmStructuredType baseType;
+    protected EdmStructuredType baseType;
 
-  private List<String> propertyNames;
+    private List<String> propertyNames;
 
-  private List<String> navigationPropertyNames;
+    private List<String> navigationPropertyNames;
 
-  public AbstractEdmStructuredType(final Edm edm, final FullQualifiedName fqn, final EdmTypeKind kind,
-          final FullQualifiedName baseTypeName) {
+    public AbstractEdmStructuredType(
+            final Edm edm,
+            final FullQualifiedName fqn,
+            final EdmTypeKind kind,
+            final FullQualifiedName baseTypeName) {
 
-    super(edm, fqn, kind);
-  }
+        super(edm, fqn, kind);
+    }
 
-  protected abstract EdmStructuredType buildBaseType(FullQualifiedName baseTypeName);
+    protected abstract EdmStructuredType buildBaseType(FullQualifiedName baseTypeName);
 
-  protected abstract Map<String, EdmProperty> getProperties();
+    protected abstract Map<String, EdmProperty> getProperties();
 
-  protected abstract Map<String, EdmNavigationProperty> getNavigationProperties();
+    protected abstract Map<String, EdmNavigationProperty> getNavigationProperties();
 
-  @Override
-  public List<String> getPropertyNames() {
-    if (propertyNames == null) {
-      propertyNames = new ArrayList<String>();
-      if (baseType != null) {
-        propertyNames.addAll(baseType.getPropertyNames());
-      }
-      propertyNames.addAll(getProperties().keySet());
-    }
-    return propertyNames;
-  }
-
-  @Override
-  public List<String> getNavigationPropertyNames() {
-    if (navigationPropertyNames == null) {
-      navigationPropertyNames = new ArrayList<String>();
-      if (baseType != null) {
-        navigationPropertyNames.addAll(baseType.getNavigationPropertyNames());
-      }
-      navigationPropertyNames.addAll(getNavigationProperties().keySet());
-    }
-    return navigationPropertyNames;
-  }
-
-  @Override
-  public EdmElement getProperty(final String name) {
-    EdmElement property = getStructuralProperty(name);
-    if (property == null) {
-      property = getNavigationProperty(name);
-    }
-    return property;
-  }
-
-  @Override
-  public EdmProperty getStructuralProperty(final String name) {
-    EdmProperty property = null;
-    if (baseType != null) {
-      property = baseType.getStructuralProperty(name);
-    }
-    if (property == null) {
-      property = getProperties().get(name);
+    @Override
+    public List<String> getPropertyNames() {
+        if (propertyNames == null) {
+            propertyNames = new ArrayList<String>();
+            if (baseType != null) {
+                propertyNames.addAll(baseType.getPropertyNames());
+            }
+            propertyNames.addAll(getProperties().keySet());
+        }
+        return propertyNames;
     }
-    return property;
-  }
-
-  @Override
-  public EdmNavigationProperty getNavigationProperty(final String name) {
-    EdmNavigationProperty property = null;
-    if (baseType != null) {
-      property = baseType.getNavigationProperty(name);
+
+    @Override
+    public List<String> getNavigationPropertyNames() {
+        if (navigationPropertyNames == null) {
+            navigationPropertyNames = new ArrayList<String>();
+            if (baseType != null) {
+                navigationPropertyNames.addAll(baseType.getNavigationPropertyNames());
+            }
+            navigationPropertyNames.addAll(getNavigationProperties().keySet());
+        }
+        return navigationPropertyNames;
     }
-    if (property == null) {
-      property = getNavigationProperties().get(name);
+
+    @Override
+    public EdmElement getProperty(final String name) {
+        EdmElement property = getStructuralProperty(name);
+        if (property == null) {
+            property = getNavigationProperty(name);
+        }
+        return property;
     }
-    return property;
-  }
-
-  @Override
-  public boolean compatibleTo(final EdmType targetType) {
-    EdmStructuredType sourceType = this;
-    if (targetType == null) {
-      throw new EdmException("Target type must not be null");
+
+    @Override
+    public EdmProperty getStructuralProperty(final String name) {
+        EdmProperty property = null;
+        if (baseType != null) {
+            property = baseType.getStructuralProperty(name);
+        }
+        if (property == null) {
+            property = getProperties().get(name);
+        }
+        return property;
     }
-    while (!sourceType.getName().equals(targetType.getName()) 
-           || !sourceType.getNamespace().equals(targetType.getNamespace())) {
-      
-      sourceType = sourceType.getBaseType();
-      if (sourceType == null) {
-        return false;
-      }
+
+    @Override
+    public EdmNavigationProperty getNavigationProperty(final String name) {
+        EdmNavigationProperty property = null;
+        if (baseType != null) {
+            property = baseType.getNavigationProperty(name);
+        }
+        if (property == null) {
+            property = getNavigationProperties().get(name);
+        }
+        return property;
     }
 
-    return true;
-  }
+    @Override
+    public boolean compatibleTo(final EdmType targetType) {
+        EdmStructuredType sourceType = this;
+        if (targetType == null) {
+            throw new EdmException("Target type must not be null");
+        }
+        while (!sourceType.getName().equals(targetType.getName())
+                || !sourceType.getNamespace().equals(targetType.getNamespace())) {
+
+            sourceType = sourceType.getBaseType();
+            if (sourceType == null) {
+                return false;
+            }
+        }
+
+        return true;
+    }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNamedImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNamedImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNamedImpl.java
index 8f82d56..0f0bd5d 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNamedImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmNamedImpl.java
@@ -23,18 +23,17 @@ import org.apache.olingo.commons.api.edm.EdmNamed;
 
 public abstract class EdmNamedImpl implements EdmNamed {
 
-  protected final Edm edm;
+    protected final Edm edm;
 
-  private final String name;
+    private final String name;
 
-  public EdmNamedImpl(final Edm edm, final String name) {
-    this.edm = edm;
-    this.name = name;
-  }
-
-  @Override
-  public String getName() {
-    return name;
-  }
+    public EdmNamedImpl(final Edm edm, final String name) {
+        this.edm = edm;
+        this.name = name;
+    }
 
+    @Override
+    public String getName() {
+        return name;
+    }
 }

http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/9aefb959/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeImpl.java
----------------------------------------------------------------------
diff --git a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeImpl.java b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeImpl.java
index 7fc2808..ed20afa 100644
--- a/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeImpl.java
+++ b/lib/commons-core/src/main/java/org/apache/olingo/commons/core/edm/EdmTypeImpl.java
@@ -25,24 +25,23 @@ import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
 
 public class EdmTypeImpl extends EdmNamedImpl implements EdmType {
 
-  protected final FullQualifiedName fqn;
+    protected final FullQualifiedName fqn;
 
-  protected final EdmTypeKind kind;
+    protected final EdmTypeKind kind;
 
-  public EdmTypeImpl(final Edm edm, final FullQualifiedName fqn, final EdmTypeKind kind) {
-    super(edm, fqn.getName());
-    this.fqn = fqn;
-    this.kind = kind;
-  }
+    public EdmTypeImpl(final Edm edm, final FullQualifiedName fqn, final EdmTypeKind kind) {
+        super(edm, fqn.getName());
+        this.fqn = fqn;
+        this.kind = kind;
+    }
 
-  @Override
-  public String getNamespace() {
-    return fqn.getNamespace();
-  }
-
-  @Override
-  public EdmTypeKind getKind() {
-    return kind;
-  }
+    @Override
+    public String getNamespace() {
+        return fqn.getNamespace();
+    }
 
+    @Override
+    public EdmTypeKind getKind() {
+        return kind;
+    }
 }