예제 #1
0
        protected internal virtual void addResultToVariableContext(IDmnDecisionResult evaluatedResult,
                                                                   IVariableMap variableMap, IDmnDecision evaluatedDecision)
        {
            var resultList = evaluatedResult.ResultList;

            if (resultList.Count == 0)
            {
            }
            else if ((resultList.Count == 1) && !isDecisionTableWithCollectOrRuleOrderHitPolicy(evaluatedDecision))
            {
                foreach (var it in evaluatedResult.SingleResult)
                {
                    variableMap.PutValue(it.Key, it.Value);
                }
                //variableMap.putAll(evaluatedResult.SingleResult);
            }
            else
            {
                ISet <string> outputs = new HashSet <string>();

                foreach (var resultMap in resultList)
                {
                    outputs.UnionWith(resultMap.Keys);
                }

                foreach (var output in outputs)
                {
                    var values = evaluatedResult.CollectEntries <object>(output);
                    variableMap.PutValue(output, values);
                }
            }
        }
        public virtual object MapDecisionResult(IDmnDecisionResult decisionResult)
        {
            if ((decisionResult == null) || (decisionResult.Count == 0))
            {
                return(null);
            }
            var outputNames = CollectOutputNames(decisionResult);

            if (outputNames.Count > 1)
            {
                throw Log.DecisionResultCollectMappingException(outputNames, decisionResult, this);
            }
            var outputName = outputNames.FirstOrDefault();

            //return decisionResult.CollectEntries<IDmnDecisionResultEntries>(outputName);
            return(decisionResult.CollectEntries <ITypedValue>(outputName));
        }