use of org.kie.dmn.model.v1_1.TDMNElementReference in project drools by kiegroup.
the class DecisionServiceConverter method parseElements.
@Override
protected void parseElements(HierarchicalStreamReader reader, UnmarshallingContext context, Object parent) {
while (reader.hasMoreChildren()) {
reader.moveDown();
Object object = null;
String nodeName = reader.getNodeName();
if (nodeName.equals(INPUT_DATA)) {
// Patch because the tag name inputData is used in both decision services and as a DRG Element
DMNElementReference ref = new TDMNElementReference();
ref.setHref(reader.getAttribute("href"));
object = ref;
} else {
// Default behaviour
object = readItem(reader, context, null);
}
if (object instanceof DMNModelInstrumentedBase) {
((KieDMNModelInstrumentedBase) object).setParent((KieDMNModelInstrumentedBase) parent);
((KieDMNModelInstrumentedBase) parent).addChildren((KieDMNModelInstrumentedBase) object);
}
reader.moveUp();
assignChildElement(parent, nodeName, object);
}
}
use of org.kie.dmn.model.v1_1.TDMNElementReference in project drools by kiegroup.
the class XLS2DMNParser method appendDecisionDT.
private void appendDecisionDT(Definitions definitions, Map<String, DTHeaderInfo> headerInfos) {
for (DTHeaderInfo hi : headerInfos.values()) {
Decision decision = new TDecision();
decision.setName(hi.getSheetName());
decision.setId("d_" + CodegenStringUtil.escapeIdentifier(hi.getSheetName()));
InformationItem variable = new TInformationItem();
variable.setName(hi.getSheetName());
variable.setId("dvar_" + CodegenStringUtil.escapeIdentifier(hi.getSheetName()));
variable.setTypeRef(new QName("Any"));
decision.setVariable(variable);
for (String ri : hi.getRequiredInput()) {
InformationRequirement ir = new TInformationRequirement();
DMNElementReference er = new TDMNElementReference();
er.setHref("#id_" + CodegenStringUtil.escapeIdentifier(ri));
ir.setRequiredInput(er);
decision.getInformationRequirement().add(ir);
}
for (String ri : hi.getRequiredDecision()) {
InformationRequirement ir = new TInformationRequirement();
DMNElementReference er = new TDMNElementReference();
er.setHref("#d_" + CodegenStringUtil.escapeIdentifier(ri));
ir.setRequiredDecision(er);
decision.getInformationRequirement().add(ir);
}
DecisionTable dt = new TDecisionTable();
dt.setOutputLabel(hi.getSheetName());
dt.setId("ddt_" + CodegenStringUtil.escapeIdentifier(hi.getSheetName()));
dt.setHitPolicy(HitPolicy.ANY);
for (String ri : hi.getRequiredInput()) {
InputClause ic = new TInputClause();
ic.setLabel(ri);
LiteralExpression le = new TLiteralExpression();
le.setText(ri);
ic.setInputExpression(le);
dt.getInput().add(ic);
}
for (String rd : hi.getRequiredDecision()) {
InputClause ic = new TInputClause();
ic.setLabel(rd);
LiteralExpression le = new TLiteralExpression();
le.setText(rd);
ic.setInputExpression(le);
dt.getInput().add(ic);
}
OutputClause oc = new TOutputClause();
dt.getOutput().add(oc);
decision.setExpression(dt);
definitions.getDrgElement().add(decision);
}
}
use of org.kie.dmn.model.v1_1.TDMNElementReference in project drools by kiegroup.
the class DecisionServiceConverter method parseElements.
@Override
protected void parseElements(HierarchicalStreamReader reader, UnmarshallingContext context, Object parent) {
while (reader.hasMoreChildren()) {
reader.moveDown();
Object object = null;
String nodeName = reader.getNodeName();
if (nodeName.equals(INPUT_DATA)) {
// Patch because the tag name inputData is used in both decision services and as a DRG Element
DMNElementReference ref = new TDMNElementReference();
ref.setHref(reader.getAttribute("href"));
object = ref;
} else {
// Default behaviour
object = readItem(reader, context, null);
}
if (object instanceof DMNModelInstrumentedBase) {
((KieDMNModelInstrumentedBase) object).setParent((KieDMNModelInstrumentedBase) parent);
((KieDMNModelInstrumentedBase) parent).addChildren((KieDMNModelInstrumentedBase) object);
}
reader.moveUp();
assignChildElement(parent, nodeName, object);
}
}
use of org.kie.dmn.model.v1_1.TDMNElementReference in project drools by kiegroup.
the class DecisionServiceConverter method parseElements.
@Override
protected void parseElements(HierarchicalStreamReader reader, UnmarshallingContext context, Object parent) {
while (reader.hasMoreChildren()) {
reader.moveDown();
Object object = null;
String nodeName = reader.getNodeName();
if (nodeName.equals(INPUT_DATA)) {
// Patch because the tag name inputData is used in both decision services and as a DRG Element
DMNElementReference ref = new TDMNElementReference();
ref.setHref(reader.getAttribute("href"));
object = ref;
} else {
// Default behaviour
object = readItem(reader, context, null);
}
if (object instanceof DMNModelInstrumentedBase) {
((KieDMNModelInstrumentedBase) object).setParent((KieDMNModelInstrumentedBase) parent);
((KieDMNModelInstrumentedBase) parent).addChildren((KieDMNModelInstrumentedBase) object);
}
reader.moveUp();
assignChildElement(parent, nodeName, object);
}
}
use of org.kie.dmn.model.v1_1.TDMNElementReference in project drools by kiegroup.
the class DecisionServiceConverter method parseElements.
@Override
protected void parseElements(HierarchicalStreamReader reader, UnmarshallingContext context, Object parent) {
while (reader.hasMoreChildren()) {
reader.moveDown();
Object object = null;
String nodeName = reader.getNodeName();
if (nodeName.equals(INPUT_DATA)) {
// Patch because the tag name inputData is used in both decision services and as a DRG Element
DMNElementReference ref = new TDMNElementReference();
ref.setHref(reader.getAttribute("href"));
object = ref;
} else {
// Default behaviour
object = readItem(reader, context, null);
}
if (object instanceof DMNModelInstrumentedBase) {
((KieDMNModelInstrumentedBase) object).setParent((KieDMNModelInstrumentedBase) parent);
((KieDMNModelInstrumentedBase) parent).addChildren((KieDMNModelInstrumentedBase) object);
}
reader.moveUp();
assignChildElement(parent, nodeName, object);
}
}
Aggregations