}
public void marshal(Object object,
HierarchicalStreamWriter writer,
MarshallingContext context) {
ExecutionResults result = (ExecutionResults) object;
writer.startNode( "results" );
if ( !result.getIdentifiers().isEmpty() ) {
for ( String identifier : result.getIdentifiers() ) {
writer.startNode( "result" );
writer.startNode( "identifier" );
writer.setValue( identifier );
writer.endNode();
writer.startNode( "value" );
Object value = result.getValue( identifier );
if ( value instanceof org.kie.runtime.rule.QueryResults ) {
String name = mapper().serializedClass(FlatQueryResults.class);
ExtendedHierarchicalStreamWriterHelper.startNode(writer, name, FlatQueryResults.class);
context.convertAnother(value);
writer.endNode();
} else {
writeItem( value,
context,
writer );
}
writer.endNode();
writer.endNode();
}
}
for ( String identifier : ((ExecutionResultImpl) result).getFactHandles().keySet() ) {
Object handle = result.getFactHandle( identifier );
if ( handle instanceof FactHandle ) {
writer.startNode( "fact-handle" );
writer.startNode( "identifier" );
writer.setValue( identifier );