(function(){u8.Crm.QueryResultSnapshot=function(e){$.extend(this,u8.Crm.QueryResultSnapshot.defaults,e);this.bind();if(!this.virtualInfoAreaReadMode){this.virtualInfoAreaReadMode=u8.session.webConfigValues.get("VirtualInfoArea.Query.ReadMode","Dynamic")}};u8.Crm.QueryResultSnapshot.makeClass({events:["PreExecute","Execute","Update"]});u8.Crm.QueryResultSnapshot.properties=["name","isPrivate","uid","maxRows","skipRows","numberOfResults","lastWriteTime","creationTime","filter"];u8.Crm.QueryResultSnapshot.defaults={name:null,isPrivate:true,uid:null,maxRows:20,skipRows:0,filter:null};$.extend(u8.Crm.QueryResultSnapshot.prototype,{load:function(e){if(!this.name&&!this.uid){$error("Neither a name nor a uid was specified for the query result set. Loading is not possible!")}var t=this;if(this.uid){u8.request("QueryChannel.GetSnapshot",{uid:this.uid},s)}else{u8.request("QueryChannel.GetSnapshotByName",{name:this.name,isPrivate:this.isPrivate||false},s)}function s(s,r){var u=r.response,i=r.error?r:u;if(u){u8.tools.extend(t,u)}else{i.error=r.error}return e&&e(t,i)}},update:function(e){this.raise("Update",e||{})},execute:function(e){var t=this,s=u8.tools.extendSome({},["maxRows","skipRows","filter","virtualInfoAreaReadMode"],this);var r={cancel:false,options:s};this.raise("PreExecute",r);if(r.cancel){return e&&e(this,{cancel:true})}u8.request("QueryChannel.ExecuteSnapshot",{uid:this.uid,options:s},u);function u(s,r){var u={};if(r.error||!r.response){u.error=r.error;u.resultSet=new u8.Crm.ResultSet}else{var i=r.response;t.name=i.name;u.resultSet=new u8.Crm.ResultSet(i.resultSet)}t.raise("Execute",u);return e&&e(t,u)}},dispose:function(){if(this._isDisposed){return}this.unbind();this._isDisposed=true},clone:function(){var e=new u8.Crm.QueryResultSnapshot;u8.tools.extendSome(e,u8.Crm.QueryResultSnapshot.properties,this);return e}})})();