public WorkflowItem BuildItem(HistoryEvent historyEvent, IEnumerable<HistoryEvent> history)
        {
            var eventId = historyEvent.GetInitialEventId();
            var attributes = historyEvent.StartChildWorkflowExecutionInitiatedEventAttributes;
            var state = GetStatus(eventId, history);

            var decisionId = historyEvent.StartChildWorkflowExecutionInitiatedEventAttributes.DecisionTaskCompletedEventId;

            return new WorkflowItem
            {
                Id = attributes.WorkflowId,
                EventId = historyEvent.EventId,
                Name = attributes.WorkflowType.Name,
                Input = attributes.Input,
                Kind = WorkflowItemKind.ChildWorkflow,
                Version = attributes.WorkflowType.Version,
                Events = new List<WorkflowItem>(),
                Order = decisionId,
                State = state,
                Result = state == WorkflowItemState.Completed ? history.GetChildWorkflowResult(eventId) : null,
                Reason = state == WorkflowItemState.Failed ? history.GetChildWorkflowReason(eventId) : null,
                Details =
                    state == WorkflowItemState.Failed ||
                    state == WorkflowItemState.Canceled ? history.GetChildWorkflowDetails(eventId) : null
            };
        }
Beispiel #2
0
        public WorkflowItem BuildItem(HistoryEvent historyEvent, IEnumerable<HistoryEvent> history)
        {
            var attributes = historyEvent.TimerStartedEventAttributes;
            var eventId = historyEvent.GetInitialEventId();
            var state = GetStatus(eventId, history);

            var decisionId = historyEvent.EventId;

            return new WorkflowItem
            {
                EventId = historyEvent.EventId,
                Name = attributes.TimerId,
                Input = string.Empty,
                Order = decisionId,
                Kind = WorkflowItemKind.Timer,
                State = state
            };
        }
        public WorkflowItem BuildItem(HistoryEvent historyEvent, IEnumerable<HistoryEvent> history)
        {
            var eventId = historyEvent.GetInitialEventId();
            var state = GetStatus(eventId, history);

            var item = new WorkflowItem
            {
                EventId = historyEvent.EventId,
                Kind = WorkflowItemKind.ActivityCancellation,
                State = state,
                Result = state == WorkflowItemState.Completed ? history.GetActivityResult(eventId) : null,
                Reason = state == WorkflowItemState.Failed ? history.GetActivityReason(eventId) : null,
                Details =
                    state == WorkflowItemState.Failed ||
                    state == WorkflowItemState.Canceled ? history.GetActivityDetails(eventId) : null
            };

            if (state == WorkflowItemState.CancelRequested)
            {
                var attributes = historyEvent.ActivityTaskCancelRequestedEventAttributes;
                var decisionId = historyEvent.ActivityTaskCancelRequestedEventAttributes.DecisionTaskCompletedEventId;

                item.Order = decisionId;
                item.Id = attributes.ActivityId;
            }
            else if (state == WorkflowItemState.CancelFailed)
            {
                var attributes = historyEvent.RequestCancelActivityTaskFailedEventAttributes;
                var decisionId = historyEvent.RequestCancelActivityTaskFailedEventAttributes.DecisionTaskCompletedEventId;

                item.Order = decisionId;
                item.Id = attributes.ActivityId;
                item.Reason = attributes.Cause;
            }

            return item;
        }
        public WorkflowItem BuildItem(HistoryEvent historyEvent, IEnumerable<HistoryEvent> history)
        {
            var eventId = historyEvent.GetInitialEventId();
            var attributes = historyEvent.ActivityTaskScheduledEventAttributes;
            var state = GetStatus(eventId, history);
            var decisionId = historyEvent.ActivityTaskScheduledEventAttributes.DecisionTaskCompletedEventId;

            return new WorkflowItem
            {
                Id = attributes.ActivityId,
                EventId = historyEvent.EventId,
                Name = attributes.ActivityType.Name,
                Input = attributes.Input,
                Kind = WorkflowItemKind.Activity,
                Version = attributes.ActivityType.Version,
                Order = decisionId,
                State = state,
                Result = state == WorkflowItemState.Completed ? history.GetActivityResult(eventId) : null,
                Reason = state == WorkflowItemState.Failed ? history.GetActivityReason(eventId) : null,
                Details =
                    state == WorkflowItemState.Failed ||
                    state == WorkflowItemState.Canceled ? history.GetActivityDetails(eventId) : null
            };
        }