Esempio n. 1
0
        public static List <Variable> DecisionServiceConvertNamedParameter(NamedParameters nParam, TDecisionService decisionService, VariableContext context)
        {
            var variables  = new List <Variable> ();
            var parameters = nParam.Execute();

            if (parameters is Dictionary <string, IExpression> outExprs)
            {
                foreach (var item in decisionService.InputDecision)
                {
                    var decId = item.Href.TrimStart('#');
                    context.DecisionMetaById.TryGetValue(decId, out var decision);
                    outExprs.TryGetValue(decision.Name, out var expression);
                    if (expression == null)
                    {
                        throw new FEELException($"Missing expected named parameter {decision.Name}");
                    }
                    if (expression != null)
                    {
                        variables.Add((Variable)expression.Execute(context));
                    }
                }
                return(variables);
            }

            throw new FEELException("Failed coverting named parameters");
        }
Esempio n. 2
0
        public static List <Variable> BKMConvertNamedParameter(NamedParameters nParam, TBusinessKnowledgeModel bkmModel, VariableContext context)
        {
            var variables  = new List <Variable> ();
            var parameters = nParam.Execute();

            if (parameters is Dictionary <string, IExpression> outExprs)
            {
                foreach (var item in bkmModel.EncapsulatedLogic.FormalParameter)
                {
                    outExprs.TryGetValue(item.Name, out var expression);
                    if (expression == null)
                    {
                        throw new FEELException($"Missing expected named parameter {item.Name}");
                    }
                    if (expression != null)
                    {
                        variables.Add((Variable)expression.Execute(context));
                    }
                }
            }

            throw new FEELException("Failed coverting named parameters");
        }