use of org.drools.core.reteoo.BaseTuple in project drools by kiegroup.
the class ProtobufOutputMarshaller method writeTuple.
public static Tuple writeTuple(MarshallerWriteContext context, Activation activation, boolean isDormient) {
org.drools.core.spi.Tuple tuple = activation.getTuple();
ProtobufMessages.Tuple.Builder _tb = ProtobufMessages.Tuple.newBuilder();
boolean serializeObjects = isDormient && hasNodeMemory((BaseTuple) activation);
if (tuple != null) {
// tuple can be null if this is a rule network evaluation activation, instead of terminal node left tuple.
for (org.drools.core.spi.Tuple entry = tuple.skipEmptyHandles(); entry != null; entry = entry.getParent()) {
InternalFactHandle handle = entry.getFactHandle();
_tb.addHandleId(handle.getId());
if (serializeObjects) {
ObjectMarshallingStrategy marshallingStrategy = context.getObjectMarshallingStrategyStore().getStrategyObject(handle.getObject());
Integer strategyIndex = context.getStrategyIndex(marshallingStrategy);
ProtobufMessages.SerializedObject.Builder _so = ProtobufMessages.SerializedObject.newBuilder();
_so.setObject(serializeObject(context, marshallingStrategy, handle.getObject()));
_so.setStrategyIndex(strategyIndex);
_tb.addObject(_so.build());
}
}
}
return _tb.build();
}
Aggregations