public void RegisterWorkflowTask(IWorkflowTask workflowTask) { var taskType = workflowTask.GetType(); var taskName = taskType.Name; SupportedTaskTypes.Add(taskName, taskType); }
protected bool CanTransition(IWorkflowTask t) { if (!typeof(IDecisionWorkflowTask).IsAssignableFrom(t.GetType())) { return(false); } return(((IDecisionWorkflowTask)t).CanTransition()); }
public IUiWorkflowTask Create(IWorkflowTask task, IUiPoint point) { var t = task.GetType(); var entityUi = (IWorkflowTaskEntityUi)WorkflowEntityUiResolver.Instance.Resolve(task); var cssClass = entityUi.UiAttributes.ContainsKey("class") ? entityUi.UiAttributes["class"] : string.Empty; var w = new UiWorkflowTask { Top = point.Top, Left = point.Left, Description = task.Description, AvailableTransitions = task.AvailableTransitions, Id = task.Id, Name = task.Name, Transitions = task.Transitions, TypeName = t.FullName, AssemblyQualifiedTypeName = t.AssemblyQualifiedName, Class = cssClass, IsStartTask = task.IsStartTask, TransitionDescriptions = new Dictionary <string, string>(), CustomProperties = new Dictionary <string, object>() }; foreach (var transition in task.AvailableTransitions) { w.TransitionDescriptions.Add(transition, entityUi.TransitionDescriptions[transition]); } foreach (var p in t.GetProperties()) { if (p.Name == "Name" || p.Name == "Description" || p.Name == "IsStartTask") { continue; } if ( p.PropertyType != typeof(string) && p.PropertyType != typeof(int) && p.PropertyType != typeof(Boolean) && p.PropertyType != typeof(IList <string>) && p.PropertyType != typeof(IList <int>) ) { continue; } w.CustomProperties.Add(p.Name, p.GetValue(task, null)); } return(w); }
public IUiWorkflowTask Create(IWorkflowTask task, IUiPoint point) { var t = task.GetType(); var entityUi = (IWorkflowTaskEntityUi)WorkflowEntityUiResolver.Instance.Resolve(task); var cssClass = entityUi.UiAttributes.ContainsKey("class") ? entityUi.UiAttributes["class"] : string.Empty; var w = new UiWorkflowTask { Top = point.Top, Left = point.Left, Description = task.Description, AvailableTransitions = task.AvailableTransitions, Id = task.Id, Name = task.Name, Transitions = task.Transitions, TypeName = t.FullName, AssemblyQualifiedTypeName = t.AssemblyQualifiedName, Class = cssClass, IsStartTask = task.IsStartTask, TransitionDescriptions = new Dictionary<string, string>(), CustomProperties = new Dictionary<string, object>() }; foreach (var transition in task.AvailableTransitions) { w.TransitionDescriptions.Add(transition, entityUi.TransitionDescriptions[transition]); } foreach(var p in t.GetProperties()) { if (p.Name == "Name" || p.Name == "Description" || p.Name == "IsStartTask") continue; if ( p.PropertyType != typeof(string) && p.PropertyType != typeof(int) && p.PropertyType != typeof(Boolean) && p.PropertyType != typeof(IList<string>) && p.PropertyType != typeof(IList<int>) ) continue; w.CustomProperties.Add(p.Name, p.GetValue(task, null)); } return w; }
public IWorkflowTaskUiAdapter CreateWorkflowTaskUiAdapter(IWorkflowTask adaptedTask) { var t = adaptedTask.GetType(); Log.Debug(string.Format("Getting adapater for {0}", t.AssemblyQualifiedName)); var w = new WorkflowTaskUiAdapter { AvailableTransitions = adaptedTask.AvailableTransitions.Count, TypeName = t.FullName, AssemblyQualifiedTypeName = t.AssemblyQualifiedName, IsStartTask = adaptedTask.IsStartTask }; Log.Debug("Finding WorkflowTaskEntityUi"); var entityUi = (IWorkflowTaskEntityUi)WorkflowEntityUiResolver.Instance.Resolve(adaptedTask); if (entityUi == null) { var message = string.Format("No IWorkflowTaskEntityUi defined for {0}", t.AssemblyQualifiedName); Log.Fatal(message); throw new Exception(message); } Log.Debug(string.Format("Got entity Ui {0} for {1}", entityUi.GetType().AssemblyQualifiedName, t.AssemblyQualifiedName)); w.Name = entityUi.EntityName; w.Class = entityUi.UiAttributes.ContainsKey("class") ? entityUi.UiAttributes["class"] : string.Empty; w.TransitionDescriptions = new Dictionary<string, string>(); foreach (var transition in adaptedTask.AvailableTransitions) { w.TransitionDescriptions.Add(transition, entityUi.TransitionDescriptions[transition]); } return w; }
public IWorkflowTaskUiAdapter CreateWorkflowTaskUiAdapter(IWorkflowTask adaptedTask) { var t = adaptedTask.GetType(); Log.Debug(string.Format("Getting adapater for {0}", t.AssemblyQualifiedName)); var w = new WorkflowTaskUiAdapter { AvailableTransitions = adaptedTask.AvailableTransitions.Count, TypeName = t.FullName, AssemblyQualifiedTypeName = t.AssemblyQualifiedName, IsStartTask = adaptedTask.IsStartTask }; Log.Debug("Finding WorkflowTaskEntityUi"); var entityUi = (IWorkflowTaskEntityUi)WorkflowEntityUiResolver.Instance.Resolve(adaptedTask); if (entityUi == null) { var message = string.Format("No IWorkflowTaskEntityUi defined for {0}", t.AssemblyQualifiedName); Log.Fatal(message); throw new Exception(message); } Log.Debug(string.Format("Got entity Ui {0} for {1}", entityUi.GetType().AssemblyQualifiedName, t.AssemblyQualifiedName)); w.Name = entityUi.EntityName; w.Class = entityUi.UiAttributes.ContainsKey("class") ? entityUi.UiAttributes["class"] : string.Empty; w.TransitionDescriptions = new Dictionary <string, string>(); foreach (var transition in adaptedTask.AvailableTransitions) { w.TransitionDescriptions.Add(transition, entityUi.TransitionDescriptions[transition]); } return(w); }