olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kobl...@apache.org
Subject git commit: fixes in json.js
Date Fri, 18 Jul 2014 10:58:20 GMT
Repository: olingo-odata4-js
Updated Branches:
  refs/heads/master 5cd9b1ad2 -> 8bf398ddb


fixes in json.js


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/commit/8bf398dd
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/tree/8bf398dd
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/diff/8bf398dd

Branch: refs/heads/master
Commit: 8bf398ddb8c6854e09276eb144c6ebcf9d15406b
Parents: 5cd9b1a
Author: Sven Kobler <sven.kobler-morris@sap.com>
Authored: Fri Jul 18 12:57:51 2014 +0200
Committer: Sven Kobler <sven.kobler-morris@sap.com>
Committed: Fri Jul 18 12:57:51 2014 +0200

----------------------------------------------------------------------
 datajs/src/lib/odata/json.js | 31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/8bf398dd/datajs/src/lib/odata/json.js
----------------------------------------------------------------------
diff --git a/datajs/src/lib/odata/json.js b/datajs/src/lib/odata/json.js
index a972257..11cd7fa 100644
--- a/datajs/src/lib/odata/json.js
+++ b/datajs/src/lib/odata/json.js
@@ -40,6 +40,7 @@ var formatNumberWidth = oDataUtils.formatNumberWidth;
 var getCanonicalTimezone = oDataUtils.getCanonicalTimezone;
 var handler = oDataUtils.handler;
 var isComplex = oDataUtils.isComplex;
+var isPrimitive = oDataUtils.isPrimitive;
 var isCollectionType = oDataUtils.isCollectionType;
 var lookupComplexType = oDataUtils.lookupComplexType;
 var lookupEntityType = oDataUtils.lookupEntityType;
@@ -449,6 +450,7 @@ var parseContextUriFragment = function( fragments, model ) {
     ret.typeName = undefined;
 
     var fragmentParts = fragments.split("/");
+    var type;
     
     for(var i = 0; i < fragmentParts.length; ++i) {
         var fragment = fragmentParts[i];
@@ -478,7 +480,7 @@ var parseContextUriFragment = function( fragments, model ) {
                     // Capter 10.14
                     ret.typeName = inPharenthesis;
 
-                    var type = lookupEntityType(ret.typeName, model);
+                    type = lookupEntityType(ret.typeName, model);
                     if ( type !== null) {
                         ret.type = type;
                         continue;
@@ -542,7 +544,7 @@ var parseContextUriFragment = function( fragments, model ) {
             if (fragment.indexOf('.') !== -1) {
                 // Capter 10.6
                 ret.typeName = fragment;
-                var type = lookupEntityType(ret.typeName, model);
+                type = lookupEntityType(ret.typeName, model);
                 if ( type !== null) {
                     ret.type = type;
                     continue;
@@ -647,7 +649,8 @@ var readPayloadMinimal = function (data, model, demandedFormat,recognizeDates)
{
 var jsonLightGetEntryKey = function (data, entityModel) {
     /// <summary>Gets the key of an entry.</summary>
     /// <param name="data" type="Object">JSON light entry.</param>
-    /// <paraFrom   Subject Received    Size    Categories  
+    /// <paraFrom   Subject Received    Size    Categories  
+
     /// <returns type="string">Entry instance key.</returns>
 
     var entityInstanceKey;
@@ -848,6 +851,28 @@ var readPayloadMinimalObject = function (data, objectInfo, baseURI, model,
deman
     return data;
 };
 
+var jsonLightSerializableMetadata = ["@odata.type", "@odata.etag", "@odata.mediaEditLink",
"@odata.mediaReadLink", "@odata.mediaContentType", "@odata.mediaEtag"];
+
+var isJsonLightSerializableProperty = function (property) {
+    if (!property) {
+        return false;
+    }
+
+    if (property.indexOf("@odata.") == -1) {
+        return true;
+    }
+
+    var i, len;
+    for (i = 0, len = jsonLightSerializableMetadata.length; i < len; i++) {
+        var name = jsonLightSerializableMetadata[i];
+        if (property.indexOf(name) != -1) {
+            return true;
+        }
+    }
+
+    return false;
+};
+
 
 var jsonHandler = oDataHandler.handler(jsonParser, jsonSerializer, jsonMediaType, MAX_DATA_SERVICE_VERSION);
 jsonHandler.recognizeDates = false;


Mime
View raw message