use of org.kie.dmn.model.api.InformationRequirement in project drools by kiegroup.
the class DMNCompilerImpl method linkRequirements.
public void linkRequirements(DMNModelImpl model, DMNBaseNode node) {
for (InformationRequirement ir : node.getInformationRequirement()) {
if (ir.getRequiredInput() != null) {
String id = getId(ir.getRequiredInput());
InputDataNode input = model.getInputById(id);
if (input != null) {
node.addDependency(input.getName(), input);
} else {
MsgUtil.reportMessage(logger, DMNMessage.Severity.ERROR, ir.getRequiredInput(), model, null, null, Msg.REQ_INPUT_NOT_FOUND_FOR_NODE, id, node.getName());
}
} else if (ir.getRequiredDecision() != null) {
String id = getId(ir.getRequiredDecision());
DecisionNode dn = model.getDecisionById(id);
if (dn != null) {
node.addDependency(dn.getName(), dn);
} else {
MsgUtil.reportMessage(logger, DMNMessage.Severity.ERROR, ir.getRequiredDecision(), model, null, null, Msg.REQ_DECISION_NOT_FOUND_FOR_NODE, id, node.getName());
}
}
}
for (KnowledgeRequirement kr : node.getKnowledgeRequirement()) {
if (kr.getRequiredKnowledge() != null) {
String id = getId(kr.getRequiredKnowledge());
BusinessKnowledgeModelNode bkmn = model.getBusinessKnowledgeModelById(id);
DecisionServiceNode dsn = model.getDecisionServiceById(id);
if (bkmn != null) {
node.addDependency(bkmn.getName(), bkmn);
} else if (dsn != null) {
node.addDependency(dsn.getName(), dsn);
} else {
MsgUtil.reportMessage(logger, DMNMessage.Severity.ERROR, kr.getRequiredKnowledge(), model, null, null, // TODO or a DS ?
Msg.REQ_BKM_NOT_FOUND_FOR_NODE, id, node.getName());
}
}
}
}
use of org.kie.dmn.model.api.InformationRequirement in project drools by kiegroup.
the class InformationRequirementConverter method writeChildren.
@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
super.writeChildren(writer, context, parent);
InformationRequirement ir = (InformationRequirement) parent;
if (ir.getRequiredDecision() != null) {
writeChildrenNode(writer, context, ir.getRequiredDecision(), REQUIRED_DECISION);
}
if (ir.getRequiredInput() != null) {
writeChildrenNode(writer, context, ir.getRequiredInput(), REQUIRED_INPUT);
}
}
use of org.kie.dmn.model.api.InformationRequirement in project drools by kiegroup.
the class DecisionConverter method writeChildren.
@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
super.writeChildren(writer, context, parent);
Decision dec = (Decision) parent;
if (dec.getQuestion() != null)
writeChildrenNodeAsValue(writer, context, dec.getQuestion(), QUESTION);
if (dec.getAllowedAnswers() != null)
writeChildrenNodeAsValue(writer, context, dec.getAllowedAnswers(), ALLOWED_ANSWERS);
if (dec.getVariable() != null)
writeChildrenNode(writer, context, dec.getVariable(), VARIABLE);
for (InformationRequirement ir : dec.getInformationRequirement()) {
writeChildrenNode(writer, context, ir, INFORMATION_REQUIREMENT);
}
for (KnowledgeRequirement kr : dec.getKnowledgeRequirement()) {
writeChildrenNode(writer, context, kr, KNOWLEDGE_REQUIREMENT);
}
for (AuthorityRequirement ar : dec.getAuthorityRequirement()) {
writeChildrenNode(writer, context, ar, AUTHORITY_REQUIREMENT);
}
for (DMNElementReference so : dec.getSupportedObjective()) {
writeChildrenNode(writer, context, so, SUPPORTED_OBJECTIVE);
}
for (DMNElementReference ipi : dec.getImpactedPerformanceIndicator()) {
writeChildrenNode(writer, context, ipi, IMPACTED_PERFORMANCE_INDICATOR);
}
for (DMNElementReference dm : dec.getDecisionMaker()) {
writeChildrenNode(writer, context, dm, DECISION_MAKER);
}
for (DMNElementReference downer : dec.getDecisionOwner()) {
writeChildrenNode(writer, context, downer, DECISION_OWNER);
}
for (DMNElementReference up : dec.getUsingProcess()) {
writeChildrenNode(writer, context, up, USING_PROCESS);
}
for (DMNElementReference ut : dec.getUsingTask()) {
writeChildrenNode(writer, context, ut, USING_TASK);
}
if (dec.getExpression() != null) {
Expression e = dec.getExpression();
String nodeName = MarshallingUtils.defineExpressionNodeName(xstream, e);
writeChildrenNode(writer, context, e, nodeName);
}
}
use of org.kie.dmn.model.api.InformationRequirement in project drools by kiegroup.
the class DecisionConverter method writeChildren.
@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
super.writeChildren(writer, context, parent);
Decision dec = (Decision) parent;
if (dec.getQuestion() != null)
writeChildrenNodeAsValue(writer, context, dec.getQuestion(), QUESTION);
if (dec.getAllowedAnswers() != null)
writeChildrenNodeAsValue(writer, context, dec.getAllowedAnswers(), ALLOWED_ANSWERS);
if (dec.getVariable() != null)
writeChildrenNode(writer, context, dec.getVariable(), VARIABLE);
for (InformationRequirement ir : dec.getInformationRequirement()) {
writeChildrenNode(writer, context, ir, INFORMATION_REQUIREMENT);
}
for (KnowledgeRequirement kr : dec.getKnowledgeRequirement()) {
writeChildrenNode(writer, context, kr, KNOWLEDGE_REQUIREMENT);
}
for (AuthorityRequirement ar : dec.getAuthorityRequirement()) {
writeChildrenNode(writer, context, ar, AUTHORITY_REQUIREMENT);
}
for (DMNElementReference so : dec.getSupportedObjective()) {
writeChildrenNode(writer, context, so, SUPPORTED_OBJECTIVE);
}
for (DMNElementReference ipi : dec.getImpactedPerformanceIndicator()) {
writeChildrenNode(writer, context, ipi, IMPACTED_PERFORMANCE_INDICATOR);
}
for (DMNElementReference dm : dec.getDecisionMaker()) {
writeChildrenNode(writer, context, dm, DECISION_MAKER);
}
for (DMNElementReference downer : dec.getDecisionOwner()) {
writeChildrenNode(writer, context, downer, DECISION_OWNER);
}
for (DMNElementReference up : dec.getUsingProcess()) {
writeChildrenNode(writer, context, up, USING_PROCESS);
}
for (DMNElementReference ut : dec.getUsingTask()) {
writeChildrenNode(writer, context, ut, USING_TASK);
}
if (dec.getExpression() != null) {
Expression e = dec.getExpression();
String nodeName = MarshallingUtils.defineExpressionNodeName(xstream, e);
writeChildrenNode(writer, context, e, nodeName);
}
}
use of org.kie.dmn.model.api.InformationRequirement in project drools by kiegroup.
the class InformationRequirementConverter method writeChildren.
@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
super.writeChildren(writer, context, parent);
InformationRequirement ir = (InformationRequirement) parent;
if (ir.getRequiredDecision() != null) {
writeChildrenNode(writer, context, ir.getRequiredDecision(), REQUIRED_DECISION);
}
if (ir.getRequiredInput() != null) {
writeChildrenNode(writer, context, ir.getRequiredInput(), REQUIRED_INPUT);
}
}
Aggregations