public void MakeTransition(BaseCaseEltInstance element, CMMNTransitions transition, bool isEvtPropagate = true) { var evt = new CaseElementTransitionRaisedEvent(Guid.NewGuid().ToString(), AggregateId, Version + 1, element.Id, transition, DateTime.UtcNow); Handle(evt); DomainEvents.Add(evt); var caseWorkerTask = WorkerTasks.FirstOrDefault(_ => _.CasePlanElementInstanceId == element.Id); if (caseWorkerTask != null && (transition == CMMNTransitions.Complete || transition == CMMNTransitions.Terminate || transition == CMMNTransitions.ParentTerminate)) { var removeCWT = new CaseInstanceWorkerTaskRemovedEvent(Guid.NewGuid().ToString(), AggregateId, Version + 1, element.Id, DateTime.UtcNow); Handle(removeCWT); DomainEvents.Add(removeCWT); } if (isEvtPropagate) { PropagateTransition(element, transition); } }
private void Handle(CaseElementTransitionRaisedEvent evt) { var child = GetChild(evt.ElementId); child.MakeTransition(evt.Transition, DateTime.UtcNow); }