| 1 |
- MWF.xApplication.Common.Actions=MWF.xApplication.Common.Actions||{};MWF.xApplication.Common.Actions.RestActions=new Class({initialize:function(){this.designAddress="";MWF.getJSON("/x_component_Common/Actions/properties.jsp",function(s){this.actions=s}.bind(this),false)},listApplicationAddress:function(s,i){var t=this.actions.listAddress;t=this.actions.slotHost+t;var e=new MWF.xApplication.Common.Actions.RestActions.Callback(s,i);MWF.getJSON(t,e)},getDesignAddress:function(s,i){this.designAddress="http://xa01.zoneland.net:9080/x_processplatform_assemble_designer";if(s)s.apply()},request:function(s,i,t,e){if(this.designAddress){this["_"+t](s,i,e)}else{this.getDesignAddress(function(n){this["_"+t](s,i,e)}.bind(this),i)}},_getId:function(s,i,t){var e=this.designAddress+this.actions.getId;e=e.replace(/{count}/g,t);var n=new MWF.xApplication.Common.Actions.RestActions.Callback(s,i);MWF.getJSON(e,n)},getId:function(s,i,t){this.request(i,t,"getId",s)},getUUID:function(){if(!this.designAddress)this.getDesignAddress();var s=this.designAddress+this.actions.getId;s=s.replace(/{count}/g,"1");var i="";var t=new MWF.xApplication.Common.Actions.RestActions.Callback(function(s){i=s.data[0].id},null);MWF.getJSON(s,t,false);return i}});MWF.xApplication.Common.Actions.RestActions.Callback=new Class({initialize:function(s,i,t,e){this.success=s;this.failure=i;this.appendSuccess=t;this.appendFailure=e},onSuccess:function(s,i){switch(s.type){case"success":if(this.appendSuccess)this.appendSuccess(s);if(this.success)this.success(s);break;case"warn":MWF.xDesktop.notice("info",{x:"right",y:"top"},s.errorMessage.join("\n"));if(this.appendSuccess)this.appendSuccess(s);if(this.success)this.success(s);break;case"error":this.doError(null,i,s.message);break}},onRequestFailure:function(s){this.doError(s,"","")},onFailure:function(s){this.doError(s,"","")},onError:function(s,i){this.doError(null,s,i)},doError:function(s,i,t){if(this.appendFailure)this.appendFailure(s,i,t);if(this.failure)this.failure(s,i,t);if(!this.failure&&!this.appendFailure){var e=t;if(s)e=s.responseText;MWF.xDesktop.notice("error",{x:"right",y:"top"},"request json error: "+e)}}});
|