/*
	Copyright (c) 2004-2011, 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
*/


window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","dojox.wire.ml.Invocation"],["require","dojox.wire.ml.Action"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dojox.wire.ml.Invocation"]){_4._hasResource["dojox.wire.ml.Invocation"]=true;_4.provide("dojox.wire.ml.Invocation");_4.require("dojox.wire.ml.Action");_4.declare("dojox.wire.ml.Invocation",_6.wire.ml.Action,{object:"",method:"",topic:"",parameters:"",result:"",error:"",_run:function(){if(this.topic){var _7=this._getParameters(arguments);try{_4.publish(this.topic,_7);this.onComplete();}catch(e){this.onError(e);}}else{if(this.method){var _8=(this.object?_6.wire.ml._getValue(this.object):_4.global);if(!_8){return;}var _7=this._getParameters(arguments);var _9=_8[this.method];if(!_9){_9=_8.callMethod;if(!_9){return;}_7=[this.method,_7];}try{var _a=false;if(_8.getFeatures){var _b=_8.getFeatures();if((this.method=="fetch"&&_b["dojo.data.api.Read"])||(this.method=="save"&&_b["dojo.data.api.Write"])){var _c=_7[0];if(!_c.onComplete){_c.onComplete=function(){};}this.connect(_c,"onComplete","onComplete");if(!_c.onError){_c.onError=function(){};}this.connect(_c,"onError","onError");_a=true;}}var r=_9.apply(_8,_7);if(!_a){if(r&&(r instanceof _4.Deferred)){var _d=this;r.addCallbacks(function(_e){_d.onComplete(_e);},function(_f){_d.onError(_f);});}else{this.onComplete(r);}}}catch(e){this.onError(e);}}}},onComplete:function(_10){if(this.result){_6.wire.ml._setValue(this.result,_10);}if(this.error){_6.wire.ml._setValue(this.error,"");}},onError:function(_11){if(this.error){if(_11&&_11.message){_11=_11.message;}_6.wire.ml._setValue(this.error,_11);}},_getParameters:function(_12){if(!this.parameters){return _12;}var _13=[];var _14=this.parameters.split(",");if(_14.length==1){var _15=_6.wire.ml._getValue(_4.trim(_14[0]),_12);if(_4.isArray(_15)){_13=_15;}else{_13.push(_15);}}else{for(var i in _14){_13.push(_6.wire.ml._getValue(_4.trim(_14[i]),_12));}}return _13;}});}}};});