private bool CheckCondition(ExecutionRequestParameters parameters) { if (parameters.ConditionType != ConditionType.Action || parameters.ConditionMethod == null || parameters.ConditionMethod.OutputParameters.Count() != 1) { throw new InvalidOperationException(); } if (ConsiderResultOnPreExecution && parameters.ConditionResultOnPreExecution.HasValue) { return(parameters.ConditionResultOnPreExecution.Value); } var response = ExecutionResponseParameters.Create(parameters.ProcessId, parameters.ActivityName, parameters.ParameterContainer); ExecuteMethod(parameters.ConditionMethod, response, parameters.ParameterContainer); var result = response.ParameterContainer.SingleOrDefault(p => p.Name == DefaultDefinitions.ParameterConditionResult.Name); if (result == null || result.Value == null || !(result.Value is bool)) { throw new InvalidOperationException(); } return((bool)result.Value); }
private static ExecutionResponseParameters GetExecutionResponseErrorParameters(ExecutionRequestParameters always, Exception ex) { var errorResponse = string.IsNullOrEmpty(always.TransitionName) ? ExecutionResponseParameters.Create(always.ProcessId, always.ActivityName, ex) : ExecutionResponseParameters.Create(always.ProcessId, always.ActivityName, always.TransitionName, ex); return(errorResponse); }
private ExecutionResponseParameters ExecuteMethod(ExecutionRequestParameters parameters) { var response = string.IsNullOrEmpty(parameters.TransitionName) ? ExecutionResponseParameters.Create(parameters.ProcessId, parameters.ActivityName, parameters.ParameterContainer) : ExecutionResponseParameters.Create(parameters.ProcessId, parameters.ActivityName, parameters.TransitionName, parameters.ParameterContainer); foreach (var method in parameters.Methods.OrderBy(m => m.Order)) { ExecuteMethod(method, response, response.ParameterContainer); } return(response); }
public ExecutionResponseEventArgs(ExecutionResponseParameters parameters) { Parameters = parameters; }
public ExecutionResponseEventArgs(ExecutionResponseParameters parameters) { this.Parameters = parameters; }
private bool PreExecuteProcessResponse(ProcessInstance processInstance, ExecutionResponseParameters response) { if (response.IsEmplty) return true; if (!response.IsError) FillParameters(processInstance, response as ExecutionResponseParametersComplete); else { throw (response as ExecutionResponseParametersError).Exception; } return false; }
private bool PreExecuteProcessResponse(ExecutionResponseParameters response) { if (response.IsEmplty) { return true; } if (response.IsError) { throw (response as ExecutionResponseParametersError).Exception; } return false; }