//>>built
define("mill/queryBuilder/dataStore",["dojo/data/util/filter","mill/mill","mill/enhancedGridData","mill/queryBuilder/provider"],function(){dojo.declare("mill.queryBuilder.dataStore",[mill.enhancedGridData],{document:null,rootItem:null,filters:null,sorts:null,groups:null,groupData:null,_handleParams:function(a,b,c){return{content:{handle:c}}},_query:function(a,b){if(a&&a.isGroup){var c=dojo.clone(this.filters);dojo.forEach(this.groups,dojo.hitch(this,function(d){c[d]=this.getValue(a,d)||"!*"}));return mill.queryBuilder.queryDocument.buildDocument(this.rootItem,
c,this.sorts)}return this.groups&&this.groups.length?mill.queryBuilder.queryDocument.buildGroupDocument(this.rootItem,this.filters,this.groups):this.document},_queryParams:function(a,b){return{content:{query:this._query(a,b)}}},_performQuery:function(a){return mill.queryBuilder.provider.gridDataArgs(a)},fetch:function(a){this.document||(this.document=mill.queryBuilder.queryDocument.buildDocument(this.rootItem,this.filters,this.sorts));return this.inherited(arguments)},close:function(a){this._handle&&
mill.queryBuilder.provider.closeGridData(this._handle);this.inherited(arguments)},onItemCreated:function(a,b){this.groups&&this.groups.length&&!a.parentItem&&(a.isGroup=!0)},_hasChildren:function(a){return!!a.isGroup}})});