Esempio n. 1
0
        public static bool IsChildOfExpandedWorkItem(this IReadableWorkflowRepository workflowRepository, WorkItem item)
        {
            if (item.Parent == null)
            {
                return(false);
            }

            var parent   = workflowRepository.GetWorkItem(item.Parent.Id);
            var workStep = workflowRepository.GetWorkStep(parent.Path);

            return(workStep.Type == WorkStepType.Expand);
        }
Esempio n. 2
0
        public static bool IsInExpandStep(this IReadableWorkflowRepository repository, WorkItem workItem, out WorkStep expandStep)
        {
            expandStep = null;
            bool isInExpandStep = repository.GetWorkStep(workItem.Path).Type == WorkStepType.Expand;

            if (isInExpandStep)
            {
                expandStep = repository.GetWorkStep(workItem.Path);
            }

            return(isInExpandStep);
        }
Esempio n. 3
0
        public static bool IsChildOfParallelledWorkItem(this IReadableWorkflowRepository repository, WorkItem workItem, out WorkItem parent)
        {
            if (workItem.Parent != null)
            {
                parent = repository.GetWorkItem(workItem.Parent.Id);
                if (parent.Status == WorkItemStatus.ParallelLocked)
                {
                    return(true);
                }
            }

            parent = null;
            return(false);
        }
Esempio n. 4
0
        public static bool IsMergeableParallelledChild(this IReadableWorkflowRepository repository, WorkItem item, WorkStep toStep)
        {
            if (!repository.IsChildOfParallelledWorkItem(item))
            {
                return(false);
            }

            var isMergeable = true;

            foreach (var childWorkItem in repository.GetChildWorkItems(item.Parent).Where(wi => wi.Id != item.Id))
            {
                isMergeable &= childWorkItem.Path == toStep.Path;
            }
            return(isMergeable);
        }
Esempio n. 5
0
        public static IEnumerable <WorkItem> GetWorkItemsRecursively(this IReadableWorkflowRepository workflowRepository, WorkStep workStep)
        {
            foreach (var childWorkStep in workflowRepository.GetChildWorkSteps(workStep.Path))
            {
                foreach (var workItem in GetWorkItemsRecursively(workflowRepository, childWorkStep))
                {
                    yield return(workItem);
                }
            }

            foreach (var workItem in workflowRepository.GetWorkItems(workStep.Path))
            {
                yield return(workItem);
            }
        }
Esempio n. 6
0
        public static WorkStep GetLeafStep(this IReadableWorkflowRepository repository, string path)
        {
            var currentWorkStep = repository.GetWorkStep(path);

            while (true)
            {
                if (currentWorkStep.Type == WorkStepType.Expand)
                {
                    break;
                }

                var subSteps = repository.GetChildWorkSteps(currentWorkStep.Path);
                if (subSteps.Count() == 0)
                {
                    break;
                }

                currentWorkStep = subSteps.OrderBy(subStep => subStep.Ordinal).ElementAt(0);
            }

            return(currentWorkStep);
        }
Esempio n. 7
0
 public static WorkStep GetLeafStep(this IReadableWorkflowRepository repository, WorkStep workStep)
 {
     return(GetLeafStep(repository, workStep.Path));
 }
Esempio n. 8
0
 public static bool IsDone(this IReadableWorkflowRepository workflowRepository, WorkItem item)
 {
     return(workflowRepository.GetWorkStep(item.Path).Type == WorkStepType.End);
 }
Esempio n. 9
0
 public static bool IsExpandStep(this IReadableWorkflowRepository repository, WorkStep step)
 {
     return(step.Type == WorkStepType.Expand);
 }
Esempio n. 10
0
        public static int GetNextOrdinal(this IReadableWorkflowRepository repository, WorkItem workItem)
        {
            var workItemsInStep = repository.GetWorkItems(workItem.Path);

            return(workItemsInStep.Count() > 0 ? workItemsInStep.Max(wi => wi.Ordinal.HasValue ? wi.Ordinal.Value : 0) + 1 : 1);
        }
Esempio n. 11
0
 public static bool IsRoot(this IReadableWorkflowRepository repository, string path)
 {
     return(path == WorkStep.Root.Path);
 }
Esempio n. 12
0
 public static bool IsWithinTransientStep(this IReadableWorkflowRepository repository, WorkStep workStep, out WorkStep transientStep)
 {
     return(TryLocateFirstAncestorStepOfType(repository, workStep, WorkStepType.Transient, out transientStep));
 }
Esempio n. 13
0
        public static bool IsInExpandStep(this IReadableWorkflowRepository workflow, WorkItem workItem)
        {
            WorkStep expandStep;

            return(IsInExpandStep(workflow, workItem, out expandStep));
        }
Esempio n. 14
0
 public static bool IsParallelStep(this IReadableWorkflowRepository repository, string path)
 {
     return(!IsRoot(repository, path) && IsParallelStep(repository, repository.GetWorkStep(path)));
 }
Esempio n. 15
0
        public static bool IsChildOfParallelledWorkItem(this IReadableWorkflowRepository repository, WorkItem workItem)
        {
            WorkItem parent;

            return(IsChildOfParallelledWorkItem(repository, workItem, out parent));
        }
Esempio n. 16
0
 public static bool IsExpandLockedWorkItem(this IReadableWorkflowRepository repository, WorkItem item)
 {
     return(item.Status == WorkItemStatus.ExpandLocked);
 }
Esempio n. 17
0
        public static bool TryLocateWorkItem(this IReadableWorkflowRepository repository, string id, out WorkItem item)
        {
            item = repository.GetWorkItem(id);

            return(item != null);
        }
Esempio n. 18
0
 public static IEnumerable <string> GetWorkItemClasses(this IReadableWorkflowRepository repository, WorkStep workStep)
 {
     yield return(workStep.WorkItemClass);
 }
Esempio n. 19
0
 public static bool IsValidWorkStepForWorkItem(this IReadableWorkflowRepository repository, WorkItem item, WorkStep workStep)
 {
     return(item.Classes.Contains(workStep.WorkItemClass));
 }
Esempio n. 20
0
 public XmlRenderer(IReadableWorkflowRepository workflowRepository)
 {
     _workflowRepository = workflowRepository;
 }
Esempio n. 21
0
 public static bool IsWithinExpandStep(this IReadableWorkflowRepository repository, WorkStep workStep, out WorkStep expandStep)
 {
     return(TryLocateFirstAncestorStepOfType(repository, workStep, WorkStepType.Expand, out expandStep));
 }
Esempio n. 22
0
 public static bool IsParallelLockedWorkItem(this IReadableWorkflowRepository repository, WorkItem workItem)
 {
     return(workItem.Status == WorkItemStatus.ParallelLocked);
 }
Esempio n. 23
0
 public static bool IsWithinParallelStep(this IReadableWorkflowRepository repository, WorkStep workStep, out WorkStep parallelStepRoot)
 {
     return(TryLocateFirstAncestorStepOfType(repository, workStep, WorkStepType.Parallel, out parallelStepRoot));
 }
Esempio n. 24
0
 public static bool IsParallelStep(this IReadableWorkflowRepository repository, WorkStep step)
 {
     return(step.Type == WorkStepType.Parallel);
 }
Esempio n. 25
0
 public static bool IsLeafStep(this IReadableWorkflowRepository repository, WorkStep step)
 {
     return(GetLeafStep(repository, step).Path == step.Path);
 }
Esempio n. 26
0
 public HtmlRenderer(IReadableWorkflowRepository workflowRepository)
 {
     _workflowRepository = workflowRepository;
 }