コード例 #1
0
        /// <summary>
        /// Reschedule the item, associated with passed event.
        /// </summary>
        /// <param name="workflowItemEvent"></param>
        /// <returns></returns>
        protected ScheduleWorkflowItemAction Reschedule(WorkflowItemEvent workflowItemEvent)
        {
            Ensure.NotNull(workflowItemEvent, "workflowItemEvent");
            var workflowItem = _allWorkflowItems.WorkflowItemFor(workflowItemEvent);

            return(WorkflowAction.Schedule(workflowItem));
        }
コード例 #2
0
        /// <summary>
        /// Continue the scheduling the of child items. All child items will be scheduled as per Deflow algorithm.
        /// </summary>
        /// <param name="workflowItemEvent"></param>
        /// <returns></returns>
        protected WorkflowAction Continue(WorkflowItemEvent workflowItemEvent)
        {
            Ensure.NotNull(workflowItemEvent, "workflowItemEvent");

            var workfowItem = _allWorkflowItems.WorkflowItemFor(workflowItemEvent);

            return(WorkflowAction.ContinueWorkflow(workfowItem));
        }
コード例 #3
0
        public LambdaItem LambdaItem(WorkflowItemEvent @event)
        {
            var item = _workflowItems.OfType <LambdaItem>().FirstOrDefault(@event.IsFor);

            if (item == null)
            {
                throw new IncompatibleWorkflowException($"Can not find workflow item for event {@event}");
            }
            return(item);
        }
コード例 #4
0
        public ActivityItem ActivityItem(WorkflowItemEvent workflowItemEvent)
        {
            var workflowActivity = Activity(workflowItemEvent);

            if (workflowActivity == null)
            {
                throw new IncompatibleWorkflowException(string.Format("Can not find activity for event {0}.", workflowItemEvent));
            }

            return(workflowActivity);
        }
コード例 #5
0
        public WorkflowItem WorkflowItem(WorkflowItemEvent workflowItemEvent)
        {
            var workflowItem = _workflowItems.FirstOrDefault(workflowItemEvent.IsFor);

            if (workflowItem == null)
            {
                throw new IncompatibleWorkflowException($"Can not find workflow item for event {workflowItemEvent}");
            }

            return(workflowItem);
        }
コード例 #6
0
ファイル: WorkflowItems.cs プロジェクト: yasinkultur/guflow
        public ITimer TimerFor(WorkflowItemEvent workflowItemEvent)
        {
            var timer = _workflowItems.FirstOrDefault(workflowItemEvent.IsFor) as ITimer;

            if (timer == null)
            {
                throw new IncompatibleWorkflowException(string.Format("Can not find timer for event {0}", workflowItemEvent));
            }

            return(timer);
        }
コード例 #7
0
ファイル: WorkflowItems.cs プロジェクト: yasinkultur/guflow
        public WorkflowItem WorkflowItemFor(WorkflowItemEvent workflowItemEvent)
        {
            var workflowItem = _workflowItems.FirstOrDefault(workflowItemEvent.IsFor);

            if (workflowItem == null)
            {
                throw new IncompatibleWorkflowException(string.Format("Can not find workflow item for event {0}", workflowItemEvent));
            }

            return(workflowItem);
        }
コード例 #8
0
        public ITimer Timer(WorkflowItemEvent workflowItemEvent)
        {
            var timer = _workflowItems.FirstOrDefault(workflowItemEvent.IsFor);

            if (timer == null)
            {
                throw new IncompatibleWorkflowException($"Can not find timer for event {workflowItemEvent}");
            }

            return(timer);
        }
コード例 #9
0
        public WorkflowItemEvent LastActivityEventFor(ActivityItem activityItem)
        {
            WorkflowItemEvent result = null;

            if (_cachedActivityEvents.TryGetValue(activityItem, out result))
            {
                return(result);
            }

            result = AllActivityEventsFor(activityItem).FirstOrDefault();
            _cachedActivityEvents.Add(activityItem, result);
            return(result);
        }
コード例 #10
0
        public WorkflowItemEvent LastTimerEventFor(TimerItem timerItem)
        {
            WorkflowItemEvent result = null;

            if (_cachedTimerEvents.TryGetValue(timerItem, out result))
            {
                return(result);
            }

            result = AllTimerEventsFor(timerItem).FirstOrDefault();
            _cachedTimerEvents.Add(timerItem, result);
            return(result);
        }
コード例 #11
0
 internal WorkflowItemWaitAction(WorkflowItemEvent itemEvent, SignalWaitType waitType, params string[] signalNames)
 {
     _scheduleId            = itemEvent.ScheduleId;
     _waitingEventTimeStamp = itemEvent.Timestamp;
     _data = new WaitForSignalData
     {
         ScheduleId                 = itemEvent.ScheduleId,
         TriggerEventId             = itemEvent.EventId,
         WaitType                   = waitType,
         SignalNames                = signalNames,
         NextAction                 = SignalNextAction.Continue,
         TriggerEventCompletionDate = itemEvent.Timestamp
     };
 }
