//>>built
define("dojox/wire/ml/Invocation",["dijit","dojo","dojox","dojo/require!dojox/wire/ml/Action"],function(n,c,e){c.provide("dojox.wire.ml.Invocation");c.require("dojox.wire.ml.Action");c.declare("dojox.wire.ml.Invocation",e.wire.ml.Action,{object:"",method:"",topic:"",parameters:"",result:"",error:"",_run:function(){if(this.topic){var a=this._getParameters(arguments);try{c.publish(this.topic,a),this.onComplete()}catch(f){this.onError(f)}}else if(this.method){var b=this.object?e.wire.ml._getValue(this.object):
c.global;if(b){a=this._getParameters(arguments);var d=b[this.method];if(!d){d=b.callMethod;if(!d)return;a=[this.method,a]}try{var h=!1;if(b.getFeatures){var l=b.getFeatures();if("fetch"==this.method&&l["dojo.data.api.Read"]||"save"==this.method&&l["dojo.data.api.Write"]){var g=a[0];g.onComplete||(g.onComplete=function(){});this.connect(g,"onComplete","onComplete");g.onError||(g.onError=function(){});this.connect(g,"onError","onError");h=!0}}var k=d.apply(b,a);if(!h)if(k&&k instanceof c.Deferred){var m=
this;k.addCallbacks(function(f){m.onComplete(f)},function(f){m.onError(f)})}else this.onComplete(k)}catch(f){this.onError(f)}}}},onComplete:function(a){this.result&&e.wire.ml._setValue(this.result,a);this.error&&e.wire.ml._setValue(this.error,"")},onError:function(a){this.error&&(a&&a.message&&(a=a.message),e.wire.ml._setValue(this.error,a))},_getParameters:function(a){if(!this.parameters)return a;var b=[],d=this.parameters.split(",");if(1==d.length)a=e.wire.ml._getValue(c.trim(d[0]),a),c.isArray(a)?
b=a:b.push(a);else for(var h in d)b.push(e.wire.ml._getValue(c.trim(d[h]),a));return b}})});