//TODO 基于Attribute中的id转换 dmnDecisions[decision.Id] protected internal virtual void BuildDecisionRequirements(ICollection <IDecision> decisions, IDictionary <string, DmnDecisionImpl> dmnDecisions) { foreach (var decision in decisions) { var requiredDmnDecisions = GetRequiredDmnDecisions(decision, dmnDecisions); //var dmnDecision = dmnDecisions[decision.Id]; DmnDecisionImpl dmnDecision = null; if ((decision.Id != null) && dmnDecisions.ContainsKey(decision.Id) && (decision != null)) { dmnDecision = dmnDecisions[decision.Id]; } if (requiredDmnDecisions.Count > 0) { dmnDecision.RequiredDecisions = requiredDmnDecisions; } } }
//TODO Dmn获取Decision protected internal virtual DmnDecisionImpl TransformDecision(IDecision decision) { //TODO Hander处理 var handler = handlerRegistry.getHandler <IDecision, DmnDecisionImpl>(typeof(IDecision)); var dmnDecision = handler.HandleElement(this, decision); this.decision = dmnDecision; // validate decision id if (ReferenceEquals(dmnDecision.Key, null)) { throw LOG.DecisionIdIsMissing(dmnDecision); } var expression = decision.Expression; if (expression == null) { LOG.DecisionWithoutExpression(decision); return(null); } //TODO expression异常 if (expression is IDecisionTable) { var dmnDecisionTable = TransformDecisionTable((IDecisionTable)expression); dmnDecision.DecisionLogic = dmnDecisionTable; } else if (expression is ILiteralExpression) { var dmnDecisionLiteralExpression = TransformDecisionLiteralExpression(decision, (ILiteralExpression)expression); dmnDecision.DecisionLogic = dmnDecisionLiteralExpression; } else { LOG.DecisionTypeNotSupported(expression, decision); return(null); } //return null; return(dmnDecision); }