protected override List <string> PerformExecution(Dictionary <string, string> evaluatedValues) { _errorsTo = new ErrorResultTO(); try { var suspensionId = EvalSuspensionId(); if (string.IsNullOrWhiteSpace(suspensionId)) { Response = GlobalConstants.Failed; throw new Exception(ErrorResource.ManualResumptionSuspensionIdBlank); } if (!_persistenceEnabled) { Response = GlobalConstants.Failed; throw new Exception(ErrorResource.PersistenceSettingsNoConfigured); } var overrideVariables = ""; if (OverrideInputVariables) { var innerActivity = InnerActivity(); overrideVariables = ExecuteOverrideDataFunc(innerActivity); } Response = _scheduler.ResumeJob(_dataObject, suspensionId, OverrideInputVariables, overrideVariables); _stateNotifier?.LogActivityExecuteState(this); if (_dataObject.IsDebugMode()) { var debugItemStaticDataParams = new DebugItemStaticDataParams("SuspensionID: " + suspensionId, "", true); AddDebugOutputItem(debugItemStaticDataParams); debugItemStaticDataParams = new DebugItemStaticDataParams("Override Variables: " + OverrideInputVariables, "", true); AddDebugOutputItem(debugItemStaticDataParams); debugItemStaticDataParams = new DebugItemStaticDataParams("Result: " + Response, "", true); AddDebugOutputItem(debugItemStaticDataParams); } return(new List <string> { Response }); } catch (Exception ex) { Response = GlobalConstants.Failed; _stateNotifier?.LogExecuteException(ex, this); Dev2Logger.Error(nameof(ManualResumptionActivity), ex, GlobalConstants.WarewolfError); throw new Exception(ex.GetAllMessages()); } }
protected override List <string> PerformExecution(Dictionary <string, string> evaluatedValues) { var allErrors = new ErrorResultTO(); Response = string.Empty; try { var suspensionId = EvalSuspensionId(); if (string.IsNullOrWhiteSpace(suspensionId)) { throw new Exception(ErrorResource.ManualResumptionSuspensionIdBlank); } if (!_persistenceEnabled) { throw new Exception(ErrorResource.PersistenceSettingsNoConfigured); } _logger.Info("Performing Resume of job {" + suspensionId + "}, connection established.", suspensionId); const string OverrideVariables = ""; if (OverrideInputVariables) { var persistedValues = _scheduler.GetPersistedValues(suspensionId); if (string.IsNullOrEmpty(persistedValues.SuspendedEnvironment)) { throw new Exception(ErrorResource.ManualResumptionSuspensionEnvBlank); } if (persistedValues.SuspendedEnvironment.StartsWith("Failed:")) { throw new Exception(persistedValues.SuspendedEnvironment); } var envArray = _dataObject.Environment.ToJson(); var resumeObject = _dataObject; resumeObject.StartActivityId = persistedValues.StartActivityId; resumeObject.Environment.FromJson(persistedValues.SuspendedEnvironment); resumeObject.Environment.FromJson(envArray); resumeObject.ExecutingUser = persistedValues.ExecutingUser; InnerActivity(resumeObject, _update); Response = _scheduler.ManualResumeWithOverrideJob(resumeObject, suspensionId); } else { Response = _scheduler.ResumeJob(_dataObject, suspensionId, OverrideInputVariables, OverrideVariables); } _stateNotifier?.LogActivityExecuteState(this); if (_dataObject.IsDebugMode()) { var debugItemStaticDataParams = new DebugItemStaticDataParams("SuspensionID: " + suspensionId, "", true); AddDebugOutputItem(debugItemStaticDataParams); debugItemStaticDataParams = new DebugItemStaticDataParams("Override Variables: " + OverrideInputVariables, "", true); AddDebugOutputItem(debugItemStaticDataParams); debugItemStaticDataParams = new DebugItemStaticDataParams("Result: " + Response, "", true); AddDebugOutputItem(debugItemStaticDataParams); } } catch (System.Data.SqlClient.SqlException) { LogException(new Exception(ErrorResource.BackgroundJobClientResumeFailed), allErrors); } catch (Exception ex) { LogException(ex, allErrors); } finally { HandleErrors(_dataObject, allErrors); } return(new List <string> { Response }); }