// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
define("esri/tasks/datareviewer/BatchValidationTask","dojo/_base/declare dojo/_base/array dojo/_base/lang dojo/Deferred dojo/has ./_DRSBaseTask ./BatchValidationJob ./BatchValidationJobInfo ../../request ../../kernel".split(" "),function(p,q,h,l,t,u,r,v,m,w){p=p(u,{declaredClass:"esri.tasks.datareviewer.BatchValidationTask",constructor:function(c){this.onGetJobIdsComplete=h.hitch(this,this.onGetJobIdsComplete);this.onScheduleJobComplete=h.hitch(this,this.onScheduleJobComplete);this.onEditJobComplete=
h.hitch(this,this.onEditJobComplete);this.onDeleteJobComplete=h.hitch(this,this.onDeleteJobComplete);this.onEnableJobComplete=h.hitch(this,this.onEnableJobComplete);this.onDisableJobComplete=h.hitch(this,this.onDisableJobComplete);this.onGetJobDetailsComplete=h.hitch(this,this.onGetJobDetailsComplete);this.onGetJobExecutionDetailsComplete=h.hitch(this,this.onGetJobExecutionDetailsComplete);this.onCancelJobExecutionComplete=h.hitch(this,this.onCancelJobExecutionComplete);this.onExecuteJobComplete=
h.hitch(this,this.onExecuteJobComplete);this.onGetScheduledJobsListComplete=h.hitch(this,this.onGetScheduledJobsListComplete);this.onGetAdhocJobsListComplete=h.hitch(this,this.onGetAdhocJobsListComplete)},getJobIds:function(){var c=this._successHandler,g=this._errorHandler,d=this._appendQueryParams,f=this._url+"/BatchValidation",f=d(f),a=new l;m({callbackParamName:"callback",url:f,content:{f:"json"}}).then(h.hitch(this,function(b,e){if(void 0!==b.error){var d=Error();d.message=b.error.message;d.code=
b.error.code;g(d,a)}else try{if(void 0===b.scheduledJobs||void 0===b.adhocJobs)g(null,a);else{var n={scheduledJobs:[],adhocJobs:[]};q.forEach(b.scheduledJobs,function(b,a){n.scheduledJobs.push(b.id)});q.forEach(b.adhocJobs,function(b,a){n.adhocJobs.push(b.id)});c(n,"onGetJobIdsComplete",a)}}catch(k){g(k,a)}}),function(b,e){g(b,a)});return a},scheduleJob:function(c){var g=this._successHandler,d=this._errorHandler,f=this._appendQueryParams,a=this._url+"/BatchValidation/scheduleNewJob",a=f(a),b=new l;
m({callbackParamName:"callback",url:a,content:c.toJSONScheduleParameters()}).then(h.hitch(this,function(a,c){if(void 0!==a.error){var e=Error();e.message=a.error.message;e.code=a.error.code;d(e,b)}else try{void 0===a.scheduledJobId?d(null,b):g({jobId:a.scheduledJobId},"onScheduleJobComplete",b)}catch(k){d(k,b)}}),function(a,c){d(a,b)});return b},editJob:function(c,g){var d=this._successHandler,f=this._errorHandler,a=this._appendQueryParams,b=this._url+"/BatchValidation/scheduledJobs/"+c+"/editJob",
b=a(b),e=new l;m({callbackParamName:"callback",url:b,content:g.toJSONEditParameters()}).then(h.hitch(this,function(b,a){if(void 0!==b.error){var c=Error();c.message=b.error.message;c.code=b.error.code;f(c,e)}else try{void 0!==b.edited&&"false"===b.edited?f(null,e):void 0!==b.edited?d({edited:b.edited},"onEditJobComplete",e):f(null,e)}catch(x){f(x,e)}}),function(b,a){f(b,e)});return e},deleteJob:function(c){var g=this._successHandler,d=this._errorHandler,f=this._appendQueryParams;c=this._url+"/BatchValidation/scheduledJobs/"+
c+"/deleteJob";c=f(c);var a=new l;m({callbackParamName:"callback",url:c,content:{f:"json"}}).then(h.hitch(this,function(b,c){if(void 0!==b.error){var e=Error();e.message=b.error.message;e.code=b.error.code;d(e,a)}else try{void 0!==b.deleted?g({deleted:b.deleted},"onDeleteJobComplete",a):d(null,a)}catch(n){d(n,a)}}),function(b,e){d(b,a)});return a},enableJob:function(c){var g=this._successHandler,d=this._errorHandler,f=this._appendQueryParams;c=this._url+"/BatchValidation/scheduledJobs/"+c+"/enableJob";
c=f(c);var a=new l;m({callbackParamName:"callback",url:c,content:{f:"json"}}).then(h.hitch(this,function(b,e){if(void 0!==b.error){var c=Error();c.message=b.error.message;c.code=b.error.code;d(c,a)}else try{void 0!==b.enabled?g({enabled:b.enabled},"onEnableJobComplete",a):d(null,a)}catch(n){d(n,a)}}),function(b,c){d(b,a)});return a},disableJob:function(c){var g=this._successHandler,d=this._errorHandler,f=this._appendQueryParams;c=this._url+"/BatchValidation/scheduledJobs/"+c+"/disableJob";c=f(c);
var a=new l;m({callbackParamName:"callback",url:c,content:{f:"json"}}).then(h.hitch(this,function(b,c){if(void 0!==b.error){var e=Error();e.message=b.error.message;e.code=b.error.code;d(e,a)}else try{void 0!==b.disabled?g({disabled:b.disabled},"onDisableJobComplete",a):d(null,a)}catch(n){d(n,a)}}),function(b,c){d(b,a)});return a},getJobDetails:function(c){var g=this._successHandler,d=this._errorHandler,f=this._appendQueryParams,a=this._url+"/BatchValidation/getJobDetails",a=f(a),b=new l;m({callbackParamName:"callback",
url:a,content:{jobId:c,f:"json"}}).then(h.hitch(this,function(a,c){if(void 0!==a.error){var e=Error();e.message=a.error.message;e.code=a.error.code;d(e,b)}else try{e=new r(a),g({jobDetails:e},"onGetJobDetailsComplete",b)}catch(k){d(k,b)}}),function(a,c){d(a,b)});return b},getJobExecutionDetails:function(c){var g=this._successHandler,d=this._errorHandler,f=this._appendQueryParams,a=this._url+"/BatchValidation/getJobExecutionDetails",a=f(a),b=new l;m({callbackParamName:"callback",url:a,content:{f:"json",
jobId:c.toString()}}).then(h.hitch(this,function(a,c){if(void 0!==a.error){var e=Error();e.message=a.error.message;e.code=a.error.code;d(e,b)}else try{e=new v(a),g({jobInfo:e},"onGetJobExecutionDetailsComplete",b)}catch(k){d(k,b)}}),function(a,c){d(a,b)});return b},cancelJobExecution:function(c){var g=this._successHandler,d=this._errorHandler,f=this._appendQueryParams,a=this._url+"/BatchValidation/cancelJob",a=f(a),b=new l;m({callbackParamName:"callback",url:a,content:{f:"json",jobId:c}}).then(h.hitch(this,
function(a,c){if(void 0!==a.error){var e=Error();e.message=a.error.message;e.code=a.error.code;d(e,b)}else try{void 0!==a.canceled?g({canceled:a.canceled},"onCancelJobExecutionComplete",b):d(null,b)}catch(k){d(k,b)}}),function(a,c){d(a,b)});return b},executeJob:function(c){var g=this._successHandler,d=this._errorHandler,f=this._appendQueryParams,a=this._url+"/BatchValidation/executeJob",a=f(a),b=new l;m({callbackParamName:"callback",url:a,content:c.toJSONExecuteParameters()}).then(h.hitch(this,function(a,
c){if(void 0!==a.error){var e=Error();e.message=a.error.message;e.code=a.error.code;d(e,b)}else try{void 0===a.adhocJobId?d(null,b):g({jobId:a.adhocJobId},"onExecuteJobComplete",b)}catch(k){d(k,b)}}),function(a,c){d(a,b)});return b},getScheduledJobsList:function(){var c=this._successHandler,g=this._errorHandler,d=this._appendQueryParams,f=this._url+"/BatchValidation/scheduledJobs",f=d(f),a=new l;m({callbackParamName:"callback",url:f,content:{f:"json"}}).then(h.hitch(this,function(b,d){if(void 0!==
b.error){var e=Error();e.message=b.error.message;e.code=b.error.code;g(e,a)}else try{if(void 0===b.scheduledJobs)g(null,a);else{var f=[];q.forEach(b.scheduledJobs,function(a,b){null!==a&&void 0!==a&&f.push(new r(a))});c({scheduledJobs:f},"onGetScheduledJobsListComplete",a)}}catch(k){g(k,a)}}),function(b,c){g(b,a)});return a},getAdhocJobsList:function(){var c=this._successHandler,g=this._errorHandler,d=this._appendQueryParams,f=this._url+"/BatchValidation/adhocJobs",f=d(f),a=new l;m({callbackParamName:"callback",
url:f,content:{f:"json"}}).then(h.hitch(this,function(b,d){if(void 0!==b.error){var e=Error();e.message=b.error.message;e.code=b.error.code;g(e,a)}else try{if(void 0===b.adhocJobs)g(null,a);else{var f=[];q.forEach(b.adhocJobs,function(a,b){null!==a&&void 0!==a&&f.push(new r(a))});c({adhocJobs:f},"onGetAdhocJobsListComplete",a)}}catch(k){g(k,a)}}),function(b,c){g(b,a)});return a},onGetJobIdsComplete:function(c){},onGetJobDetailsComplete:function(c){},onGetJobExecutionDetailsComplete:function(c){},
onCancelJobExecutionComplete:function(c){},onExecuteJobComplete:function(c){},onScheduleJobComplete:function(c){},onEditJobComplete:function(c){},onEnableJobComplete:function(c){},onDisableJobComplete:function(c){},onDeleteJobComplete:function(c){},onGetScheduledJobsListComplete:function(c){},onGetAdhocJobsListComplete:function(c){}});t("extend-esri")&&h.setObject("tasks.datareviewer.BatchValidationTask",p,w);return p});