Esempio n. 1
0
        protected internal virtual void InitializeTaskCandidateUsers(TaskEntity task, IVariableScope variableScope)
        {
            var candidateUserIdExpressions = taskDefinition.CandidateUserIdExpressions;

            foreach (var userIdExpr in candidateUserIdExpressions)
            {
                var value = userIdExpr.GetValue(variableScope);

                if (value is string)
                {
                    var candiates = ExtractCandidates((string)value);
                    task.AddCandidateUsers(candiates);
                }
                else if (value is ICollection)
                {
                    task.AddCandidateUsers(((ICollection <string>)value).Distinct().ToArray());
                }
                else
                {
                    throw new ProcessEngineException("Expression did not resolve to a string or collection of strings");
                }
            }
        }