/// <summary>
        ///
        /// </summary>
        /// <param name="event"></param>
        public override void OnEvent(IActivitiEvent @event)
        {
            if (@event is CustomTaskCompletedEntityEventImpl taskEvent)
            {
                ITaskEntity taskEntity = taskEvent.Entity as ITaskEntity;

                ICommandContext commandContext = Context.CommandContext;

                IExecutionEntity execution = taskEntity.Execution;

                UserTask userTask = execution.CurrentFlowElement as UserTask;

                if (userTask.HasMultiInstanceLoopCharacteristics() &&
                    (taskEntity.IsAppend.GetValueOrDefault(false) ||
                     taskEntity.IsTransfer.GetValueOrDefault(false)))
                {
                    IExecutionEntity parent = execution.FindMultiInstanceParentExecution();

                    var collection = userTask.LoopCharacteristics.GetCollectionVarName();

                    IList <string> users = parent.GetLoopVariable <IList <string> >(collection);

                    string usr = users.FirstOrDefault(x => x.Equals(taskEntity.Assignee, StringComparison.OrdinalIgnoreCase));

                    if (usr != null)
                    {
                        users.Remove(usr);
                        parent.SetLoopVariable(collection, users);
                    }
                }
            }
        }
Exemplo n.º 2
0
        internal static bool TryGetMultiInstance(this IExecutionEntity execution, out IExecutionEntity miRoot)
        {
            miRoot = execution.FindMultiInstanceParentExecution();

            return(miRoot != null);
        }