use of org.kie.dmn.model.api.DMNElementReference 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.DMNElementReference in project drools by kiegroup.
the class DecisionServiceConverter method writeChildren.
@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
super.writeChildren(writer, context, parent);
DecisionService decisionService = (DecisionService) parent;
for (DMNElementReference ref : decisionService.getOutputDecision()) {
writeChildrenNode(writer, context, ref, OUTPUT_DECISION);
}
for (DMNElementReference ref : decisionService.getEncapsulatedDecision()) {
writeChildrenNode(writer, context, ref, ENCAPSULATED_DECISION);
}
for (DMNElementReference ref : decisionService.getInputDecision()) {
writeChildrenNode(writer, context, ref, INPUT_DECISION);
}
for (DMNElementReference ref : decisionService.getInputData()) {
writeChildrenNode(writer, context, ref, INPUT_DATA);
}
}
use of org.kie.dmn.model.api.DMNElementReference in project drools by kiegroup.
the class DMNElementReferenceConverter method writeAttributes.
@Override
protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) {
super.writeAttributes(writer, parent);
DMNElementReference er = (DMNElementReference) parent;
if (er.getHref() != null)
writer.addAttribute(HREF, er.getHref());
}
use of org.kie.dmn.model.api.DMNElementReference in project drools by kiegroup.
the class ValidatorImportTest method testWrongImportBaseModelFromReaderInput.
@Test
public void testWrongImportBaseModelFromReaderInput() throws IOException {
try (final Reader reader0 = getReader("import/Base-model.dmn");
final Reader reader1 = getReader("import/Wrong-Import-base-model.dmn")) {
final List<DMNMessage> messages = validator.validateUsing(Validation.VALIDATE_MODEL).theseModels(reader0, reader1);
assertThat(ValidatorUtil.formatMessages(messages), messages.size(), is(1));
assertTrue(messages.stream().anyMatch(p -> p.getMessageType().equals(DMNMessageType.REQ_NOT_FOUND) && p.getSourceReference() instanceof DMNElementReference && ((DMNElementReference) p.getSourceReference()).getHref().equals("http://www.trisotech.com/definitions/_70df1ad5-2a33-4ede-b8b2-869988ac1d30#_1d52934e-aa4e-47c9-a011-fc989d795664")));
}
}
use of org.kie.dmn.model.api.DMNElementReference in project drools by kiegroup.
the class PerformanceIndicatorConverter method writeChildren.
@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
super.writeChildren(writer, context, parent);
PerformanceIndicator pi = (PerformanceIndicator) parent;
for (DMNElementReference id : pi.getImpactingDecision()) {
writeChildrenNode(writer, context, id, IMPACTING_DECISION);
}
}
Aggregations