protected internal virtual IList <IHistoricDecisionOutputInstance> CreateHistoricDecisionOutputInstances( IDmnDecisionTableEvaluationEvent evaluationEvent) { IList <IHistoricDecisionOutputInstance> outputInstances = new List <IHistoricDecisionOutputInstance>(); var matchingRules = evaluationEvent.MatchingRules; for (var index = 0; index < matchingRules.Count; index++) { var rule = matchingRules[index]; var ruleId = rule.Id; int?ruleOrder = index + 1; //foreach (DmnEvaluatedOutput outputClause in rule.OutputEntries.values()) { //HistoricDecisionOutputInstanceEntity outputInstance = new HistoricDecisionOutputInstanceEntity(); //outputInstance.ClauseId = outputClause.Id; //outputInstance.ClauseName = outputClause.Name; //outputInstance.RuleId = ruleId; //outputInstance.RuleOrder = ruleOrder; //outputInstance.VariableName = outputClause.OutputName; //outputInstance.setValue(outputClause.Value); //outputInstances.Add(outputInstance); } } return(outputInstances); }
public virtual IDmnDecisionTableEvaluationEvent apply( IDmnDecisionTableEvaluationEvent decisionTableEvaluationEvent) { var matchingRules = decisionTableEvaluationEvent.MatchingRules; if (matchingRules.Count < 2) { return(decisionTableEvaluationEvent); } throw LOG.uniqueHitPolicyOnlyAllowsSingleMatchingRule(matchingRules); }
protected internal virtual string getResultName(IDmnDecisionTableEvaluationEvent decisionTableEvaluationEvent) { foreach (var matchingRule in decisionTableEvaluationEvent.MatchingRules) { var outputEntries = matchingRule.OutputEntries; if (outputEntries.Count > 0) { return(outputEntries.Values.First().OutputName); } } return(null); }
public virtual IDmnDecisionTableEvaluationEvent apply( IDmnDecisionTableEvaluationEvent decisionTableEvaluationEvent) { var resultName = getResultName(decisionTableEvaluationEvent); var resultValue = getResultValue(decisionTableEvaluationEvent); var evaluationEvent = (DmnDecisionTableEvaluationEventImpl)decisionTableEvaluationEvent; evaluationEvent.CollectResultName = resultName; evaluationEvent.CollectResultValue = resultValue; return(evaluationEvent); }
public virtual IDmnDecisionTableEvaluationEvent apply( IDmnDecisionTableEvaluationEvent decisionTableEvaluationEvent) { if (decisionTableEvaluationEvent.MatchingRules.Count > 0) { var firstMatchedRule = decisionTableEvaluationEvent.MatchingRules[0]; ((DmnDecisionTableEvaluationEventImpl)decisionTableEvaluationEvent).MatchingRules = new List <IDmnEvaluatedDecisionRule> { firstMatchedRule }; //Collections.singletonList(firstMatchedRule); } return(decisionTableEvaluationEvent); }
protected internal virtual void InitDecisionInstanceEventForDecisionTable(HistoricDecisionInstanceEntity @event, IDmnDecisionTableEvaluationEvent evaluationEvent) { if (evaluationEvent.CollectResultValue != null) { //double? collectResultValue = getCollectResultValue(evaluationEvent.CollectResultValue); //@event.CollectResultValue = collectResultValue; } var historicDecisionInputInstances = CreateHistoricDecisionInputInstances(evaluationEvent); @event.Inputs = historicDecisionInputInstances; var historicDecisionOutputInstances = CreateHistoricDecisionOutputInstances(evaluationEvent); @event.Outputs = historicDecisionOutputInstances; }
protected internal virtual IList <IHistoricDecisionInputInstance> CreateHistoricDecisionInputInstances( IDmnDecisionTableEvaluationEvent evaluationEvent) { IList <IHistoricDecisionInputInstance> inputInstances = new List <IHistoricDecisionInputInstance>(); foreach (var inputClause in evaluationEvent.Inputs) { var inputInstance = new HistoricDecisionInputInstanceEntity(); inputInstance.ClauseId = inputClause.Id; inputInstance.ClauseName = inputClause.Name; //ITypedValue typedValue = Variables.untypedValue(inputClause.Value); //inputInstance.setValue(typedValue); inputInstances.Add(inputInstance); } return(inputInstances); }
protected internal virtual IList <ITypedValue> collectSingleValues( IDmnDecisionTableEvaluationEvent decisionTableEvaluationEvent) { IList <ITypedValue> values = new List <ITypedValue>(); foreach (var matchingRule in decisionTableEvaluationEvent.MatchingRules) { var outputEntries = matchingRule.OutputEntries; if (outputEntries.Count > 1) { throw LOG.aggregationNotApplicableOnCompoundOutput(Aggregator, outputEntries); } if (outputEntries.Count == 1) { ITypedValue typedValue = outputEntries.Values.First().Value; values.Add(typedValue); } // ignore empty output entries } return(values); }
public virtual IDmnDecisionTableEvaluationEvent apply( IDmnDecisionTableEvaluationEvent decisionTableEvaluationEvent) { var matchingRules = decisionTableEvaluationEvent.MatchingRules; if (matchingRules.Count > 0) { if (allOutputsAreEqual(matchingRules)) { var firstMatchingRule = matchingRules[0]; ((DmnDecisionTableEvaluationEventImpl)decisionTableEvaluationEvent).MatchingRules = new List <IDmnEvaluatedDecisionRule> { firstMatchingRule }; //Collections.singletonList(firstMatchingRule); } else { throw LOG.anyHitPolicyRequiresThatAllOutputsAreEqual(matchingRules); } } return(decisionTableEvaluationEvent); }
public virtual IDmnDecisionTableEvaluationEvent apply( IDmnDecisionTableEvaluationEvent decisionTableEvaluationEvent) { return(decisionTableEvaluationEvent); }
public virtual void Notify(IDmnDecisionTableEvaluationEvent evaluationEvent) { // collector is registered as decision evaluation listener }
protected internal virtual ITypedValue getResultValue(IDmnDecisionTableEvaluationEvent decisionTableEvaluationEvent) { var values = collectSingleValues(decisionTableEvaluationEvent); return(aggregateValues(values)); }
public virtual void Notify(IDmnDecisionTableEvaluationEvent evaluationEvent) { // the wrapper listen for decision evaluation events }