(function(){"use strict";u8.Crm.BusinessObjectDataSource=function(i){$.extend(this,u8.Crm.BusinessObjectDataSource.defaults,i);this.bind();this.fields=this.fields||[];this.businessObject=new u8.Crm.BusinessObject({uid:this.uid||{infoAreaId:this.infoAreaId||"??",recordId:-1}});if(u8.isValidRecordUid(this.uid)||u8.isValidRecordUid(this.link)){this._read()}};u8.Crm.BusinessObjectDataSource.makeClass({name:"BusinessObjectDataSource",events:["UidChange"]});u8.Crm.BusinessObjectDataSource.defaults={};$.extend(u8.Crm.BusinessObjectDataSource.prototype,{dispose:function(){if(this._isDisposed){return}this.unbind();this._isDisposed=true},getUid:function(){return this.uid},setUid:function(i,s){if(u8.equalsRecordUid(i,this.uid)){return}this.uid=i;this.raise("UidChange",{value:i});if(s!==false&&this.fields.length){this._read()}},setLink:function(i){if(this.link===i){return}this.link=i;this.raise("LinkChange");this._read()},getLink:function(){return this.link},_read:function(){var i=this;u8.services.crud.read({uid:this.uid,fields:this.fields,options:{link:this.link,linkName:this.linkName,linked:this.linked}},function(s,e){var t=e.businessObject;if(!t){return}i.setUid(t.uid,false);i.businessObject.setFrom(t)})}})})();