private bool ProcessAttributeRequest(WorkflowActivityArgs args, List <string> required)
        {
            bool ret = true;
            WorkflowAttributeCollection found = new WorkflowAttributeCollection();
            List <string> attr_list           = new List <string>();

            if (required != null && required.Count > 0)
            {
                List <WorkflowParameter> list = _process.Parameters;
                foreach (string name in required)
                {
                    ret = false;
                    WorkflowParameter curr_param = list.FirstOrDefault(p => p.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase));
                    //find if override exist
                    if (curr_param != null && curr_param.Override != null)
                    {
                        foreach (string attr_name in curr_param.Override)
                        {
                            if (_attributes.Keys.Contains(attr_name))
                            {
                                found.Add(name, _attributes[attr_name]);
                                ret = true;
                                break;
                            }
                        }
                    }
                    else
                    {
                        if (_attributes.Keys.Contains(name))
                        {
                            found.Add(name, _attributes[name]);
                            ret = true;
                        }
                    }

                    if (!ret)
                    {
                        if (curr_param == null || curr_param.Default == null)
                        {
                            _logger.Error("Error {ErrorCode}: Attribute {Name} is not found", -11, name);
                            break;
                        }
                        else
                        {
                            found.Add(name, curr_param.Default);
                            ret = true;
                        }
                    }
                }
            }

            args.RequiredAttributes = found;
            return(ret);
        }
Example #2
0
        private List <WorkflowParameter> LegacyDeserialize(string param)
        {
            List <WorkflowParameter>      list = new List <WorkflowParameter>();
            Dictionary <string, string[]> dic  = ParseParameterString(param);

            foreach (var kvp in dic)
            {
                WorkflowParameter p = new WorkflowParameter();
                p.Name     = kvp.Key;
                p.Override = new List <string>(kvp.Value);
                list.Add(p);
            }

            return(list);
        }