System.Collections.Generic.List.Add(tHumanTaskParameter)

Here are the examples of the csharp api System.Collections.Generic.List.Add(tHumanTaskParameter) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 View Source File : CMMNParser.cs
License : Apache License 2.0
Project Creator : simpleidserver

private static CaseEltInstance BuildPlanItem(string id, string name, tPlanItemDefinition planItemDef, string casePlanInstanceId)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                name = planItemDef.name;
            }

            if (planItemDef is tHumanTask)
            {
                var humanTask = planItemDef as tHumanTask;
                List<tHumanTaskParameter> pars = new List<tHumanTaskParameter>();
                if (humanTask.implementation == CMMNConstants.UserTaskImplementations.WSHUMANTASK)
                {
                    var parameters = humanTask.extensionElements?.Any.FirstOrDefault(_ => _.Name == "cmg:parameters");
                    if (parameters != null)
                    {
                        var xmlSerializer = new XmlSerializer(typeof(tHumanTaskParameter), "https://github.com/simpleidserver/CaseManagement");
                        foreach (XmlNode child in parameters.ChildNodes)
                        {
                            using (var txtReader = new StringReader(child.OuterXml))
                            {
                                pars.Add((tHumanTaskParameter)xmlSerializer.Deserialize(txtReader));
                            }
                        }
                    }
                }

                var result = new CaseEltInstance
                { 
                    Id = CaseEltInstance.BuildId(casePlanInstanceId, id, 0),
                    EltId = id,
                    NbOccurrence = 0,
                    Name = name, 
                    Type = CasePlanElementInstanceTypes.HUMANTASK
                };
                result.UpdateFormId(humanTask.formId);
                result.UpdateImplementation(humanTask.implementation);
                result.UpdateInputParameters(pars.ToDictionary(kvp => kvp.key, kvp => kvp.value));
                result.UpdatePerformerRef(humanTask.performerRef);
                return result;
            }

            if (planItemDef is tTask)
            {
                return new CaseEltInstance
                {
                    Id = CaseEltInstance.BuildId(casePlanInstanceId, id, 0),
                    EltId = id,
                    NbOccurrence = 0,
                    Name = name,
                    Type = CasePlanElementInstanceTypes.EMPTYTASK
                };
            }

            if (planItemDef is tTimerEventListener)
            {
                var timer = planItemDef as tTimerEventListener;
                CMMNExpression expression = new CMMNExpression
                {
                    Body = timer.timerExpression.Text.First(),
                    Language = timer.timerExpression.language
                };
                var result = new CaseEltInstance
                {
                    Id = CaseEltInstance.BuildId(casePlanInstanceId, id, 0),
                    EltId = id,
                    NbOccurrence = 0,
                    Name = name, 
                    Type = CasePlanElementInstanceTypes.TIMER
                };
                result.UpdateTimerExpression(expression);
                return result;
            }

            if (planItemDef is tMilestone)
            {
                return new CaseEltInstance
                {
                    Id = CaseEltInstance.BuildId(casePlanInstanceId, id, 0),
                    EltId = id,
                    NbOccurrence = 0,
                    Name = name,
                    Type = CasePlanElementInstanceTypes.MILESTONE
                };
            }

            if (planItemDef is tStage)
            {
                return BuildStage(id, planItemDef as tStage, casePlanInstanceId);
            }

            return null;
        }