コード例 #12
0
        public override WorkflowItemEvent LastEvent(bool includeRescheduleTimerEvents = false)
        {
            var lastEvent = WorkflowHistoryEvents.LastChildWorkflowEvent(this);
            WorkflowItemEvent timerEvent = null;

            if (includeRescheduleTimerEvents)
            {
                timerEvent = WorkflowHistoryEvents.LastTimerEvent(RescheduleTimer, true);
            }

            if (lastEvent > timerEvent)
            {
                return(lastEvent);
            }
            return(timerEvent);
        }
コード例 #13
0
        public IEnumerable <WorkflowItemEvent> LastSimilarEvents()
        {
            WorkflowItemEvent lastEvent = null;

            foreach (var @event in AllEvents())
            {
                lastEvent = lastEvent ?? @event;
                if (lastEvent.GetType() == @event.GetType())
                {
                    yield return(@event);
                }
                else
                {
                    yield break;
                }
            }
        }
コード例 #14
0
        public override WorkflowItemEvent LastEvent(bool includeRescheduleTimerEvents = false)
        {
            var latestActivityEvent            = WorkflowHistoryEvents.LastActivityEvent(this);
            WorkflowItemEvent latestTimerEvent = null;

            if (includeRescheduleTimerEvents)
            {
                latestTimerEvent = WorkflowHistoryEvents.LastTimerEvent(RescheduleTimer, true);
            }

            if (latestActivityEvent > latestTimerEvent)
            {
                return(latestActivityEvent);
            }

            return(latestTimerEvent);
        }
コード例 #15
0
 /// <summary>
 /// Returns the child activity for given event.
 /// </summary>
 /// <param name="activityEvent"></param>
 /// <returns></returns>
 protected IActivityItem Activity(WorkflowItemEvent activityEvent)
 {
     Ensure.NotNull(activityEvent, "@event");
     return(_allWorkflowItems.ActivityOf(activityEvent));
 }
コード例 #16
0
 internal bool HasSameScheduleId(WorkflowItemEvent other) => ScheduleId == other.ScheduleId;
コード例 #17
0
 internal bool IsForSameWorkflowItemAs(WorkflowItemEvent otherWorkflowItemEvent)
 {
     return(AwsIdentity == otherWorkflowItemEvent.AwsIdentity);
 }
コード例 #18
0
 public TimerItem TimerItem(WorkflowItemEvent timerEvent)
 {
     return(_workflowItems.OfType <TimerItem>().FirstOrDefault(timerEvent.IsFor));
 }
コード例 #19
0
        private static bool IsRescheduleTimerEvent(WorkflowItemEvent @event)
        {
            var timerEvent = @event as TimerEvent;

            return(timerEvent != null && timerEvent.TimerType == TimerType.Reschedule);
        }
コード例 #20
0
        private static bool IsSignalTimerEvent(WorkflowItemEvent @event)
        {
            var timerEvent = @event as TimerEvent;

            return(timerEvent != null && timerEvent.TimerType == TimerType.SignalTimer);
        }
コード例 #21
0
 public ActivityItem Activity(WorkflowItemEvent activityEvent)
 {
     return(_workflowItems.OfType <ActivityItem>().FirstOrDefault(activityEvent.IsFor));
 }
コード例 #22
0
 WorkflowAction IWorkflowDefaultActions.Continue(WorkflowItemEvent workflowItemEvent)
 {
     return(Continue(workflowItemEvent));
 }
コード例 #23
0
ファイル: Workflow.cs プロジェクト: gurmitteotia/guflow
 /// <summary>
 /// Returns child workflow for given event.
 /// </summary>
 /// <param name="event"></param>
 /// <returns></returns>
 protected IChildWorkflowItem ChildWorkflow(WorkflowItemEvent @event)
 {
     Ensure.NotNull(@event, nameof(@event));
     return(_allWorkflowItems.ChildWorkflowItem(@event));
 }
コード例 #24
0
 public bool HasItemFor(WorkflowItemEvent @event)
 => AllItems.Any(@event.IsFor);
コード例 #25
0
 public bool Contains(WorkflowItemEvent @event)
 => _filterOutTypes.Contains(@event.GetType());
コード例 #26
0
 /// <summary>
 /// Returns child timer for given <see cref="WorkflowItemEvent"/>.
 /// </summary>
 /// <param name="event"></param>
 /// <returns></returns>
 protected ITimerItem Timer(WorkflowItemEvent @event)
 {
     Ensure.NotNull(@event, "@event");
     return(_allWorkflowItems.TimerItemFor(@event));
 }
コード例 #27
0
ファイル: Workflow.cs プロジェクト: gurmitteotia/guflow
 /// <summary>
 /// Returns the lambda for given event.
 /// </summary>
 /// <param name="event"></param>
 /// <returns></returns>
 protected ILambdaItem Lambda(WorkflowItemEvent @event)
 {
     Ensure.NotNull(@event, "@event");
     return(_allWorkflowItems.LambdaItem(@event));
 }