예제 #1
0
        public async Task <Graph <Key, FormNode> > InitialiseForm(string formKey, FormType formType)
        {
            var form = _staticFormProvider.GetForm(formType);

            var graph = new Graph <Key, FormNode>();

            var formRouterNode = new GraphNode <Key, FormNode>(Key.ForDecisionFormRouter(), new FormRouterFormNode());

            graph.AddNode(formRouterNode);

            var taskListNode = form.TaskListPage is null
                ? new GraphNode <Key, FormNode>(Key.ForTaskList(), new TaskListGhost())
                : new GraphNode <Key, FormNode>(Key.ForTaskList(), new TaskListFormNode());

            graph.AddNode(taskListNode);
            graph.AddDirectedEdge(formRouterNode, taskListNode);

            foreach (var task in form.Tasks)
            {
                AddTask(graph, taskListNode, task, 0);
            }

            await _formRepository.SaveForm(formKey, graph);

            return(graph);
        }
예제 #2
0
        public IDictionary <string, IList <TaskGrouping> > GetFormSummary(Graph <Key, FormNode> graph, FormType formType)
        {
            var taskList = graph.Nodes.FindByKey(Key.ForTaskList());

            var form = _staticFormProvider.GetForm(formType);

            var result = new Dictionary <string, IList <TaskGrouping> >();

            foreach (var task in form.Tasks)
            {
                var taskNode = taskList.Neighbors.FindByKey(Key.ForDecisionTaskRouter(task.Id));
                result.Add(task.Id, GetTaskSummary(taskNode, task));
            }

            return(result);
        }