Exemple #1
0
 public static void ShouldBeAsExpected(this IProcessElement processElement, ParamScenarioTest param)
 {
     processElement.Should().NotBeNull();
     processElement.RunningService.Should().Be(param.ExpectedRunningService);
     processElement.Start.Should().Be(param.ExpectedDateStarted);
     processElement.Stop.Should().Be(param.ExpectedDateStoped);
     processElement.State.Should().Be(param.ExpectedState);
 }
Exemple #2
0
 public bool TryRetrieveIElementById(string elementId, out IProcessElement element)
 {
     foreach (var process in _contractManager.GetAllProcesses())
     {
         if (TryRetrieveIElementById(elementId, process.Id, out element))
         {
             return(true);
         }
     }
     element = null;
     return(false);
 }
Exemple #3
0
        public bool TryRetrieveIElementById(string elementId, string processId, out IProcessElement element)
        {
            if (TryRetrieveElementById(elementId, processId, out var processElement))
            {
                element = processElement;
                return(true);
            }

            if (TryRetrieveSequenceFlowById(elementId, processId, out var sequenceFlow))
            {
                element = sequenceFlow;
                return(true);
            }

            element = null;
            return(false);
        }
Exemple #4
0
        private void ExecuteElement(IProcessElement element)
        {
            if (element.IsExecuted)
            {
                return;
            }
            element.IsExecuted = true; //do not want it here!!

            foreach (var parentId in element.PreviousElementIds)
            {
                ExecuteElement(ProcessElements[parentId]);
            }

            element.Execute(ProcessState);

            foreach (var nextId in element.NextElementIds)
            {
                ExecuteElement(ProcessElements[nextId]);
            }
        }
Exemple #5
0
        public void ChangeProcessOfElement(IProcessElement element, string prevProcessId, string newProcessId)
        {
            if (!_contractManager.TryGetProcess(prevProcessId, out var prevProcess))
            {
                throw new InvalidIdException($"Process id {prevProcessId} does not exist");
            }
            if (!_contractManager.TryGetProcess(newProcessId, out var newProcess))
            {
                throw new InvalidIdException($"Process id {newProcessId} does not exist");
            }

            if (element is ProcessElement)
            {
                prevProcess.ProcessElements.Remove(element.Id);
                newProcess.ProcessElements.Add(element.Id, element as ProcessElement);
            }
            else
            {
                prevProcess.SequenceFlows.Remove(element.Id);
                newProcess.SequenceFlows.Add(element.Id, element as SequenceFlow);
            }
        }
Exemple #6
0
        private void SetupProcessElements(InputProcessModel inputModel)
        {
            ProcessElements = new Dictionary <int, IProcessElement>();
            foreach (var processModel in inputModel.Elements)
            {
                IProcessElement element = null;
                switch (processModel.ElementType)
                {
                case ElementType.Block:
                    element = new BlockElement(processModel.PreviousElementIds, processModel.NextElementIds, processModel.Actions);
                    break;

                case ElementType.Condition:
                    element = new ConditionElement(processModel.PreviousElementIds, processModel.Actions);
                    break;

                case ElementType.Event:
                    element = new EventElement(processModel.PreviousElementIds, processModel.NextElementIds, processModel.Actions);
                    break;
                }

                ProcessElements[processModel.Id] = element;
            }
        }
 private ProcessModel AddElement(IProcessElement <IElement> element)
 => new ProcessModel(Id, Version + 1, Elements.Add(element), Associations);
Exemple #8
0
 private ProcessModel AddElement(IProcessElement <IElement> element)
 => new ProcessModel(Guid.NewGuid().ToString(), Version + 1, Elements.Add(element), Associations);