Example #1
0
        public WorkflowItem BuildItem(HistoryEvent historyEvent, IEnumerable<HistoryEvent> history)
        {
            var eventId = historyEvent.GetInitialEventId();
            var attributes = historyEvent.WorkflowExecutionStartedEventAttributes;
            var state = GetStatus(eventId, history);

            var decisionId = 1;

            return new WorkflowItem
            {
                EventId = historyEvent.EventId,
                Name = attributes.WorkflowType.Name,
                Input = attributes.Input,
                Kind = WorkflowItemKind.Workflow,
                Version = attributes.WorkflowType.Version,
                Order = decisionId,
                State = state,
                Result = state == WorkflowItemState.Completed ? history.GetWorkflowResult(eventId) : null,
                Reason = state == WorkflowItemState.Failed ? history.GetWorkflowReason(eventId) : null,
                Details =
                    state == WorkflowItemState.Failed ||
                    state == WorkflowItemState.Canceled ? history.GetWorkflowDetails(eventId) : null
            };
        }