use of org.kie.dmn.model.v1_1.DMNModelInstrumentedBase in project drools by kiegroup.
the class DMNModelInstrumentedBaseConverter method writeAttributes.
@Override
protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) {
DMNModelInstrumentedBase mib = (DMNModelInstrumentedBase) parent;
CustomStaxWriter staxWriter = ((CustomStaxWriter) writer.underlyingWriter());
for (Entry<String, String> kv : mib.getNsContext().entrySet()) {
try {
if (DMNModelInstrumentedBase.URI_DMN.equals(kv.getValue())) {
// skip as that is the default namespace xmlns<:prefix>=DMN is handled by the stax driver.
} else {
staxWriter.writeNamespace(kv.getKey(), kv.getValue());
}
} catch (Exception e) {
// TODO what to do?
e.printStackTrace();
}
}
for (Entry<QName, String> kv : mib.getAdditionalAttributes().entrySet()) {
staxWriter.addAttribute(kv.getKey().getPrefix() + ":" + kv.getKey().getLocalPart(), kv.getValue());
}
}
use of org.kie.dmn.model.v1_1.DMNModelInstrumentedBase 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 DMNElementReference();
ref.setHref(reader.getAttribute("href"));
object = ref;
} else {
// Default behaviour
object = readItem(reader, context, null);
}
if (object instanceof DMNModelInstrumentedBase) {
((DMNModelInstrumentedBase) object).setParent((DMNModelInstrumentedBase) parent);
((DMNModelInstrumentedBase) parent).addChildren((DMNModelInstrumentedBase) object);
}
reader.moveUp();
assignChildElement(parent, nodeName, object);
}
}
Aggregations