Return-Path: X-Original-To: apmail-olingo-commits-archive@minotaur.apache.org Delivered-To: apmail-olingo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A3E6E11C8F for ; Fri, 18 Jul 2014 10:58:20 +0000 (UTC) Received: (qmail 12149 invoked by uid 500); 18 Jul 2014 10:58:20 -0000 Delivered-To: apmail-olingo-commits-archive@olingo.apache.org Received: (qmail 12121 invoked by uid 500); 18 Jul 2014 10:58:20 -0000 Mailing-List: contact commits-help@olingo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@olingo.apache.org Delivered-To: mailing list commits@olingo.apache.org Received: (qmail 12112 invoked by uid 99); 18 Jul 2014 10:58:20 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Jul 2014 10:58:20 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 21AAC94E45F; Fri, 18 Jul 2014 10:58:20 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: koblers@apache.org To: commits@olingo.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: fixes in json.js Date: Fri, 18 Jul 2014 10:58:20 +0000 (UTC) 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 Authored: Fri Jul 18 12:57:51 2014 +0200 Committer: Sven Kobler 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) { /// Gets the key of an entry. /// JSON light entry. - /// Entry instance key. 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;