use of org.kie.dmn.model.v1_1.Context in project drools by kiegroup.
the class DMNBaseConverter method unmarshal.
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
DMNModelInstrumentedBase obj = createModelObject();
assignAttributes(reader, obj);
parseElements(reader, context, obj);
return obj;
}
use of org.kie.dmn.model.v1_1.Context in project drools by kiegroup.
the class DMNElementConverter method writeChildren.
@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
super.writeChildren(writer, context, parent);
DMNElement e = (DMNElement) parent;
if (e.getDescription() != null) {
writeChildrenNodeAsValue(writer, context, e.getDescription(), DESCRIPTION);
}
if (e.getExtensionElements() != null) {
writeChildrenNode(writer, context, e.getExtensionElements(), EXTENSION_ELEMENTS);
}
}
use of org.kie.dmn.model.v1_1.Context in project drools by kiegroup.
the class DMNListConverter method writeChildren.
@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
super.writeChildren(writer, context, parent);
List list = (List) parent;
for (Expression e : list.getExpression()) {
writeChildrenNode(writer, context, e, MarshallingUtils.defineExpressionNodeName(e));
}
}
use of org.kie.dmn.model.v1_1.Context in project drools by kiegroup.
the class ExtensionElementsConverter method unmarshal.
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
DMNModelInstrumentedBase obj = createModelObject();
assignAttributes(reader, obj);
if (extensionRegisters.size() == 0) {
while (reader.hasMoreChildren()) {
reader.moveDown();
String nodeName = reader.getNodeName();
// skipping nodeName
reader.moveUp();
}
} else {
// do as default behavior, but in case cannot unmarshall an extension element child, just skip it.
while (reader.hasMoreChildren()) {
reader.moveDown();
String nodeName = reader.getNodeName();
try {
Object object = readItem(reader, context, null);
if (object instanceof DMNModelInstrumentedBase) {
((DMNModelInstrumentedBase) object).setParent(obj);
((DMNModelInstrumentedBase) obj).addChildren((DMNModelInstrumentedBase) object);
}
assignChildElement(obj, nodeName, object);
} catch (CannotResolveClassException e) {
// do nothing; I tried to convert the extension element child with the converters, but no converter is registered for this child.
}
reader.moveUp();
}
}
return obj;
}
use of org.kie.dmn.model.v1_1.Context in project drools by kiegroup.
the class FunctionDefinitionConverter method writeChildren.
@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
super.writeChildren(writer, context, parent);
FunctionDefinition fd = (FunctionDefinition) parent;
for (InformationItem fparam : fd.getFormalParameter()) {
writeChildrenNode(writer, context, fparam, FORMAL_PARAMETER);
}
if (fd.getExpression() != null)
writeChildrenNode(writer, context, fd.getExpression(), MarshallingUtils.defineExpressionNodeName(fd.getExpression()));
}
Aggregations