public string Path(WorkflowBlock item)
        {
            if (_blockToPathMap.ContainsKey(item))
                return _blockToPathMap[item];

            return null;
        }
        public WorkflowPathNavigator(WorkflowBlock workflowBlock)
        {
            if (workflowBlock == null) throw new ArgumentNullException("workflowBlock");

            _pathToBlockMap = new Dictionary<string, WorkflowBlock>();
            _blockToPathMap = new Dictionary<WorkflowBlock, string>();

            Visit(workflowBlock, "", 0);
        }
Exemple #3
0
        //todo: support delay
        public RetryBlock(WorkflowBlock child, int retryCount)
        {
            if (child == null) throw new ArgumentNullException("child");
            if (retryCount < 1) throw new ArgumentException("retryCount cannot be less than 1");

            Child = child;

            InputTypes = child.InputTypes;
            OutputType = child.OutputType;

            RetryCount = retryCount;
        }
        void Visit(WorkflowBlock item, string parentPath, int index)
        {
            var path = string.Format("{0}{1}[{2}]", parentPath == "" ? "" : parentPath + ".", item.Type, index);

            _pathToBlockMap[path] = item;
            _blockToPathMap[item] = path;

            if (item is GroupBlock)
            {
                var children = ((GroupBlock) item).Children;
                var i = 0;
                foreach (var child in children)
                {
                    Visit(child, path, i++);
                }
            }
        }
Exemple #5
0
        public ForkBlock(WorkflowBlock child, int maxWorkers)
        {
            if (child == null) throw new ArgumentNullException("child");
            if (maxWorkers <= 0) throw new ArgumentException("maxWorkers must be a positive number");

            InputTypes = child.InputTypes;
            if (child.OutputType == typeof (void))
            {
                OutputType = typeof (void);
            }
            else
            {
                OutputType = typeof (IEnumerable<>).MakeGenericType(child.OutputType);
            }

            Child = child;
            MaxWorkers = maxWorkers;
        }
 int GetMaxWorkers(WorkflowBlock workflowBlock)
 {
     return ((ParallelBlock) workflowBlock).MaxWorkers;
 }