Exemple #1
0
        protected override async Task <bool> ProtectedProcess(CMMNExecutionContext executionContext, CaseEltInstance elt, CancellationToken cancellationToken)
        {
            var handler = _humanTaskHandlers.FirstOrDefault(_ => _.Implementation == elt.GetImplementation());

            if (handler != null)
            {
                if (!executionContext.Instance.WorkerTaskExists(elt.Id))
                {
                    var workerTaskId = await handler.Create(executionContext, elt, cancellationToken);

                    executionContext.Instance.TryAddWorkerTask(elt.Id, workerTaskId);
                }
            }

            var completeSubscription = await TrySubscribe(executionContext, elt, CMMNConstants.ExternalTransitionNames.Complete, cancellationToken);

            if (completeSubscription.IsCaptured)
            {
                var sub = await TryReset(executionContext, elt, CMMNConstants.ExternalTransitionNames.Complete, cancellationToken);

                executionContext.Instance.MakeTransition(elt, CMMNTransitions.Complete, incomingTokens: MergeParameters(executionContext, completeSubscription.Parameters));
                return(true);
            }

            return(false);
        }