internal JumpWorkflowAction(WorkflowItem triggerItem, WorkflowItem jumpToItem) { _triggerItem = triggerItem; _jumpToItem = jumpToItem; _scheduleAction = ScheduleWorkflowItemAction.ScheduleByIgnoringWhen(jumpToItem); _triggeredAction = Default(); }
internal override WorkflowAction TriggeredAction(WorkflowItem item) { if (item.IsWaitingForAnySignal()) { return(this); } return(item.SignalResumedAction()); }
public override WorkflowAction NextAction(WorkflowItem workflowItem) { if (_data.NextAction == SignalNextAction.Continue) { return(WorkflowAction.ContinueWorkflow(workflowItem)); } return(WorkflowAction.Schedule(workflowItem)); }
private void ValidateJump(WorkflowItem jumpedItem) { var triggeringItemBranches = _triggeringItem.ParentBranches().Concat(_triggeringItem.ChildBranches()); if (!triggeringItemBranches.Any(b => b.Has(jumpedItem))) { throw new OutOfBranchJumpException(string.Format(Resources.Invalid_jump, jumpedItem, _triggeringItem)); } }
public WorkflowItem FindFirstJointItem(WorkflowItem beforeItem) { if (Has(beforeItem)) { return(_workflowItems.TakeWhile(i => !i.Equals(beforeItem)) .FirstOrDefault(i => i.Parents().Count() > 1)); } return(null); }
public static TimerItem Reschedule(WorkflowItem ownerItem, ScheduleId scheduleId, IWorkflow workflow) { var identity = Identity.New(scheduleId.Name, scheduleId.Version, scheduleId.PositionalName); var timerItem = new TimerItem(identity, scheduleId, workflow); timerItem._rescheduleTimer = timerItem; timerItem.OnStartFailed(e => WorkflowAction.FailWorkflow("RESCHEDULE_TIMER_START_FAILED", e.Cause)); timerItem.OnCancellationFailed(e => WorkflowAction.FailWorkflow("RESCHEDULE_TIMER_CANCELLATION_FAILED", e.Cause)); timerItem.OnFired(e => WorkflowAction.Schedule(ownerItem)); return(timerItem); }
public static TimerItem Reschedule(WorkflowItem ownerItem, Identity identity, IWorkflow workflow) { var timerItem = new TimerItem(identity, workflow); timerItem._rescheduleTimer = timerItem; timerItem.OnStartFailure(e => WorkflowAction.FailWorkflow("RESCHEDULE_TIMER_START_FAILED", e.Cause)); timerItem.OnCancelled(e => WorkflowAction.CancelWorkflow("RESCHEDULE_TIMER_CANCELLED")); timerItem.OnFailedCancellation(e => WorkflowAction.FailWorkflow("RESCHEDULE_TIMER_CANCELLATION_FAILED", e.Cause)); timerItem.OnFired(e => WorkflowAction.Schedule(ownerItem)); return(timerItem); }
public bool AreAllParentBranchesInactive(WorkflowItem exceptBranchOf) { var parentBranches = ParentBranches().Where(p => !p.Has(exceptBranchOf)).ToArray(); foreach (var parentBranch in parentBranches) { if (parentBranch.IsActive(parentBranches)) { return(false); } } return(true); }
public static IEnumerable <WorkflowBranch> ParentBranches(WorkflowItem startItem) { var allBranches = new List <WorkflowBranch>(); var parentBranch = new WorkflowBranch(startItem); if (parentBranch.Parents().Any()) { foreach (var parent in parentBranch.Parents()) { allBranches.Add(parentBranch.Add(parent)); } } else { allBranches.Add(parentBranch); } return(allBranches); }
public static IEnumerable <WorkflowBranch> ChildBranches(WorkflowItem startItem) { var allBranches = new List <WorkflowBranch>(); var childBranch = new WorkflowBranch(startItem); if (childBranch.Childs().Any()) { foreach (var child in childBranch.Childs()) { allBranches.Add(childBranch.Add(child)); } } else { allBranches.Add(childBranch); } return(allBranches); }
IEnumerable <WorkflowItem> IWorkflow.GetChildernOf(WorkflowItem workflowItem) { return(_allWorkflowItems.ChilderenOf(workflowItem)); }
internal bool IsExceeded(WorkflowItem workflowItem) { var allEvents = workflowItem.AllEventsOf(workflowItem.LastEvent.GetType()); return(allEvents.Count() > _count); }
internal static JumpWorkflowAction JumpTo(WorkflowItem triggerItem, WorkflowItem jumpItem) { return(new JumpWorkflowAction(triggerItem, jumpItem)); }
internal static ScheduleWorkflowItemAction Schedule(WorkflowItem workflowItem) { return(ScheduleWorkflowItemAction.ScheduleByConsideringWhen(workflowItem)); }
internal virtual WorkflowAction WithTriggeredItem(WorkflowItem item) => this;
internal virtual WorkflowAction TriggeredAction(WorkflowItem item) => this;
internal static WorkflowAction Cancel(WorkflowItem workflowItem) { return(new WorkflowAction(workflowItem.CancelDecisions())); }
internal static JumpWorkflowAction JumpTo(WorkflowItem workflowItem) { return(new JumpWorkflowAction(workflowItem)); }
public ContinueWorkflowAction(WorkflowItem completedWorkflowItem) { _completedWorkflowItem = completedWorkflowItem; }
internal JumpWorkflowAction(WorkflowItem jumpToItem) { _scheduleAction = new ScheduleWorkflowItemAction(jumpToItem); }
internal override WorkflowAction TriggeredAction(WorkflowItem item) { return(_left.TriggeredAction(item) + _right.TriggeredAction(item)); }
public void SetJumpedItem(WorkflowItem jumpedItem) { ValidateJump(jumpedItem); _findFirstJointItem = b => b.FindFirstJointItem(jumpedItem); }
public TriggerWorkflowAction(WorkflowItem triggeringItem) { _triggeringItem = triggeringItem; }
internal override WorkflowAction WithTriggeredItem(WorkflowItem item) { return(_left.WithTriggeredItem(item) + _right.WithTriggeredItem(item)); }
internal static JumpActions FromWorkflowItem(WorkflowItems workflowItems, WorkflowItem workflowItem) { return(new JumpActions(workflowItems, jumpItem => new TriggerActions(workflowItem).FirstJoint(jumpItem))); }
internal static IgnoreWorkflowAction Ignore(WorkflowItem triggerItem) => new IgnoreWorkflowAction(triggerItem);
internal IgnoreWorkflowAction(WorkflowItem triggeringItem) { _triggeringItem = triggeringItem; _keepBranchActive = triggeringItem != null; }
internal override WorkflowAction WithTriggeredItem(WorkflowItem item) { _triggerItem = item; _triggeredAction.WithTriggeredItem(_triggerItem); return(this); }
internal override bool IsFor(WorkflowItem workflowItem) { return(workflowItem.Has(_id)); }
internal static WorkflowAction ContinueWorkflow(WorkflowItem workflowItem) { return(new ContinueWorkflowAction(workflowItem)); }