public static void GetName(ParameterizedActionDefinition obj, MethodReturnEventArgs <string> e) { e.Result = obj.Module != null? string.Format("Workflow.ParameterizedActionDefinition.{0}.{1}.{2}.{3}", obj.StateDefinition.WFDefinition.Module.Namespace, Regex.Replace(obj.StateDefinition.WFDefinition.Name, "\\W", "_"), Regex.Replace(obj.StateDefinition.Name, "\\W", "_"), Regex.Replace(obj.Action.Name, "\\W", "_")) : null; }
public static void NotifyDeleting(ParameterizedActionDefinition obj) { if (obj.StateDefinition != null) { obj.StateDefinition.StateChanges.ToList().ForEach(sc => sc.InvokedByActions.Remove(obj)); foreach (var sa in obj.StateDefinition.Actions.OfType <ScheduledActionDefinition>().ToList()) { if (sa.InvokeAction == obj) { sa.InvokeAction = null; } } } obj.Action = null; obj.StateDefinition = null; }
public static void Execute(Action obj, ParameterizedActionDefinition paramedAction, State current) { if (current == null) { throw new ArgumentException("current"); } var identity = _idResolver.GetCurrent(); Logging.Log.InfoFormat("Executing workflow action [{0}].{1}", current, obj.Name); // call invocation if (_invocationExec.HasValidInvocation(obj)) { Logging.Log.DebugFormat(" calling invocation [{0}].{1}", obj.ImplementorName, obj.MemberName); var result = _invocationExec.CallInvocation <bool>(obj, typeof(ActionInvocationPrototype), obj, paramedAction, current, identity); if (result == false) { Logging.Log.Info(" -> returned false, exiting"); return; } } // Add logfile entry current.Instance.AddLogEntry(obj.LogMessageFormat); // find and execute state change var stateChangeList = current.StateDefinition.StateChanges.Where(sc => sc.InvokedByActions.Contains(paramedAction)).ToList(); if (stateChangeList.Count == 0) { // Action does not invoke a state change } else if (stateChangeList.Count > 1) { // this is an error throw new NotSupportedException(string.Format("Action {0} invokes more than one state change logic. This is not supported", obj)); } else { var stateChange = stateChangeList.Single(); stateChange.Execute(current); } }
public static void ToString(ParameterizedActionDefinition obj, MethodReturnEventArgs <string> e) { e.Result = obj.Action != null ? obj.Action.Name : "<missing action>"; }