Esempio n. 1
0
        /// <summary>
        /// 侦听任务执行完成时接收通知处理
        /// </summary>
        /// <param name="execution"></param>
        public void Notify(IExecutionEntity execution)
        {
            UserTask task = execution.CurrentFlowElement as UserTask;

            if (task.ExtensionElements.TryGetValue(BpmnXMLConstants.ELEMENT_EXTENSIONS_PROPERTY, out IList <ExtensionElement> exts))
            {
                if (bool.TryParse(exts.GetAttributeValue(BpmnXMLConstants.ACTIITI_RUNTIME_ASSIGNEE), out bool result) == false || result == false)
                {
                    return;
                }

                var variable = execution.GetVariableInstance(BpmnXMLConstants.RUNTIME_ASSIGNEE_USER_VARIABLE_NAME);

                RuntimeAssigneeUser user = JToken.FromObject(variable.Value).ToObject <RuntimeAssigneeUser>();

                if ((user?.Users?.Count()).GetValueOrDefault() == 0)
                {
                    return;
                }

                string collection   = task.LoopCharacteristics.GetCollectionVarName();
                string elemVariable = task.LoopCharacteristics.ElementVariable;

                execution.RemoveVariableLocal(collection);
                execution.RemoveVariableLocal(elemVariable);
            }
        }
 protected internal virtual void RemoveLocalLoopVariable(IExecutionEntity execution, string variableName)
 {
     execution.RemoveVariableLocal(variableName);
 }