You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ko...@apache.org on 2014/09/15 13:55:42 UTC
svn commit: r1625002 [2/14] - in
/olingo/site/trunk/content/doc/javascript/apidoc: ./ scripts/
scripts/prettify/ styles/
Added: olingo/site/trunk/content/doc/javascript/apidoc/DjsDeferred.html
URL: http://svn.apache.org/viewvc/olingo/site/trunk/content/doc/javascript/apidoc/DjsDeferred.html?rev=1625002&view=auto
==============================================================================
--- olingo/site/trunk/content/doc/javascript/apidoc/DjsDeferred.html (added)
+++ olingo/site/trunk/content/doc/javascript/apidoc/DjsDeferred.html Mon Sep 15 11:55:41 2014
@@ -0,0 +1,558 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>JSDoc: Class: DjsDeferred</title>
+
+ <script src="scripts/prettify/prettify.js"> </script>
+ <script src="scripts/prettify/lang-css.js"> </script>
+ <!--[if lt IE 9]>
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+ <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
+</head>
+
+<body>
+
+<div id="main">
+
+ <h1 class="page-title">Class: DjsDeferred</h1>
+
+
+
+
+
+<section>
+
+<header>
+ <h2>
+ DjsDeferred
+ </h2>
+
+</header>
+
+<article>
+ <div class="container-overview">
+
+
+
+
+<dt>
+ <h4 class="name" id="DjsDeferred"><span class="type-signature"></span>new DjsDeferred<span class="signature">()</span><span class="type-signature"></span></h4>
+
+
+</dt>
+<dd>
+
+
+ <div class="description">
+ Initializes a new DjsDeferred object.
+<ul>
+<li> Compability Note A - Ordering of callbacks through chained 'then' invocations <br>
+
+The Wiki entry at http://wiki.commonjs.org/wiki/Promises/A
+implies that .then() returns a distinct object.
+
+For compatibility with http://api.jquery.com/category/deferred-object/
+we return this same object. This affects ordering, as
+the jQuery version will fire callbacks in registration
+order regardless of whether they occur on the result
+or the original object.
+</li>
+<li>Compability Note B - Fulfillment value <br>
+
+The Wiki entry at http://wiki.commonjs.org/wiki/Promises/A
+implies that the result of a success callback is the
+fulfillment value of the object and is received by
+other success callbacks that are chained.
+
+For compatibility with http://api.jquery.com/category/deferred-object/
+we disregard this value instead.
+</li></ul>
+ </div>
+
+
+
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="deferred.js.html">odatajs/deferred.js</a>, <a href="deferred.js.html#line37">line 37</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+</dd>
+
+
+ </div>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <h3 class="subsection-title">Methods</h3>
+
+ <dl>
+
+<dt>
+ <h4 class="name" id="promise"><span class="type-signature"></span>promise<span class="signature">()</span><span class="type-signature"></span></h4>
+
+
+</dt>
+<dd>
+
+
+ <div class="description">
+ Returns a version of this object that has only the read-only methods available.
+ </div>
+
+
+
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="deferred.js.html">odatajs/deferred.js</a>, <a href="deferred.js.html#line159">line 159</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+ <h5>Returns:</h5>
+
+
+<div class="param-desc">
+ An object with only the promise object.
+</div>
+
+
+
+
+
+
+</dd>
+
+
+
+<dt>
+ <h4 class="name" id="reject"><span class="type-signature"></span>reject<span class="signature">()</span><span class="type-signature"></span></h4>
+
+
+</dt>
+<dd>
+
+
+ <div class="description">
+ Invokes error callbacks for this deferred object.
+All arguments are forwarded to error callbacks.
+ </div>
+
+
+
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="deferred.js.html">odatajs/deferred.js</a>, <a href="deferred.js.html#line138">line 138</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+</dd>
+
+
+
+<dt>
+ <h4 class="name" id="resolve"><span class="type-signature"></span>resolve<span class="signature">()</span><span class="type-signature"></span></h4>
+
+
+</dt>
+<dd>
+
+
+ <div class="description">
+ Invokes success callbacks for this deferred object.
+All arguments are forwarded to success callbacks.
+ </div>
+
+
+
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="deferred.js.html">odatajs/deferred.js</a>, <a href="deferred.js.html#line112">line 112</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+</dd>
+
+
+
+<dt>
+ <h4 class="name" id="then"><span class="type-signature"></span>then<span class="signature">(<span class="optional">fulfilledHandler</span>, <span class="optional">errorHandler</span>)</span><span class="type-signature"></span></h4>
+
+
+</dt>
+<dd>
+
+
+ <div class="description">
+ Adds success and error callbacks for this deferred object.
+See Compatibility Note A.
+ </div>
+
+
+
+
+
+
+
+ <h5>Parameters:</h5>
+
+
+<table class="params">
+ <thead>
+ <tr>
+
+ <th>Name</th>
+
+
+ <th>Type</th>
+
+
+ <th>Argument</th>
+
+
+
+
+ <th class="last">Description</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+
+ <tr>
+
+ <td class="name"><code>fulfilledHandler</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">function</span>
+
+
+
+ </td>
+
+
+ <td class="attributes">
+
+ <optional><br>
+
+
+
+
+
+ </td>
+
+
+
+
+ <td class="description last">Success callback ( may be null)</td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>errorHandler</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">function</span>
+
+
+
+ </td>
+
+
+ <td class="attributes">
+
+ <optional><br>
+
+
+
+
+
+ </td>
+
+
+
+
+ <td class="description last">Error callback ( may be null)</td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="deferred.js.html">odatajs/deferred.js</a>, <a href="deferred.js.html#line73">line 73</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+
+
+</dd>
+
+ </dl>
+
+
+
+
+
+</article>
+
+</section>
+
+
+
+
+</div>
+
+<nav>
+ <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-cache.html">cache</a></li><li><a href="source.html">cache/source</a></li><li><a href="module-datajs.html">datajs</a></li><li><a href="deferred.html">datajs/deferred</a></li><li><a href="utils.html">datajs/utils</a></li><li><a href="xml.html">datajs/xml</a></li><li><a href="module-odata.html">odata</a></li><li><a href="batch.html">odata/batch</a></li><li><a href="handler.html">odata/handler</a></li><li><a href="json.html">odata/json</a></li><li><a href="metadata.html">odata/metadata</a></li><li><a href="net.html">odata/net</a></li><li><a href="utils_.html">odata/utils</a></li><li><a href="module-store.html">store</a></li><li><a href="dom.html">store/dom</a></li><li><a href="indexeddb.html">store/indexeddb</a></li><li><a href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a href="DataCache.html">DataCache</a></li><li><a href="DataCacheOperation.html">DataCacheOperation</a></li><li><a h
ref="DjsDeferred.html">DjsDeferred</a></li><li><a href="dom-DomStore.html">DomStore</a></li><li><a href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a href="memory-MemoryStore.html">MemoryStore</a></li><li><a href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a href="global.html">Global</a></h3>
+</nav>
+
+<br clear="both">
+
+<footer>
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Sep 15 2014 13:08:00 GMT+0200 (MESZ)
+</footer>
+
+<script> prettyPrint(); </script>
+<script src="scripts/linenumber.js"> </script>
+</body>
+</html>
\ No newline at end of file
Added: olingo/site/trunk/content/doc/javascript/apidoc/ODataCacheSource.html
URL: http://svn.apache.org/viewvc/olingo/site/trunk/content/doc/javascript/apidoc/ODataCacheSource.html?rev=1625002&view=auto
==============================================================================
--- olingo/site/trunk/content/doc/javascript/apidoc/ODataCacheSource.html (added)
+++ olingo/site/trunk/content/doc/javascript/apidoc/ODataCacheSource.html Mon Sep 15 11:55:41 2014
@@ -0,0 +1,589 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>JSDoc: Class: ODataCacheSource</title>
+
+ <script src="scripts/prettify/prettify.js"> </script>
+ <script src="scripts/prettify/lang-css.js"> </script>
+ <!--[if lt IE 9]>
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+ <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
+</head>
+
+<body>
+
+<div id="main">
+
+ <h1 class="page-title">Class: ODataCacheSource</h1>
+
+
+
+
+
+<section>
+
+<header>
+ <h2>
+ ODataCacheSource
+ </h2>
+
+</header>
+
+<article>
+ <div class="container-overview">
+
+
+
+
+<dt>
+ <h4 class="name" id="ODataCacheSource"><span class="type-signature"></span>new ODataCacheSource<span class="signature">(options)</span><span class="type-signature"> → {<a href="ODataCacheSource.html">ODataCacheSource</a>}</span></h4>
+
+
+</dt>
+<dd>
+
+
+ <div class="description">
+ Creates a data cache source object for requesting data from an OData service.
+ </div>
+
+
+
+
+
+
+
+ <h5>Parameters:</h5>
+
+
+<table class="params">
+ <thead>
+ <tr>
+
+ <th>Name</th>
+
+
+ <th>Type</th>
+
+
+
+
+
+ <th class="last">Description</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+
+ <tr>
+
+ <td class="name"><code>options</code></td>
+
+
+ <td class="type">
+
+ </td>
+
+
+
+
+
+ <td class="description last">Options for the cache data source.</td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="source.js.html">cache/source.js</a>, <a href="source.js.html#line153">line 153</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+ <h5>Returns:</h5>
+
+
+<div class="param-desc">
+ A new data cache source instance.
+</div>
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type"><a href="ODataCacheSource.html">ODataCacheSource</a></span>
+
+
+ </dd>
+</dl>
+
+
+
+
+</dd>
+
+
+ </div>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <h3 class="subsection-title">Methods</h3>
+
+ <dl>
+
+<dt>
+ <h4 class="name" id="count"><span class="type-signature"></span>count<span class="signature">(success, error)</span><span class="type-signature"> → {Object}</span></h4>
+
+
+</dt>
+<dd>
+
+
+ <div class="description">
+ Gets the number of items in the collection.
+ </div>
+
+
+
+
+
+
+
+ <h5>Parameters:</h5>
+
+
+<table class="params">
+ <thead>
+ <tr>
+
+ <th>Name</th>
+
+
+ <th>Type</th>
+
+
+
+
+
+ <th class="last">Description</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+
+ <tr>
+
+ <td class="name"><code>success</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">function</span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last">Success callback with the item count.</td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>error</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">function</span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last">Error callback.</td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="source.js.html">cache/source.js</a>, <a href="source.js.html#line165">line 165</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+ <h5>Returns:</h5>
+
+
+<div class="param-desc">
+ Request object with an abort method.
+</div>
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type">Object</span>
+
+
+ </dd>
+</dl>
+
+
+
+
+</dd>
+
+
+
+<dt>
+ <h4 class="name" id="read"><span class="type-signature"></span>read<span class="signature">(index, count, success, error)</span><span class="type-signature"> → {Object}</span></h4>
+
+
+</dt>
+<dd>
+
+
+ <div class="description">
+ Gets a number of consecutive items from the collection.
+ </div>
+
+
+
+
+
+
+
+ <h5>Parameters:</h5>
+
+
+<table class="params">
+ <thead>
+ <tr>
+
+ <th>Name</th>
+
+
+ <th>Type</th>
+
+
+
+
+
+ <th class="last">Description</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+
+ <tr>
+
+ <td class="name"><code>index</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">Number</span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last">Zero-based index of the items to retrieve.</td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>count</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">Number</span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last">Number of items to retrieve.</td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>success</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">function</span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last">Success callback with the requested items.</td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>error</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">function</span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last">Error callback.</td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="source.js.html">cache/source.js</a>, <a href="source.js.html#line186">line 186</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+ <h5>Returns:</h5>
+
+
+<div class="param-desc">
+ Request object with an abort method.
+</div>
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type">Object</span>
+
+
+ </dd>
+</dl>
+
+
+
+
+</dd>
+
+ </dl>
+
+
+
+
+
+</article>
+
+</section>
+
+
+
+
+</div>
+
+<nav>
+ <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-cache.html">cache</a></li><li><a href="source.html">cache/source</a></li><li><a href="module-datajs.html">datajs</a></li><li><a href="deferred.html">datajs/deferred</a></li><li><a href="utils.html">datajs/utils</a></li><li><a href="xml.html">datajs/xml</a></li><li><a href="module-odata.html">odata</a></li><li><a href="batch.html">odata/batch</a></li><li><a href="handler.html">odata/handler</a></li><li><a href="json.html">odata/json</a></li><li><a href="metadata.html">odata/metadata</a></li><li><a href="net.html">odata/net</a></li><li><a href="utils_.html">odata/utils</a></li><li><a href="module-store.html">store</a></li><li><a href="dom.html">store/dom</a></li><li><a href="indexeddb.html">store/indexeddb</a></li><li><a href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a href="DataCache.html">DataCache</a></li><li><a href="DataCacheOperation.html">DataCacheOperation</a></li><li><a h
ref="DjsDeferred.html">DjsDeferred</a></li><li><a href="dom-DomStore.html">DomStore</a></li><li><a href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a href="memory-MemoryStore.html">MemoryStore</a></li><li><a href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a href="global.html">Global</a></h3>
+</nav>
+
+<br clear="both">
+
+<footer>
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Sep 15 2014 13:08:02 GMT+0200 (MESZ)
+</footer>
+
+<script> prettyPrint(); </script>
+<script src="scripts/linenumber.js"> </script>
+</body>
+</html>
\ No newline at end of file
Added: olingo/site/trunk/content/doc/javascript/apidoc/batch.html
URL: http://svn.apache.org/viewvc/olingo/site/trunk/content/doc/javascript/apidoc/batch.html?rev=1625002&view=auto
==============================================================================
--- olingo/site/trunk/content/doc/javascript/apidoc/batch.html (added)
+++ olingo/site/trunk/content/doc/javascript/apidoc/batch.html Mon Sep 15 11:55:41 2014
@@ -0,0 +1,1402 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>JSDoc: Module: odata/batch</title>
+
+ <script src="scripts/prettify/prettify.js"> </script>
+ <script src="scripts/prettify/lang-css.js"> </script>
+ <!--[if lt IE 9]>
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+ <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
+</head>
+
+<body>
+
+<div id="main">
+
+ <h1 class="page-title">Module: odata/batch</h1>
+
+
+
+
+
+<section>
+
+<header>
+ <h2>
+ odata/batch
+ </h2>
+
+</header>
+
+<article>
+ <div class="container-overview">
+
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line3">line 3</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+ </div>
+
+
+
+
+
+
+
+
+
+
+
+
+ <h3 class="subsection-title">Members</h3>
+
+ <dl>
+
+<dt>
+ <h4 class="name" id="batchHandler"><span class="type-signature"><static> </span>batchHandler<span class="type-signature"></span></h4>
+
+
+</dt>
+<dd>
+
+ <div class="description">
+ batchHandler (see <a href="batch.html#batchParser">module:odata/batch~batchParser</a>)
+ </div>
+
+
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line375">line 375</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+</dd>
+
+ </dl>
+
+
+
+ <h3 class="subsection-title">Methods</h3>
+
+ <dl>
+
+<dt>
+ <h4 class="name" id="batchParser"><span class="type-signature"><inner> </span>batchParser<span class="signature">(handler, text, context)</span><span class="type-signature"></span></h4>
+
+
+</dt>
+<dd>
+
+
+ <div class="description">
+ Parses a batch response.
+ </div>
+
+
+
+
+
+
+
+ <h5>Parameters:</h5>
+
+
+<table class="params">
+ <thead>
+ <tr>
+
+ <th>Name</th>
+
+
+ <th>Type</th>
+
+
+
+
+
+ <th class="last">Description</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+
+ <tr>
+
+ <td class="name"><code>handler</code></td>
+
+
+ <td class="type">
+
+ </td>
+
+
+
+
+
+ <td class="description last">This handler.</td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>text</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">String</span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last">Batch text.</td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>context</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">Object</span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last">Object with parsing context.</td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line92">line 92</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+ <h5>Returns:</h5>
+
+
+<div class="param-desc">
+ An object representation of the batch.
+</div>
+
+
+
+
+
+
+</dd>
+
+
+
+<dt>
+ <h4 class="name" id="batchSerializer"><span class="type-signature"><inner> </span>batchSerializer<span class="signature">(handler, data, context)</span><span class="type-signature"></span></h4>
+
+
+</dt>
+<dd>
+
+
+ <div class="description">
+ Serializes a batch object representation into text.
+ </div>
+
+
+
+
+
+
+
+ <h5>Parameters:</h5>
+
+
+<table class="params">
+ <thead>
+ <tr>
+
+ <th>Name</th>
+
+
+ <th>Type</th>
+
+
+
+
+
+ <th class="last">Description</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+
+ <tr>
+
+ <td class="name"><code>handler</code></td>
+
+
+ <td class="type">
+
+ </td>
+
+
+
+
+
+ <td class="description last">This handler.</td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>data</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">Object</span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last">Representation of a batch.</td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>context</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">Object</span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last">Object with parsing context.</td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line104">line 104</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+ <h5>Returns:</h5>
+
+
+<div class="param-desc">
+ An text representation of the batch object; undefined if not applicable.#
+</div>
+
+
+
+
+
+
+</dd>
+
+
+
+<dt>
+ <h4 class="name" id="readLine"><span class="type-signature"><inner> </span>readLine<span class="signature">(text, context)</span><span class="type-signature"> → {String}</span></h4>
+
+
+</dt>
+<dd>
+
+
+ <div class="description">
+ Returns a substring from the position defined by the context up to the next line break (CRLF).
+ </div>
+
+
+
+
+
+
+
+ <h5>Parameters:</h5>
+
+
+<table class="params">
+ <thead>
+ <tr>
+
+ <th>Name</th>
+
+
+ <th>Type</th>
+
+
+
+
+
+ <th class="last">Description</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+
+ <tr>
+
+ <td class="name"><code>text</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">String</span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last">Input string.</td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>context</code></td>
+
+
+ <td class="type">
+
+ </td>
+
+
+
+
+
+ <td class="description last">Context used for reading the input string.</td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line242">line 242</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+ <h5>Returns:</h5>
+
+
+<div class="param-desc">
+ Substring to the first ocurrence of a line break or null if none can be found.
+</div>
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type">String</span>
+
+
+ </dd>
+</dl>
+
+
+
+
+</dd>
+
+
+
+<dt>
+ <h4 class="name" id="readTo"><span class="type-signature"><inner> </span>readTo<span class="signature">(text, context, <span class="optional">str</span>)</span><span class="type-signature"> → {String}</span></h4>
+
+
+</dt>
+<dd>
+
+
+ <div class="description">
+ Returns a substring from the position given by the context up to value defined by the str parameter and increments the position in the context.
+ </div>
+
+
+
+
+
+
+
+ <h5>Parameters:</h5>
+
+
+<table class="params">
+ <thead>
+ <tr>
+
+ <th>Name</th>
+
+
+ <th>Type</th>
+
+
+ <th>Argument</th>
+
+
+
+
+ <th class="last">Description</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+
+ <tr>
+
+ <td class="name"><code>text</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">String</span>
+
+
+
+ </td>
+
+
+ <td class="attributes">
+
+
+
+
+
+ </td>
+
+
+
+
+ <td class="description last">Input string.</param></td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>context</code></td>
+
+
+ <td class="type">
+
+ </td>
+
+
+ <td class="attributes">
+
+
+
+
+
+ </td>
+
+
+
+
+ <td class="description last">Context used for reading the input string.</param></td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>str</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">String</span>
+
+
+
+ </td>
+
+
+ <td class="attributes">
+
+ <optional><br>
+
+
+
+
+
+ </td>
+
+
+
+
+ <td class="description last">Substring to read up to.</td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line253">line 253</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+ <h5>Returns:</h5>
+
+
+<div class="param-desc">
+ Substring to the first ocurrence of str or the end of the input string if str is not specified. Null if the marker is not found.
+</div>
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type">String</span>
+
+
+ </dd>
+</dl>
+
+
+
+
+</dd>
+
+
+
+<dt>
+ <h4 class="name" id="writeBatch"><span class="type-signature"><inner> </span>writeBatch<span class="signature">(data, context)</span><span class="type-signature"> → {String}</span></h4>
+
+
+</dt>
+<dd>
+
+
+ <div class="description">
+ Serializes a batch request object to a string.
+ </div>
+
+
+
+
+
+
+
+ <h5>Parameters:</h5>
+
+
+<table class="params">
+ <thead>
+ <tr>
+
+ <th>Name</th>
+
+
+ <th>Type</th>
+
+
+
+
+
+ <th class="last">Description</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+
+ <tr>
+
+ <td class="name"><code>data</code></td>
+
+
+ <td class="type">
+
+ </td>
+
+
+
+
+
+ <td class="description last">Batch request object in payload representation format</td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>context</code></td>
+
+
+ <td class="type">
+
+ </td>
+
+
+
+
+
+ <td class="description last">Context used for the serialization</td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line274">line 274</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+ <h5>Returns:</h5>
+
+
+<div class="param-desc">
+ String representing the batch request
+</div>
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type">String</span>
+
+
+ </dd>
+</dl>
+
+
+
+
+</dd>
+
+
+
+<dt>
+ <h4 class="name" id="writeBatchPart"><span class="type-signature"><inner> </span>writeBatchPart<span class="signature">(part, context, <span class="optional">nested</span>)</span><span class="type-signature"> → {String}</span></h4>
+
+
+</dt>
+<dd>
+
+
+ <div class="description">
+ Serializes a part of a batch request to a string. A part can be either a GET request or
+a change set grouping several CUD (create, update, delete) requests.
+ </div>
+
+
+
+
+
+
+
+ <h5>Parameters:</h5>
+
+
+<table class="params">
+ <thead>
+ <tr>
+
+ <th>Name</th>
+
+
+ <th>Type</th>
+
+
+ <th>Argument</th>
+
+
+
+
+ <th class="last">Description</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+
+ <tr>
+
+ <td class="name"><code>part</code></td>
+
+
+ <td class="type">
+
+ </td>
+
+
+ <td class="attributes">
+
+
+
+
+
+ </td>
+
+
+
+
+ <td class="description last">Request or change set object in payload representation format</param></td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>context</code></td>
+
+
+ <td class="type">
+
+ </td>
+
+
+ <td class="attributes">
+
+
+
+
+
+ </td>
+
+
+
+
+ <td class="description last">Object containing context information used for the serialization</param></td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>nested</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">boolean</span>
+
+
+
+ </td>
+
+
+ <td class="attributes">
+
+ <optional><br>
+
+
+
+
+
+ </td>
+
+
+
+
+ <td class="description last">-</td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line318">line 318</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+ <h5>Returns:</h5>
+
+
+<div class="param-desc">
+ String representing the serialized part
+A change set is an array of request objects and they cannot be nested inside other change sets.
+</div>
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type">String</span>
+
+
+ </dd>
+</dl>
+
+
+
+
+</dd>
+
+
+
+<dt>
+ <h4 class="name" id="writeBatchPartDelimiter"><span class="type-signature"><inner> </span>writeBatchPartDelimiter<span class="signature">(boundary, close)</span><span class="type-signature"> → {String}</span></h4>
+
+
+</dt>
+<dd>
+
+
+ <div class="description">
+ Creates the delimiter that indicates that start or end of an individual request.
+ </div>
+
+
+
+
+
+
+
+ <h5>Parameters:</h5>
+
+
+<table class="params">
+ <thead>
+ <tr>
+
+ <th>Name</th>
+
+
+ <th>Type</th>
+
+
+
+
+
+ <th class="last">Description</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+
+ <tr>
+
+ <td class="name"><code>boundary</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">String</span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last">Boundary string used to indicate the start of the request</param></td>
+ </tr>
+
+
+
+ <tr>
+
+ <td class="name"><code>close</code></td>
+
+
+ <td class="type">
+
+
+<span class="param-type">Boolean</span>
+
+
+
+ </td>
+
+
+
+
+
+ <td class="description last">Flag indicating that a close delimiter string should be generated</td>
+ </tr>
+
+
+ </tbody>
+</table>
+
+
+
+<dl class="details">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <dt class="tag-source">Source:</dt>
+ <dd class="tag-source"><ul class="dummy"><li>
+ <a href="batch.js.html">odata/batch.js</a>, <a href="batch.js.html#line301">line 301</a>
+ </li></ul></dd>
+
+
+
+
+
+
+
+</dl>
+
+
+
+
+
+
+
+
+
+
+
+ <h5>Returns:</h5>
+
+
+<div class="param-desc">
+ Delimiter string
+</div>
+
+
+
+<dl>
+ <dt>
+ Type
+ </dt>
+ <dd>
+
+<span class="param-type">String</span>
+
+
+ </dd>
+</dl>
+
+
+
+
+</dd>
+
+ </dl>
+
+
+
+
+
+</article>
+
+</section>
+
+
+
+
+</div>
+
+<nav>
+ <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-cache.html">cache</a></li><li><a href="source.html">cache/source</a></li><li><a href="module-datajs.html">datajs</a></li><li><a href="deferred.html">datajs/deferred</a></li><li><a href="utils.html">datajs/utils</a></li><li><a href="xml.html">datajs/xml</a></li><li><a href="module-odata.html">odata</a></li><li><a href="batch.html">odata/batch</a></li><li><a href="handler.html">odata/handler</a></li><li><a href="json.html">odata/json</a></li><li><a href="metadata.html">odata/metadata</a></li><li><a href="net.html">odata/net</a></li><li><a href="utils_.html">odata/utils</a></li><li><a href="module-store.html">store</a></li><li><a href="dom.html">store/dom</a></li><li><a href="indexeddb.html">store/indexeddb</a></li><li><a href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a href="DataCache.html">DataCache</a></li><li><a href="DataCacheOperation.html">DataCacheOperation</a></li><li><a h
ref="DjsDeferred.html">DjsDeferred</a></li><li><a href="dom-DomStore.html">DomStore</a></li><li><a href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a href="memory-MemoryStore.html">MemoryStore</a></li><li><a href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a href="global.html">Global</a></h3>
+</nav>
+
+<br clear="both">
+
+<footer>
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Sep 15 2014 13:08:01 GMT+0200 (MESZ)
+</footer>
+
+<script> prettyPrint(); </script>
+<script src="scripts/linenumber.js"> </script>
+</body>
+</html>
\ No newline at end of file
Added: olingo/site/trunk/content/doc/javascript/apidoc/batch.js.html
URL: http://svn.apache.org/viewvc/olingo/site/trunk/content/doc/javascript/apidoc/batch.js.html?rev=1625002&view=auto
==============================================================================
--- olingo/site/trunk/content/doc/javascript/apidoc/batch.js.html (added)
+++ olingo/site/trunk/content/doc/javascript/apidoc/batch.js.html Mon Sep 15 11:55:41 2014
@@ -0,0 +1,426 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <title>JSDoc: Source: odata/batch.js</title>
+
+ <script src="scripts/prettify/prettify.js"> </script>
+ <script src="scripts/prettify/lang-css.js"> </script>
+ <!--[if lt IE 9]>
+ <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+ <![endif]-->
+ <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
+ <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
+</head>
+
+<body>
+
+<div id="main">
+
+ <h1 class="page-title">Source: odata/batch.js</h1>
+
+
+
+
+
+ <section>
+ <article>
+ <pre class="prettyprint source"><code>/*
+ * 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.
+ */
+
+/** @module odata/batch */
+
+var utils = require('./../odatajs.js').utils;
+var odataUtils = require('./utils.js');
+var odataHandler = require('./handler.js');
+
+var extend = utils.extend;
+var isArray = utils.isArray;
+var trimString = utils.trimString;
+
+var contentType = odataHandler.contentType;
+var handler = odataHandler.handler;
+var isBatch = odataUtils.isBatch;
+var MAX_DATA_SERVICE_VERSION = odataHandler.MAX_DATA_SERVICE_VERSION;
+var normalizeHeaders = odataUtils.normalizeHeaders;
+//TODO var payloadTypeOf = odata.payloadTypeOf;
+var prepareRequest = odataUtils.prepareRequest;
+
+
+
+
+
+// Imports
+
+
+
+// CONTENT START
+var batchMediaType = "multipart/mixed";
+var responseStatusRegex = /^HTTP\/1\.\d (\d{3}) (.*)$/i;
+var responseHeaderRegex = /^([^()<>@,;:\\"\/[\]?={} \t]+)\s?:\s?(.*)/;
+
+/* Calculates a random 16 bit number and returns it in hexadecimal format.
+ * @returns {String} A 16-bit number in hex format.
+ */
+function hex16() {
+
+ return Math.floor((1 + Math.random()) * 0x10000).toString(16).substr(1);
+}
+
+/* Creates a string that can be used as a multipart request boundary.
+ * @param {String} [prefix] -
+ * @returns {String} Boundary string of the format: <prefix><hex16>-<hex16>-<hex16>
+ */
+function createBoundary(prefix) {
+
+ return prefix + hex16() + "-" + hex16() + "-" + hex16();
+}
+
+/* Gets the handler for data serialization of individual requests / responses in a batch.
+ * @param context - Context used for data serialization.
+ * @returns Handler object
+ */
+function partHandler(context) {
+
+ return context.handler.partHandler;
+}
+
+/* Gets the current boundary used for parsing the body of a multipart response.
+ * @param context - Context used for parsing a multipart response.
+ * @returns {String} Boundary string.
+ */
+function currentBoundary(context) {
+ var boundaries = context.boundaries;
+ return boundaries[boundaries.length - 1];
+}
+
+/** Parses a batch response.
+ * @param handler - This handler.
+ * @param {String} text - Batch text.
+ * @param {Object} context - Object with parsing context.
+ * @return An object representation of the batch.
+ */
+function batchParser(handler, text, context) {
+
+ var boundary = context.contentType.properties["boundary"];
+ return { __batchResponses: readBatch(text, { boundaries: [boundary], handlerContext: context }) };
+}
+
+/** Serializes a batch object representation into text.
+ * @param handler - This handler.
+ * @param {Object} data - Representation of a batch.
+ * @param {Object} context - Object with parsing context.
+ * @return An text representation of the batch object; undefined if not applicable.#
+ */
+function batchSerializer(handler, data, context) {
+
+ var cType = context.contentType = context.contentType || contentType(batchMediaType);
+ if (cType.mediaType === batchMediaType) {
+ return writeBatch(data, context);
+ }
+}
+
+/* Parses a multipart/mixed response body from from the position defined by the context.
+ * @param {String} text - Body of the multipart/mixed response.
+ * @param context - Context used for parsing.
+ * @return Array of objects representing the individual responses.
+ */
+function readBatch(text, context) {
+ var delimiter = "--" + currentBoundary(context);
+
+ // Move beyond the delimiter and read the complete batch
+ readTo(text, context, delimiter);
+
+ // Ignore the incoming line
+ readLine(text, context);
+
+ // Read the batch parts
+ var responses = [];
+ var partEnd;
+
+ while (partEnd !== "--" && context.position < text.length) {
+ var partHeaders = readHeaders(text, context);
+ var partContentType = contentType(partHeaders["Content-Type"]);
+
+ var changeResponses;
+ if (partContentType && partContentType.mediaType === batchMediaType) {
+ context.boundaries.push(partContentType.properties.boundary);
+ try {
+ changeResponses = readBatch(text, context);
+ } catch (e) {
+ e.response = readResponse(text, context, delimiter);
+ changeResponses = [e];
+ }
+ responses.push({ __changeResponses: changeResponses });
+ context.boundaries.pop();
+ readTo(text, context, "--" + currentBoundary(context));
+ } else {
+ if (!partContentType || partContentType.mediaType !== "application/http") {
+ throw { message: "invalid MIME part type " };
+ }
+ // Skip empty line
+ readLine(text, context);
+ // Read the response
+ var response = readResponse(text, context, delimiter);
+ try {
+ if (response.statusCode >= 200 && response.statusCode <= 299) {
+ partHandler(context.handlerContext).read(response, context.handlerContext);
+ } else {
+ // Keep track of failed responses and continue processing the batch.
+ response = { message: "HTTP request failed", response: response };
+ }
+ } catch (e) {
+ response = e;
+ }
+
+ responses.push(response);
+ }
+
+ partEnd = text.substr(context.position, 2);
+
+ // Ignore the incoming line.
+ readLine(text, context);
+ }
+ return responses;
+}
+
+/* Parses the http headers in the text from the position defined by the context.
+* @param {String} text - Text containing an http response's headers</param>
+* @param context - Context used for parsing.
+* @returns Object containing the headers as key value pairs.
+* This function doesn't support split headers and it will stop reading when it hits two consecutive line breaks.
+*/
+function readHeaders(text, context) {
+ var headers = {};
+ var parts;
+ var line;
+ var pos;
+
+ do {
+ pos = context.position;
+ line = readLine(text, context);
+ parts = responseHeaderRegex.exec(line);
+ if (parts !== null) {
+ headers[parts[1]] = parts[2];
+ } else {
+ // Whatever was found is not a header, so reset the context position.
+ context.position = pos;
+ }
+ } while (line && parts);
+
+ normalizeHeaders(headers);
+
+ return headers;
+}
+
+/* Parses an HTTP response.
+ * @param {String} text -Text representing the http response.
+ * @param context optional - Context used for parsing.
+ * @param {String} delimiter -String used as delimiter of the multipart response parts.
+ * @return Object representing the http response.
+ */
+function readResponse(text, context, delimiter) {
+ // Read the status line.
+ var pos = context.position;
+ var match = responseStatusRegex.exec(readLine(text, context));
+
+ var statusCode;
+ var statusText;
+ var headers;
+
+ if (match) {
+ statusCode = match[1];
+ statusText = match[2];
+ headers = readHeaders(text, context);
+ readLine(text, context);
+ } else {
+ context.position = pos;
+ }
+
+ return {
+ statusCode: statusCode,
+ statusText: statusText,
+ headers: headers,
+ body: readTo(text, context, "\r\n" + delimiter)
+ };
+}
+
+/** Returns a substring from the position defined by the context up to the next line break (CRLF).
+ * @param {String} text - Input string.
+ * @param context - Context used for reading the input string.
+ * @returns {String} Substring to the first ocurrence of a line break or null if none can be found.
+ */
+function readLine(text, context) {
+
+ return readTo(text, context, "\r\n");
+}
+
+/** Returns a substring from the position given by the context up to value defined by the str parameter and increments the position in the context.
+ * @param {String} text - Input string.</param>
+ * @param context - Context used for reading the input string.</param>
+ * @param {String} [str] - Substring to read up to.
+ * @returns {String} Substring to the first ocurrence of str or the end of the input string if str is not specified. Null if the marker is not found.
+ */
+function readTo(text, context, str) {
+ var start = context.position || 0;
+ var end = text.length;
+ if (str) {
+ end = text.indexOf(str, start);
+ if (end === -1) {
+ return null;
+ }
+ context.position = end + str.length;
+ } else {
+ context.position = end;
+ }
+
+ return text.substring(start, end);
+}
+
+/** Serializes a batch request object to a string.
+ * @param data - Batch request object in payload representation format
+ * @param context - Context used for the serialization
+ * @returns {String} String representing the batch request
+ */
+function writeBatch(data, context) {
+ if (!isBatch(data)) {
+ throw { message: "Data is not a batch object." };
+ }
+
+ var batchBoundary = createBoundary("batch_");
+ var batchParts = data.__batchRequests;
+ var batch = "";
+ var i, len;
+ for (i = 0, len = batchParts.length; i < len; i++) {
+ batch += writeBatchPartDelimiter(batchBoundary, false) +
+ writeBatchPart(batchParts[i], context);
+ }
+ batch += writeBatchPartDelimiter(batchBoundary, true);
+
+ // Register the boundary with the request content type.
+ var contentTypeProperties = context.contentType.properties;
+ contentTypeProperties.boundary = batchBoundary;
+
+ return batch;
+}
+
+/** Creates the delimiter that indicates that start or end of an individual request.
+ * @param {String} boundary Boundary string used to indicate the start of the request</param>
+ * @param {Boolean} close - Flag indicating that a close delimiter string should be generated
+ * @returns {String} Delimiter string
+ */
+function writeBatchPartDelimiter(boundary, close) {
+ var result = "\r\n--" + boundary;
+ if (close) {
+ result += "--";
+ }
+
+ return result + "\r\n";
+}
+
+/** Serializes a part of a batch request to a string. A part can be either a GET request or
+ * a change set grouping several CUD (create, update, delete) requests.
+ * @param part - Request or change set object in payload representation format</param>
+ * @param context - Object containing context information used for the serialization</param>
+ * @param {boolean} [nested] -
+ * @returns {String} String representing the serialized part
+ * A change set is an array of request objects and they cannot be nested inside other change sets.
+ */
+function writeBatchPart(part, context, nested) {
+
+
+ var changeSet = part.__changeRequests;
+ var result;
+ if (isArray(changeSet)) {
+ if (nested) {
+ throw { message: "Not Supported: change set nested in other change set" };
+ }
+
+ var changeSetBoundary = createBoundary("changeset_");
+ result = "Content-Type: " + batchMediaType + "; boundary=" + changeSetBoundary + "\r\n";
+ var i, len;
+ for (i = 0, len = changeSet.length; i < len; i++) {
+ result += writeBatchPartDelimiter(changeSetBoundary, false) +
+ writeBatchPart(changeSet[i], context, true);
+ }
+
+ result += writeBatchPartDelimiter(changeSetBoundary, true);
+ } else {
+ result = "Content-Type: application/http\r\nContent-Transfer-Encoding: binary\r\n\r\n";
+ var partContext = extend({}, context);
+ partContext.handler = handler;
+ partContext.request = part;
+ partContext.contentType = null;
+
+ prepareRequest(part, partHandler(context), partContext);
+ result += writeRequest(part);
+ }
+
+ return result;
+}
+
+/* Serializes a request object to a string.
+ * @param request - Request object to serialize</param>
+ * @returns {String} String representing the serialized request
+ */
+function writeRequest(request) {
+ var result = (request.method ? request.method : "GET") + " " + request.requestUri + " HTTP/1.1\r\n";
+ for (var name in request.headers) {
+ if (request.headers[name]) {
+ result = result + name + ": " + request.headers[name] + "\r\n";
+ }
+ }
+
+ result += "\r\n";
+
+ if (request.body) {
+ result += request.body;
+ }
+
+ return result;
+}
+
+
+
+/** batchHandler (see {@link module:odata/batch~batchParser}) */
+exports.batchHandler = handler(batchParser, batchSerializer, batchMediaType, MAX_DATA_SERVICE_VERSION);
+exports.batchSerializer = batchSerializer;
+exports.writeRequest = writeRequest;</code></pre>
+ </article>
+ </section>
+
+
+
+
+</div>
+
+<nav>
+ <h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-cache.html">cache</a></li><li><a href="source.html">cache/source</a></li><li><a href="module-datajs.html">datajs</a></li><li><a href="deferred.html">datajs/deferred</a></li><li><a href="utils.html">datajs/utils</a></li><li><a href="xml.html">datajs/xml</a></li><li><a href="module-odata.html">odata</a></li><li><a href="batch.html">odata/batch</a></li><li><a href="handler.html">odata/handler</a></li><li><a href="json.html">odata/json</a></li><li><a href="metadata.html">odata/metadata</a></li><li><a href="net.html">odata/net</a></li><li><a href="utils_.html">odata/utils</a></li><li><a href="module-store.html">store</a></li><li><a href="dom.html">store/dom</a></li><li><a href="indexeddb.html">store/indexeddb</a></li><li><a href="memory.html">store/memory</a></li></ul><h3>Classes</h3><ul><li><a href="DataCache.html">DataCache</a></li><li><a href="DataCacheOperation.html">DataCacheOperation</a></li><li><a h
ref="DjsDeferred.html">DjsDeferred</a></li><li><a href="dom-DomStore.html">DomStore</a></li><li><a href="indexeddb-IndexedDBStore.html">IndexedDBStore</a></li><li><a href="memory-MemoryStore.html">MemoryStore</a></li><li><a href="ODataCacheSource.html">ODataCacheSource</a></li></ul><h3><a href="global.html">Global</a></h3>
+</nav>
+
+<br clear="both">
+
+<footer>
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.2</a> on Mon Sep 15 2014 13:07:59 GMT+0200 (MESZ)
+</footer>
+
+<script> prettyPrint(); </script>
+<script src="scripts/linenumber.js"> </script>
+</body>
+</html>