summaryrefslogtreecommitdiff
path: root/lib/dojo/data
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dojo/data')
-rw-r--r--lib/dojo/data/ItemFileReadStore.js562
-rw-r--r--lib/dojo/data/ItemFileWriteStore.js511
-rw-r--r--lib/dojo/data/api/Identity.js26
-rw-r--r--lib/dojo/data/api/Notification.js21
-rw-r--r--lib/dojo/data/api/Read.js55
-rw-r--r--lib/dojo/data/api/Request.js14
-rw-r--r--lib/dojo/data/api/Write.js39
-rw-r--r--lib/dojo/data/util/filter.js52
-rw-r--r--lib/dojo/data/util/simpleFetch.js64
-rw-r--r--lib/dojo/data/util/sorter.js66
10 files changed, 1410 insertions, 0 deletions
diff --git a/lib/dojo/data/ItemFileReadStore.js b/lib/dojo/data/ItemFileReadStore.js
new file mode 100644
index 000000000..01c15ee00
--- /dev/null
+++ b/lib/dojo/data/ItemFileReadStore.js
@@ -0,0 +1,562 @@
+/*
+ Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojo.data.ItemFileReadStore"]){
+dojo._hasResource["dojo.data.ItemFileReadStore"]=true;
+dojo.provide("dojo.data.ItemFileReadStore");
+dojo.require("dojo.data.util.filter");
+dojo.require("dojo.data.util.simpleFetch");
+dojo.require("dojo.date.stamp");
+dojo.declare("dojo.data.ItemFileReadStore",null,{constructor:function(_1){
+this._arrayOfAllItems=[];
+this._arrayOfTopLevelItems=[];
+this._loadFinished=false;
+this._jsonFileUrl=_1.url;
+this._ccUrl=_1.url;
+this.url=_1.url;
+this._jsonData=_1.data;
+this.data=null;
+this._datatypeMap=_1.typeMap||{};
+if(!this._datatypeMap["Date"]){
+this._datatypeMap["Date"]={type:Date,deserialize:function(_2){
+return dojo.date.stamp.fromISOString(_2);
+}};
+}
+this._features={"dojo.data.api.Read":true,"dojo.data.api.Identity":true};
+this._itemsByIdentity=null;
+this._storeRefPropName="_S";
+this._itemNumPropName="_0";
+this._rootItemPropName="_RI";
+this._reverseRefMap="_RRM";
+this._loadInProgress=false;
+this._queuedFetches=[];
+if(_1.urlPreventCache!==undefined){
+this.urlPreventCache=_1.urlPreventCache?true:false;
+}
+if(_1.hierarchical!==undefined){
+this.hierarchical=_1.hierarchical?true:false;
+}
+if(_1.clearOnClose){
+this.clearOnClose=true;
+}
+if("failOk" in _1){
+this.failOk=_1.failOk?true:false;
+}
+},url:"",_ccUrl:"",data:null,typeMap:null,clearOnClose:false,urlPreventCache:false,failOk:false,hierarchical:true,_assertIsItem:function(_3){
+if(!this.isItem(_3)){
+throw new Error("dojo.data.ItemFileReadStore: Invalid item argument.");
+}
+},_assertIsAttribute:function(_4){
+if(typeof _4!=="string"){
+throw new Error("dojo.data.ItemFileReadStore: Invalid attribute argument.");
+}
+},getValue:function(_5,_6,_7){
+var _8=this.getValues(_5,_6);
+return (_8.length>0)?_8[0]:_7;
+},getValues:function(_9,_a){
+this._assertIsItem(_9);
+this._assertIsAttribute(_a);
+return (_9[_a]||[]).slice(0);
+},getAttributes:function(_b){
+this._assertIsItem(_b);
+var _c=[];
+for(var _d in _b){
+if((_d!==this._storeRefPropName)&&(_d!==this._itemNumPropName)&&(_d!==this._rootItemPropName)&&(_d!==this._reverseRefMap)){
+_c.push(_d);
+}
+}
+return _c;
+},hasAttribute:function(_e,_f){
+this._assertIsItem(_e);
+this._assertIsAttribute(_f);
+return (_f in _e);
+},containsValue:function(_10,_11,_12){
+var _13=undefined;
+if(typeof _12==="string"){
+_13=dojo.data.util.filter.patternToRegExp(_12,false);
+}
+return this._containsValue(_10,_11,_12,_13);
+},_containsValue:function(_14,_15,_16,_17){
+return dojo.some(this.getValues(_14,_15),function(_18){
+if(_18!==null&&!dojo.isObject(_18)&&_17){
+if(_18.toString().match(_17)){
+return true;
+}
+}else{
+if(_16===_18){
+return true;
+}
+}
+});
+},isItem:function(_19){
+if(_19&&_19[this._storeRefPropName]===this){
+if(this._arrayOfAllItems[_19[this._itemNumPropName]]===_19){
+return true;
+}
+}
+return false;
+},isItemLoaded:function(_1a){
+return this.isItem(_1a);
+},loadItem:function(_1b){
+this._assertIsItem(_1b.item);
+},getFeatures:function(){
+return this._features;
+},getLabel:function(_1c){
+if(this._labelAttr&&this.isItem(_1c)){
+return this.getValue(_1c,this._labelAttr);
+}
+return undefined;
+},getLabelAttributes:function(_1d){
+if(this._labelAttr){
+return [this._labelAttr];
+}
+return null;
+},_fetchItems:function(_1e,_1f,_20){
+var _21=this,_22=function(_23,_24){
+var _25=[],i,key;
+if(_23.query){
+var _26,_27=_23.queryOptions?_23.queryOptions.ignoreCase:false;
+var _28={};
+for(key in _23.query){
+_26=_23.query[key];
+if(typeof _26==="string"){
+_28[key]=dojo.data.util.filter.patternToRegExp(_26,_27);
+}else{
+if(_26 instanceof RegExp){
+_28[key]=_26;
+}
+}
+}
+for(i=0;i<_24.length;++i){
+var _29=true;
+var _2a=_24[i];
+if(_2a===null){
+_29=false;
+}else{
+for(key in _23.query){
+_26=_23.query[key];
+if(!_21._containsValue(_2a,key,_26,_28[key])){
+_29=false;
+}
+}
+}
+if(_29){
+_25.push(_2a);
+}
+}
+_1f(_25,_23);
+}else{
+for(i=0;i<_24.length;++i){
+var _2b=_24[i];
+if(_2b!==null){
+_25.push(_2b);
+}
+}
+_1f(_25,_23);
+}
+};
+if(this._loadFinished){
+_22(_1e,this._getItemsArray(_1e.queryOptions));
+}else{
+if(this._jsonFileUrl!==this._ccUrl){
+dojo.deprecated("dojo.data.ItemFileReadStore: ","To change the url, set the url property of the store,"+" not _jsonFileUrl. _jsonFileUrl support will be removed in 2.0");
+this._ccUrl=this._jsonFileUrl;
+this.url=this._jsonFileUrl;
+}else{
+if(this.url!==this._ccUrl){
+this._jsonFileUrl=this.url;
+this._ccUrl=this.url;
+}
+}
+if(this.data!=null&&this._jsonData==null){
+this._jsonData=this.data;
+this.data=null;
+}
+if(this._jsonFileUrl){
+if(this._loadInProgress){
+this._queuedFetches.push({args:_1e,filter:_22});
+}else{
+this._loadInProgress=true;
+var _2c={url:_21._jsonFileUrl,handleAs:"json-comment-optional",preventCache:this.urlPreventCache,failOk:this.failOk};
+var _2d=dojo.xhrGet(_2c);
+_2d.addCallback(function(_2e){
+try{
+_21._getItemsFromLoadedData(_2e);
+_21._loadFinished=true;
+_21._loadInProgress=false;
+_22(_1e,_21._getItemsArray(_1e.queryOptions));
+_21._handleQueuedFetches();
+}
+catch(e){
+_21._loadFinished=true;
+_21._loadInProgress=false;
+_20(e,_1e);
+}
+});
+_2d.addErrback(function(_2f){
+_21._loadInProgress=false;
+_20(_2f,_1e);
+});
+var _30=null;
+if(_1e.abort){
+_30=_1e.abort;
+}
+_1e.abort=function(){
+var df=_2d;
+if(df&&df.fired===-1){
+df.cancel();
+df=null;
+}
+if(_30){
+_30.call(_1e);
+}
+};
+}
+}else{
+if(this._jsonData){
+try{
+this._loadFinished=true;
+this._getItemsFromLoadedData(this._jsonData);
+this._jsonData=null;
+_22(_1e,this._getItemsArray(_1e.queryOptions));
+}
+catch(e){
+_20(e,_1e);
+}
+}else{
+_20(new Error("dojo.data.ItemFileReadStore: No JSON source data was provided as either URL or a nested Javascript object."),_1e);
+}
+}
+}
+},_handleQueuedFetches:function(){
+if(this._queuedFetches.length>0){
+for(var i=0;i<this._queuedFetches.length;i++){
+var _31=this._queuedFetches[i],_32=_31.args,_33=_31.filter;
+if(_33){
+_33(_32,this._getItemsArray(_32.queryOptions));
+}else{
+this.fetchItemByIdentity(_32);
+}
+}
+this._queuedFetches=[];
+}
+},_getItemsArray:function(_34){
+if(_34&&_34.deep){
+return this._arrayOfAllItems;
+}
+return this._arrayOfTopLevelItems;
+},close:function(_35){
+if(this.clearOnClose&&this._loadFinished&&!this._loadInProgress){
+if(((this._jsonFileUrl==""||this._jsonFileUrl==null)&&(this.url==""||this.url==null))&&this.data==null){
+}
+this._arrayOfAllItems=[];
+this._arrayOfTopLevelItems=[];
+this._loadFinished=false;
+this._itemsByIdentity=null;
+this._loadInProgress=false;
+this._queuedFetches=[];
+}
+},_getItemsFromLoadedData:function(_36){
+var _37=false,_38=this;
+function _39(_3a){
+var _3b=((_3a!==null)&&(typeof _3a==="object")&&(!dojo.isArray(_3a)||_37)&&(!dojo.isFunction(_3a))&&(_3a.constructor==Object||dojo.isArray(_3a))&&(typeof _3a._reference==="undefined")&&(typeof _3a._type==="undefined")&&(typeof _3a._value==="undefined")&&_38.hierarchical);
+return _3b;
+};
+function _3c(_3d){
+_38._arrayOfAllItems.push(_3d);
+for(var _3e in _3d){
+var _3f=_3d[_3e];
+if(_3f){
+if(dojo.isArray(_3f)){
+var _40=_3f;
+for(var k=0;k<_40.length;++k){
+var _41=_40[k];
+if(_39(_41)){
+_3c(_41);
+}
+}
+}else{
+if(_39(_3f)){
+_3c(_3f);
+}
+}
+}
+}
+};
+this._labelAttr=_36.label;
+var i,_42;
+this._arrayOfAllItems=[];
+this._arrayOfTopLevelItems=_36.items;
+for(i=0;i<this._arrayOfTopLevelItems.length;++i){
+_42=this._arrayOfTopLevelItems[i];
+if(dojo.isArray(_42)){
+_37=true;
+}
+_3c(_42);
+_42[this._rootItemPropName]=true;
+}
+var _43={},key;
+for(i=0;i<this._arrayOfAllItems.length;++i){
+_42=this._arrayOfAllItems[i];
+for(key in _42){
+if(key!==this._rootItemPropName){
+var _44=_42[key];
+if(_44!==null){
+if(!dojo.isArray(_44)){
+_42[key]=[_44];
+}
+}else{
+_42[key]=[null];
+}
+}
+_43[key]=key;
+}
+}
+while(_43[this._storeRefPropName]){
+this._storeRefPropName+="_";
+}
+while(_43[this._itemNumPropName]){
+this._itemNumPropName+="_";
+}
+while(_43[this._reverseRefMap]){
+this._reverseRefMap+="_";
+}
+var _45;
+var _46=_36.identifier;
+if(_46){
+this._itemsByIdentity={};
+this._features["dojo.data.api.Identity"]=_46;
+for(i=0;i<this._arrayOfAllItems.length;++i){
+_42=this._arrayOfAllItems[i];
+_45=_42[_46];
+var _47=_45[0];
+if(!this._itemsByIdentity[_47]){
+this._itemsByIdentity[_47]=_42;
+}else{
+if(this._jsonFileUrl){
+throw new Error("dojo.data.ItemFileReadStore: The json data as specified by: ["+this._jsonFileUrl+"] is malformed. Items within the list have identifier: ["+_46+"]. Value collided: ["+_47+"]");
+}else{
+if(this._jsonData){
+throw new Error("dojo.data.ItemFileReadStore: The json data provided by the creation arguments is malformed. Items within the list have identifier: ["+_46+"]. Value collided: ["+_47+"]");
+}
+}
+}
+}
+}else{
+this._features["dojo.data.api.Identity"]=Number;
+}
+for(i=0;i<this._arrayOfAllItems.length;++i){
+_42=this._arrayOfAllItems[i];
+_42[this._storeRefPropName]=this;
+_42[this._itemNumPropName]=i;
+}
+for(i=0;i<this._arrayOfAllItems.length;++i){
+_42=this._arrayOfAllItems[i];
+for(key in _42){
+_45=_42[key];
+for(var j=0;j<_45.length;++j){
+_44=_45[j];
+if(_44!==null&&typeof _44=="object"){
+if(("_type" in _44)&&("_value" in _44)){
+var _48=_44._type;
+var _49=this._datatypeMap[_48];
+if(!_49){
+throw new Error("dojo.data.ItemFileReadStore: in the typeMap constructor arg, no object class was specified for the datatype '"+_48+"'");
+}else{
+if(dojo.isFunction(_49)){
+_45[j]=new _49(_44._value);
+}else{
+if(dojo.isFunction(_49.deserialize)){
+_45[j]=_49.deserialize(_44._value);
+}else{
+throw new Error("dojo.data.ItemFileReadStore: Value provided in typeMap was neither a constructor, nor a an object with a deserialize function");
+}
+}
+}
+}
+if(_44._reference){
+var _4a=_44._reference;
+if(!dojo.isObject(_4a)){
+_45[j]=this._getItemByIdentity(_4a);
+}else{
+for(var k=0;k<this._arrayOfAllItems.length;++k){
+var _4b=this._arrayOfAllItems[k],_4c=true;
+for(var _4d in _4a){
+if(_4b[_4d]!=_4a[_4d]){
+_4c=false;
+}
+}
+if(_4c){
+_45[j]=_4b;
+}
+}
+}
+if(this.referenceIntegrity){
+var _4e=_45[j];
+if(this.isItem(_4e)){
+this._addReferenceToMap(_4e,_42,key);
+}
+}
+}else{
+if(this.isItem(_44)){
+if(this.referenceIntegrity){
+this._addReferenceToMap(_44,_42,key);
+}
+}
+}
+}
+}
+}
+}
+},_addReferenceToMap:function(_4f,_50,_51){
+},getIdentity:function(_52){
+var _53=this._features["dojo.data.api.Identity"];
+if(_53===Number){
+return _52[this._itemNumPropName];
+}else{
+var _54=_52[_53];
+if(_54){
+return _54[0];
+}
+}
+return null;
+},fetchItemByIdentity:function(_55){
+var _56,_57;
+if(!this._loadFinished){
+var _58=this;
+if(this._jsonFileUrl!==this._ccUrl){
+dojo.deprecated("dojo.data.ItemFileReadStore: ","To change the url, set the url property of the store,"+" not _jsonFileUrl. _jsonFileUrl support will be removed in 2.0");
+this._ccUrl=this._jsonFileUrl;
+this.url=this._jsonFileUrl;
+}else{
+if(this.url!==this._ccUrl){
+this._jsonFileUrl=this.url;
+this._ccUrl=this.url;
+}
+}
+if(this.data!=null&&this._jsonData==null){
+this._jsonData=this.data;
+this.data=null;
+}
+if(this._jsonFileUrl){
+if(this._loadInProgress){
+this._queuedFetches.push({args:_55});
+}else{
+this._loadInProgress=true;
+var _59={url:_58._jsonFileUrl,handleAs:"json-comment-optional",preventCache:this.urlPreventCache,failOk:this.failOk};
+var _5a=dojo.xhrGet(_59);
+_5a.addCallback(function(_5b){
+var _5c=_55.scope?_55.scope:dojo.global;
+try{
+_58._getItemsFromLoadedData(_5b);
+_58._loadFinished=true;
+_58._loadInProgress=false;
+_56=_58._getItemByIdentity(_55.identity);
+if(_55.onItem){
+_55.onItem.call(_5c,_56);
+}
+_58._handleQueuedFetches();
+}
+catch(error){
+_58._loadInProgress=false;
+if(_55.onError){
+_55.onError.call(_5c,error);
+}
+}
+});
+_5a.addErrback(function(_5d){
+_58._loadInProgress=false;
+if(_55.onError){
+var _5e=_55.scope?_55.scope:dojo.global;
+_55.onError.call(_5e,_5d);
+}
+});
+}
+}else{
+if(this._jsonData){
+_58._getItemsFromLoadedData(_58._jsonData);
+_58._jsonData=null;
+_58._loadFinished=true;
+_56=_58._getItemByIdentity(_55.identity);
+if(_55.onItem){
+_57=_55.scope?_55.scope:dojo.global;
+_55.onItem.call(_57,_56);
+}
+}
+}
+}else{
+_56=this._getItemByIdentity(_55.identity);
+if(_55.onItem){
+_57=_55.scope?_55.scope:dojo.global;
+_55.onItem.call(_57,_56);
+}
+}
+},_getItemByIdentity:function(_5f){
+var _60=null;
+if(this._itemsByIdentity){
+_60=this._itemsByIdentity[_5f];
+}else{
+_60=this._arrayOfAllItems[_5f];
+}
+if(_60===undefined){
+_60=null;
+}
+return _60;
+},getIdentityAttributes:function(_61){
+var _62=this._features["dojo.data.api.Identity"];
+if(_62===Number){
+return null;
+}else{
+return [_62];
+}
+},_forceLoad:function(){
+var _63=this;
+if(this._jsonFileUrl!==this._ccUrl){
+dojo.deprecated("dojo.data.ItemFileReadStore: ","To change the url, set the url property of the store,"+" not _jsonFileUrl. _jsonFileUrl support will be removed in 2.0");
+this._ccUrl=this._jsonFileUrl;
+this.url=this._jsonFileUrl;
+}else{
+if(this.url!==this._ccUrl){
+this._jsonFileUrl=this.url;
+this._ccUrl=this.url;
+}
+}
+if(this.data!=null&&this._jsonData==null){
+this._jsonData=this.data;
+this.data=null;
+}
+if(this._jsonFileUrl){
+var _64={url:this._jsonFileUrl,handleAs:"json-comment-optional",preventCache:this.urlPreventCache,failOk:this.failOk,sync:true};
+var _65=dojo.xhrGet(_64);
+_65.addCallback(function(_66){
+try{
+if(_63._loadInProgress!==true&&!_63._loadFinished){
+_63._getItemsFromLoadedData(_66);
+_63._loadFinished=true;
+}else{
+if(_63._loadInProgress){
+throw new Error("dojo.data.ItemFileReadStore: Unable to perform a synchronous load, an async load is in progress.");
+}
+}
+}
+catch(e){
+throw e;
+}
+});
+_65.addErrback(function(_67){
+throw _67;
+});
+}else{
+if(this._jsonData){
+_63._getItemsFromLoadedData(_63._jsonData);
+_63._jsonData=null;
+_63._loadFinished=true;
+}
+}
+}});
+dojo.extend(dojo.data.ItemFileReadStore,dojo.data.util.simpleFetch);
+}
diff --git a/lib/dojo/data/ItemFileWriteStore.js b/lib/dojo/data/ItemFileWriteStore.js
new file mode 100644
index 000000000..c891c14e7
--- /dev/null
+++ b/lib/dojo/data/ItemFileWriteStore.js
@@ -0,0 +1,511 @@
+/*
+ Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojo.data.ItemFileWriteStore"]){
+dojo._hasResource["dojo.data.ItemFileWriteStore"]=true;
+dojo.provide("dojo.data.ItemFileWriteStore");
+dojo.require("dojo.data.ItemFileReadStore");
+dojo.declare("dojo.data.ItemFileWriteStore",dojo.data.ItemFileReadStore,{constructor:function(_1){
+this._features["dojo.data.api.Write"]=true;
+this._features["dojo.data.api.Notification"]=true;
+this._pending={_newItems:{},_modifiedItems:{},_deletedItems:{}};
+if(!this._datatypeMap["Date"].serialize){
+this._datatypeMap["Date"].serialize=function(_2){
+return dojo.date.stamp.toISOString(_2,{zulu:true});
+};
+}
+if(_1&&(_1.referenceIntegrity===false)){
+this.referenceIntegrity=false;
+}
+this._saveInProgress=false;
+},referenceIntegrity:true,_assert:function(_3){
+if(!_3){
+throw new Error("assertion failed in ItemFileWriteStore");
+}
+},_getIdentifierAttribute:function(){
+var _4=this.getFeatures()["dojo.data.api.Identity"];
+return _4;
+},newItem:function(_5,_6){
+this._assert(!this._saveInProgress);
+if(!this._loadFinished){
+this._forceLoad();
+}
+if(typeof _5!="object"&&typeof _5!="undefined"){
+throw new Error("newItem() was passed something other than an object");
+}
+var _7=null;
+var _8=this._getIdentifierAttribute();
+if(_8===Number){
+_7=this._arrayOfAllItems.length;
+}else{
+_7=_5[_8];
+if(typeof _7==="undefined"){
+throw new Error("newItem() was not passed an identity for the new item");
+}
+if(dojo.isArray(_7)){
+throw new Error("newItem() was not passed an single-valued identity");
+}
+}
+if(this._itemsByIdentity){
+this._assert(typeof this._itemsByIdentity[_7]==="undefined");
+}
+this._assert(typeof this._pending._newItems[_7]==="undefined");
+this._assert(typeof this._pending._deletedItems[_7]==="undefined");
+var _9={};
+_9[this._storeRefPropName]=this;
+_9[this._itemNumPropName]=this._arrayOfAllItems.length;
+if(this._itemsByIdentity){
+this._itemsByIdentity[_7]=_9;
+_9[_8]=[_7];
+}
+this._arrayOfAllItems.push(_9);
+var _a=null;
+if(_6&&_6.parent&&_6.attribute){
+_a={item:_6.parent,attribute:_6.attribute,oldValue:undefined};
+var _b=this.getValues(_6.parent,_6.attribute);
+if(_b&&_b.length>0){
+var _c=_b.slice(0,_b.length);
+if(_b.length===1){
+_a.oldValue=_b[0];
+}else{
+_a.oldValue=_b.slice(0,_b.length);
+}
+_c.push(_9);
+this._setValueOrValues(_6.parent,_6.attribute,_c,false);
+_a.newValue=this.getValues(_6.parent,_6.attribute);
+}else{
+this._setValueOrValues(_6.parent,_6.attribute,_9,false);
+_a.newValue=_9;
+}
+}else{
+_9[this._rootItemPropName]=true;
+this._arrayOfTopLevelItems.push(_9);
+}
+this._pending._newItems[_7]=_9;
+for(var _d in _5){
+if(_d===this._storeRefPropName||_d===this._itemNumPropName){
+throw new Error("encountered bug in ItemFileWriteStore.newItem");
+}
+var _e=_5[_d];
+if(!dojo.isArray(_e)){
+_e=[_e];
+}
+_9[_d]=_e;
+if(this.referenceIntegrity){
+for(var i=0;i<_e.length;i++){
+var _f=_e[i];
+if(this.isItem(_f)){
+this._addReferenceToMap(_f,_9,_d);
+}
+}
+}
+}
+this.onNew(_9,_a);
+return _9;
+},_removeArrayElement:function(_10,_11){
+var _12=dojo.indexOf(_10,_11);
+if(_12!=-1){
+_10.splice(_12,1);
+return true;
+}
+return false;
+},deleteItem:function(_13){
+this._assert(!this._saveInProgress);
+this._assertIsItem(_13);
+var _14=_13[this._itemNumPropName];
+var _15=this.getIdentity(_13);
+if(this.referenceIntegrity){
+var _16=this.getAttributes(_13);
+if(_13[this._reverseRefMap]){
+_13["backup_"+this._reverseRefMap]=dojo.clone(_13[this._reverseRefMap]);
+}
+dojo.forEach(_16,function(_17){
+dojo.forEach(this.getValues(_13,_17),function(_18){
+if(this.isItem(_18)){
+if(!_13["backupRefs_"+this._reverseRefMap]){
+_13["backupRefs_"+this._reverseRefMap]=[];
+}
+_13["backupRefs_"+this._reverseRefMap].push({id:this.getIdentity(_18),attr:_17});
+this._removeReferenceFromMap(_18,_13,_17);
+}
+},this);
+},this);
+var _19=_13[this._reverseRefMap];
+if(_19){
+for(var _1a in _19){
+var _1b=null;
+if(this._itemsByIdentity){
+_1b=this._itemsByIdentity[_1a];
+}else{
+_1b=this._arrayOfAllItems[_1a];
+}
+if(_1b){
+for(var _1c in _19[_1a]){
+var _1d=this.getValues(_1b,_1c)||[];
+var _1e=dojo.filter(_1d,function(_1f){
+return !(this.isItem(_1f)&&this.getIdentity(_1f)==_15);
+},this);
+this._removeReferenceFromMap(_13,_1b,_1c);
+if(_1e.length<_1d.length){
+this._setValueOrValues(_1b,_1c,_1e,true);
+}
+}
+}
+}
+}
+}
+this._arrayOfAllItems[_14]=null;
+_13[this._storeRefPropName]=null;
+if(this._itemsByIdentity){
+delete this._itemsByIdentity[_15];
+}
+this._pending._deletedItems[_15]=_13;
+if(_13[this._rootItemPropName]){
+this._removeArrayElement(this._arrayOfTopLevelItems,_13);
+}
+this.onDelete(_13);
+return true;
+},setValue:function(_20,_21,_22){
+return this._setValueOrValues(_20,_21,_22,true);
+},setValues:function(_23,_24,_25){
+return this._setValueOrValues(_23,_24,_25,true);
+},unsetAttribute:function(_26,_27){
+return this._setValueOrValues(_26,_27,[],true);
+},_setValueOrValues:function(_28,_29,_2a,_2b){
+this._assert(!this._saveInProgress);
+this._assertIsItem(_28);
+this._assert(dojo.isString(_29));
+this._assert(typeof _2a!=="undefined");
+var _2c=this._getIdentifierAttribute();
+if(_29==_2c){
+throw new Error("ItemFileWriteStore does not have support for changing the value of an item's identifier.");
+}
+var _2d=this._getValueOrValues(_28,_29);
+var _2e=this.getIdentity(_28);
+if(!this._pending._modifiedItems[_2e]){
+var _2f={};
+for(var key in _28){
+if((key===this._storeRefPropName)||(key===this._itemNumPropName)||(key===this._rootItemPropName)){
+_2f[key]=_28[key];
+}else{
+if(key===this._reverseRefMap){
+_2f[key]=dojo.clone(_28[key]);
+}else{
+_2f[key]=_28[key].slice(0,_28[key].length);
+}
+}
+}
+this._pending._modifiedItems[_2e]=_2f;
+}
+var _30=false;
+if(dojo.isArray(_2a)&&_2a.length===0){
+_30=delete _28[_29];
+_2a=undefined;
+if(this.referenceIntegrity&&_2d){
+var _31=_2d;
+if(!dojo.isArray(_31)){
+_31=[_31];
+}
+for(var i=0;i<_31.length;i++){
+var _32=_31[i];
+if(this.isItem(_32)){
+this._removeReferenceFromMap(_32,_28,_29);
+}
+}
+}
+}else{
+var _33;
+if(dojo.isArray(_2a)){
+var _34=_2a;
+_33=_2a.slice(0,_2a.length);
+}else{
+_33=[_2a];
+}
+if(this.referenceIntegrity){
+if(_2d){
+var _31=_2d;
+if(!dojo.isArray(_31)){
+_31=[_31];
+}
+var map={};
+dojo.forEach(_31,function(_35){
+if(this.isItem(_35)){
+var id=this.getIdentity(_35);
+map[id.toString()]=true;
+}
+},this);
+dojo.forEach(_33,function(_36){
+if(this.isItem(_36)){
+var id=this.getIdentity(_36);
+if(map[id.toString()]){
+delete map[id.toString()];
+}else{
+this._addReferenceToMap(_36,_28,_29);
+}
+}
+},this);
+for(var rId in map){
+var _37;
+if(this._itemsByIdentity){
+_37=this._itemsByIdentity[rId];
+}else{
+_37=this._arrayOfAllItems[rId];
+}
+this._removeReferenceFromMap(_37,_28,_29);
+}
+}else{
+for(var i=0;i<_33.length;i++){
+var _32=_33[i];
+if(this.isItem(_32)){
+this._addReferenceToMap(_32,_28,_29);
+}
+}
+}
+}
+_28[_29]=_33;
+_30=true;
+}
+if(_2b){
+this.onSet(_28,_29,_2d,_2a);
+}
+return _30;
+},_addReferenceToMap:function(_38,_39,_3a){
+var _3b=this.getIdentity(_39);
+var _3c=_38[this._reverseRefMap];
+if(!_3c){
+_3c=_38[this._reverseRefMap]={};
+}
+var _3d=_3c[_3b];
+if(!_3d){
+_3d=_3c[_3b]={};
+}
+_3d[_3a]=true;
+},_removeReferenceFromMap:function(_3e,_3f,_40){
+var _41=this.getIdentity(_3f);
+var _42=_3e[this._reverseRefMap];
+var _43;
+if(_42){
+for(_43 in _42){
+if(_43==_41){
+delete _42[_43][_40];
+if(this._isEmpty(_42[_43])){
+delete _42[_43];
+}
+}
+}
+if(this._isEmpty(_42)){
+delete _3e[this._reverseRefMap];
+}
+}
+},_dumpReferenceMap:function(){
+var i;
+for(i=0;i<this._arrayOfAllItems.length;i++){
+var _44=this._arrayOfAllItems[i];
+if(_44&&_44[this._reverseRefMap]){
+}
+}
+},_getValueOrValues:function(_45,_46){
+var _47=undefined;
+if(this.hasAttribute(_45,_46)){
+var _48=this.getValues(_45,_46);
+if(_48.length==1){
+_47=_48[0];
+}else{
+_47=_48;
+}
+}
+return _47;
+},_flatten:function(_49){
+if(this.isItem(_49)){
+var _4a=_49;
+var _4b=this.getIdentity(_4a);
+var _4c={_reference:_4b};
+return _4c;
+}else{
+if(typeof _49==="object"){
+for(var _4d in this._datatypeMap){
+var _4e=this._datatypeMap[_4d];
+if(dojo.isObject(_4e)&&!dojo.isFunction(_4e)){
+if(_49 instanceof _4e.type){
+if(!_4e.serialize){
+throw new Error("ItemFileWriteStore: No serializer defined for type mapping: ["+_4d+"]");
+}
+return {_type:_4d,_value:_4e.serialize(_49)};
+}
+}else{
+if(_49 instanceof _4e){
+return {_type:_4d,_value:_49.toString()};
+}
+}
+}
+}
+return _49;
+}
+},_getNewFileContentString:function(){
+var _4f={};
+var _50=this._getIdentifierAttribute();
+if(_50!==Number){
+_4f.identifier=_50;
+}
+if(this._labelAttr){
+_4f.label=this._labelAttr;
+}
+_4f.items=[];
+for(var i=0;i<this._arrayOfAllItems.length;++i){
+var _51=this._arrayOfAllItems[i];
+if(_51!==null){
+var _52={};
+for(var key in _51){
+if(key!==this._storeRefPropName&&key!==this._itemNumPropName&&key!==this._reverseRefMap&&key!==this._rootItemPropName){
+var _53=key;
+var _54=this.getValues(_51,_53);
+if(_54.length==1){
+_52[_53]=this._flatten(_54[0]);
+}else{
+var _55=[];
+for(var j=0;j<_54.length;++j){
+_55.push(this._flatten(_54[j]));
+_52[_53]=_55;
+}
+}
+}
+}
+_4f.items.push(_52);
+}
+}
+var _56=true;
+return dojo.toJson(_4f,_56);
+},_isEmpty:function(_57){
+var _58=true;
+if(dojo.isObject(_57)){
+var i;
+for(i in _57){
+_58=false;
+break;
+}
+}else{
+if(dojo.isArray(_57)){
+if(_57.length>0){
+_58=false;
+}
+}
+}
+return _58;
+},save:function(_59){
+this._assert(!this._saveInProgress);
+this._saveInProgress=true;
+var _5a=this;
+var _5b=function(){
+_5a._pending={_newItems:{},_modifiedItems:{},_deletedItems:{}};
+_5a._saveInProgress=false;
+if(_59&&_59.onComplete){
+var _5c=_59.scope||dojo.global;
+_59.onComplete.call(_5c);
+}
+};
+var _5d=function(err){
+_5a._saveInProgress=false;
+if(_59&&_59.onError){
+var _5e=_59.scope||dojo.global;
+_59.onError.call(_5e,err);
+}
+};
+if(this._saveEverything){
+var _5f=this._getNewFileContentString();
+this._saveEverything(_5b,_5d,_5f);
+}
+if(this._saveCustom){
+this._saveCustom(_5b,_5d);
+}
+if(!this._saveEverything&&!this._saveCustom){
+_5b();
+}
+},revert:function(){
+this._assert(!this._saveInProgress);
+var _60;
+for(_60 in this._pending._modifiedItems){
+var _61=this._pending._modifiedItems[_60];
+var _62=null;
+if(this._itemsByIdentity){
+_62=this._itemsByIdentity[_60];
+}else{
+_62=this._arrayOfAllItems[_60];
+}
+_61[this._storeRefPropName]=this;
+for(key in _62){
+delete _62[key];
+}
+dojo.mixin(_62,_61);
+}
+var _63;
+for(_60 in this._pending._deletedItems){
+_63=this._pending._deletedItems[_60];
+_63[this._storeRefPropName]=this;
+var _64=_63[this._itemNumPropName];
+if(_63["backup_"+this._reverseRefMap]){
+_63[this._reverseRefMap]=_63["backup_"+this._reverseRefMap];
+delete _63["backup_"+this._reverseRefMap];
+}
+this._arrayOfAllItems[_64]=_63;
+if(this._itemsByIdentity){
+this._itemsByIdentity[_60]=_63;
+}
+if(_63[this._rootItemPropName]){
+this._arrayOfTopLevelItems.push(_63);
+}
+}
+for(_60 in this._pending._deletedItems){
+_63=this._pending._deletedItems[_60];
+if(_63["backupRefs_"+this._reverseRefMap]){
+dojo.forEach(_63["backupRefs_"+this._reverseRefMap],function(_65){
+var _66;
+if(this._itemsByIdentity){
+_66=this._itemsByIdentity[_65.id];
+}else{
+_66=this._arrayOfAllItems[_65.id];
+}
+this._addReferenceToMap(_66,_63,_65.attr);
+},this);
+delete _63["backupRefs_"+this._reverseRefMap];
+}
+}
+for(_60 in this._pending._newItems){
+var _67=this._pending._newItems[_60];
+_67[this._storeRefPropName]=null;
+this._arrayOfAllItems[_67[this._itemNumPropName]]=null;
+if(_67[this._rootItemPropName]){
+this._removeArrayElement(this._arrayOfTopLevelItems,_67);
+}
+if(this._itemsByIdentity){
+delete this._itemsByIdentity[_60];
+}
+}
+this._pending={_newItems:{},_modifiedItems:{},_deletedItems:{}};
+return true;
+},isDirty:function(_68){
+if(_68){
+var _69=this.getIdentity(_68);
+return new Boolean(this._pending._newItems[_69]||this._pending._modifiedItems[_69]||this._pending._deletedItems[_69]).valueOf();
+}else{
+if(!this._isEmpty(this._pending._newItems)||!this._isEmpty(this._pending._modifiedItems)||!this._isEmpty(this._pending._deletedItems)){
+return true;
+}
+return false;
+}
+},onSet:function(_6a,_6b,_6c,_6d){
+},onNew:function(_6e,_6f){
+},onDelete:function(_70){
+},close:function(_71){
+if(this.clearOnClose){
+if(!this.isDirty()){
+this.inherited(arguments);
+}else{
+throw new Error("dojo.data.ItemFileWriteStore: There are unsaved changes present in the store. Please save or revert the changes before invoking close.");
+}
+}
+}});
+}
diff --git a/lib/dojo/data/api/Identity.js b/lib/dojo/data/api/Identity.js
new file mode 100644
index 000000000..a76dd481c
--- /dev/null
+++ b/lib/dojo/data/api/Identity.js
@@ -0,0 +1,26 @@
+/*
+ Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojo.data.api.Identity"]){
+dojo._hasResource["dojo.data.api.Identity"]=true;
+dojo.provide("dojo.data.api.Identity");
+dojo.require("dojo.data.api.Read");
+dojo.declare("dojo.data.api.Identity",dojo.data.api.Read,{getFeatures:function(){
+return {"dojo.data.api.Read":true,"dojo.data.api.Identity":true};
+},getIdentity:function(_1){
+throw new Error("Unimplemented API: dojo.data.api.Identity.getIdentity");
+var _2=null;
+return _2;
+},getIdentityAttributes:function(_3){
+throw new Error("Unimplemented API: dojo.data.api.Identity.getIdentityAttributes");
+return null;
+},fetchItemByIdentity:function(_4){
+if(!this.isItemLoaded(_4.item)){
+throw new Error("Unimplemented API: dojo.data.api.Identity.fetchItemByIdentity");
+}
+}});
+}
diff --git a/lib/dojo/data/api/Notification.js b/lib/dojo/data/api/Notification.js
new file mode 100644
index 000000000..d1afacda7
--- /dev/null
+++ b/lib/dojo/data/api/Notification.js
@@ -0,0 +1,21 @@
+/*
+ Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojo.data.api.Notification"]){
+dojo._hasResource["dojo.data.api.Notification"]=true;
+dojo.provide("dojo.data.api.Notification");
+dojo.require("dojo.data.api.Read");
+dojo.declare("dojo.data.api.Notification",dojo.data.api.Read,{getFeatures:function(){
+return {"dojo.data.api.Read":true,"dojo.data.api.Notification":true};
+},onSet:function(_1,_2,_3,_4){
+throw new Error("Unimplemented API: dojo.data.api.Notification.onSet");
+},onNew:function(_5,_6){
+throw new Error("Unimplemented API: dojo.data.api.Notification.onNew");
+},onDelete:function(_7){
+throw new Error("Unimplemented API: dojo.data.api.Notification.onDelete");
+}});
+}
diff --git a/lib/dojo/data/api/Read.js b/lib/dojo/data/api/Read.js
new file mode 100644
index 000000000..e5e543e98
--- /dev/null
+++ b/lib/dojo/data/api/Read.js
@@ -0,0 +1,55 @@
+/*
+ Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojo.data.api.Read"]){
+dojo._hasResource["dojo.data.api.Read"]=true;
+dojo.provide("dojo.data.api.Read");
+dojo.require("dojo.data.api.Request");
+dojo.declare("dojo.data.api.Read",null,{getValue:function(_1,_2,_3){
+var _4=null;
+throw new Error("Unimplemented API: dojo.data.api.Read.getValue");
+return _4;
+},getValues:function(_5,_6){
+var _7=[];
+throw new Error("Unimplemented API: dojo.data.api.Read.getValues");
+return _7;
+},getAttributes:function(_8){
+var _9=[];
+throw new Error("Unimplemented API: dojo.data.api.Read.getAttributes");
+return _9;
+},hasAttribute:function(_a,_b){
+throw new Error("Unimplemented API: dojo.data.api.Read.hasAttribute");
+return false;
+},containsValue:function(_c,_d,_e){
+throw new Error("Unimplemented API: dojo.data.api.Read.containsValue");
+return false;
+},isItem:function(_f){
+throw new Error("Unimplemented API: dojo.data.api.Read.isItem");
+return false;
+},isItemLoaded:function(_10){
+throw new Error("Unimplemented API: dojo.data.api.Read.isItemLoaded");
+return false;
+},loadItem:function(_11){
+if(!this.isItemLoaded(_11.item)){
+throw new Error("Unimplemented API: dojo.data.api.Read.loadItem");
+}
+},fetch:function(_12){
+var _13=null;
+throw new Error("Unimplemented API: dojo.data.api.Read.fetch");
+return _13;
+},getFeatures:function(){
+return {"dojo.data.api.Read":true};
+},close:function(_14){
+throw new Error("Unimplemented API: dojo.data.api.Read.close");
+},getLabel:function(_15){
+throw new Error("Unimplemented API: dojo.data.api.Read.getLabel");
+return undefined;
+},getLabelAttributes:function(_16){
+throw new Error("Unimplemented API: dojo.data.api.Read.getLabelAttributes");
+return null;
+}});
+}
diff --git a/lib/dojo/data/api/Request.js b/lib/dojo/data/api/Request.js
new file mode 100644
index 000000000..2d8e0e044
--- /dev/null
+++ b/lib/dojo/data/api/Request.js
@@ -0,0 +1,14 @@
+/*
+ Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojo.data.api.Request"]){
+dojo._hasResource["dojo.data.api.Request"]=true;
+dojo.provide("dojo.data.api.Request");
+dojo.declare("dojo.data.api.Request",null,{abort:function(){
+throw new Error("Unimplemented API: dojo.data.api.Request.abort");
+}});
+}
diff --git a/lib/dojo/data/api/Write.js b/lib/dojo/data/api/Write.js
new file mode 100644
index 000000000..cc9c3e4f4
--- /dev/null
+++ b/lib/dojo/data/api/Write.js
@@ -0,0 +1,39 @@
+/*
+ Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojo.data.api.Write"]){
+dojo._hasResource["dojo.data.api.Write"]=true;
+dojo.provide("dojo.data.api.Write");
+dojo.require("dojo.data.api.Read");
+dojo.declare("dojo.data.api.Write",dojo.data.api.Read,{getFeatures:function(){
+return {"dojo.data.api.Read":true,"dojo.data.api.Write":true};
+},newItem:function(_1,_2){
+var _3;
+throw new Error("Unimplemented API: dojo.data.api.Write.newItem");
+return _3;
+},deleteItem:function(_4){
+throw new Error("Unimplemented API: dojo.data.api.Write.deleteItem");
+return false;
+},setValue:function(_5,_6,_7){
+throw new Error("Unimplemented API: dojo.data.api.Write.setValue");
+return false;
+},setValues:function(_8,_9,_a){
+throw new Error("Unimplemented API: dojo.data.api.Write.setValues");
+return false;
+},unsetAttribute:function(_b,_c){
+throw new Error("Unimplemented API: dojo.data.api.Write.clear");
+return false;
+},save:function(_d){
+throw new Error("Unimplemented API: dojo.data.api.Write.save");
+},revert:function(){
+throw new Error("Unimplemented API: dojo.data.api.Write.revert");
+return false;
+},isDirty:function(_e){
+throw new Error("Unimplemented API: dojo.data.api.Write.isDirty");
+return false;
+}});
+}
diff --git a/lib/dojo/data/util/filter.js b/lib/dojo/data/util/filter.js
new file mode 100644
index 000000000..dcdc050e6
--- /dev/null
+++ b/lib/dojo/data/util/filter.js
@@ -0,0 +1,52 @@
+/*
+ Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojo.data.util.filter"]){
+dojo._hasResource["dojo.data.util.filter"]=true;
+dojo.provide("dojo.data.util.filter");
+dojo.data.util.filter.patternToRegExp=function(_1,_2){
+var _3="^";
+var c=null;
+for(var i=0;i<_1.length;i++){
+c=_1.charAt(i);
+switch(c){
+case "\\":
+_3+=c;
+i++;
+_3+=_1.charAt(i);
+break;
+case "*":
+_3+=".*";
+break;
+case "?":
+_3+=".";
+break;
+case "$":
+case "^":
+case "/":
+case "+":
+case ".":
+case "|":
+case "(":
+case ")":
+case "{":
+case "}":
+case "[":
+case "]":
+_3+="\\";
+default:
+_3+=c;
+}
+}
+_3+="$";
+if(_2){
+return new RegExp(_3,"mi");
+}else{
+return new RegExp(_3,"m");
+}
+};
+}
diff --git a/lib/dojo/data/util/simpleFetch.js b/lib/dojo/data/util/simpleFetch.js
new file mode 100644
index 000000000..b3cc365d1
--- /dev/null
+++ b/lib/dojo/data/util/simpleFetch.js
@@ -0,0 +1,64 @@
+/*
+ Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojo.data.util.simpleFetch"]){
+dojo._hasResource["dojo.data.util.simpleFetch"]=true;
+dojo.provide("dojo.data.util.simpleFetch");
+dojo.require("dojo.data.util.sorter");
+dojo.data.util.simpleFetch.fetch=function(_1){
+_1=_1||{};
+if(!_1.store){
+_1.store=this;
+}
+var _2=this;
+var _3=function(_4,_5){
+if(_5.onError){
+var _6=_5.scope||dojo.global;
+_5.onError.call(_6,_4,_5);
+}
+};
+var _7=function(_8,_9){
+var _a=_9.abort||null;
+var _b=false;
+var _c=_9.start?_9.start:0;
+var _d=(_9.count&&(_9.count!==Infinity))?(_c+_9.count):_8.length;
+_9.abort=function(){
+_b=true;
+if(_a){
+_a.call(_9);
+}
+};
+var _e=_9.scope||dojo.global;
+if(!_9.store){
+_9.store=_2;
+}
+if(_9.onBegin){
+_9.onBegin.call(_e,_8.length,_9);
+}
+if(_9.sort){
+_8.sort(dojo.data.util.sorter.createSortFunction(_9.sort,_2));
+}
+if(_9.onItem){
+for(var i=_c;(i<_8.length)&&(i<_d);++i){
+var _f=_8[i];
+if(!_b){
+_9.onItem.call(_e,_f,_9);
+}
+}
+}
+if(_9.onComplete&&!_b){
+var _10=null;
+if(!_9.onItem){
+_10=_8.slice(_c,_d);
+}
+_9.onComplete.call(_e,_10,_9);
+}
+};
+this._fetchItems(_1,_7,_3);
+return _1;
+};
+}
diff --git a/lib/dojo/data/util/sorter.js b/lib/dojo/data/util/sorter.js
new file mode 100644
index 000000000..ace781274
--- /dev/null
+++ b/lib/dojo/data/util/sorter.js
@@ -0,0 +1,66 @@
+/*
+ Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojo.data.util.sorter"]){
+dojo._hasResource["dojo.data.util.sorter"]=true;
+dojo.provide("dojo.data.util.sorter");
+dojo.data.util.sorter.basicComparator=function(a,b){
+var r=-1;
+if(a===null){
+a=undefined;
+}
+if(b===null){
+b=undefined;
+}
+if(a==b){
+r=0;
+}else{
+if(a>b||a==null){
+r=1;
+}
+}
+return r;
+};
+dojo.data.util.sorter.createSortFunction=function(_1,_2){
+var _3=[];
+function _4(_5,_6,_7,s){
+return function(_8,_9){
+var a=s.getValue(_8,_5);
+var b=s.getValue(_9,_5);
+return _6*_7(a,b);
+};
+};
+var _a;
+var _b=_2.comparatorMap;
+var bc=dojo.data.util.sorter.basicComparator;
+for(var i=0;i<_1.length;i++){
+_a=_1[i];
+var _c=_a.attribute;
+if(_c){
+var _d=(_a.descending)?-1:1;
+var _e=bc;
+if(_b){
+if(typeof _c!=="string"&&("toString" in _c)){
+_c=_c.toString();
+}
+_e=_b[_c]||bc;
+}
+_3.push(_4(_c,_d,_e,_2));
+}
+}
+return function(_f,_10){
+var i=0;
+while(i<_3.length){
+var ret=_3[i++](_f,_10);
+if(ret!==0){
+return ret;
+}
+}
+return 0;
+};
+};
+}