}
public static void readTruthMaintenanceSystem( MarshallerReaderContext context,
RuleData _session ) throws IOException {
TruthMaintenanceSystem tms = context.wm.getTruthMaintenanceSystem();
ProtobufMessages.TruthMaintenanceSystem _tms = _session.getTms();
for( ProtobufMessages.EqualityKey _key : _tms.getKeyList() ) {
InternalFactHandle handle = (InternalFactHandle) context.handles.get( _key.getHandleId() );
// ObjectTypeConf state is not marshalled, so it needs to be re-determined
ObjectTypeConf typeConf = context.wm.getObjectTypeConfigurationRegistry().getObjectTypeConf( ((NamedEntryPoint)handle.getEntryPoint()).getEntryPoint(),
handle.getObject() );
if (!typeConf.isTMSEnabled()) {
typeConf.enableTMS();
}
EqualityKey key = new EqualityKey( handle,
_key.getStatus() );
handle.setEqualityKey( key );
for( Integer factHandleId : _key.getOtherHandleList() ) {
handle = (InternalFactHandle) context.handles.get( factHandleId.intValue() );
key.addFactHandle( handle );
handle.setEqualityKey( key );
}
tms.put( key );
}
for( ProtobufMessages.Justification _justification : _tms.getJustificationList() ) {
InternalFactHandle handle = (InternalFactHandle) context.handles.get( _justification.getHandleId() );
for( ProtobufMessages.Activation _activation : _justification.getActivationList() ) {
Activation activation = (Activation) context.filter.getTuplesCache().get(
PersisterHelper.createActivationKey( _activation.getPackageName(),
_activation.getRuleName(),
_activation.getTuple() ) ).getObject();
PropagationContext pc = activation.getPropagationContext();
tms.addLogicalDependency( handle,
activation,
pc,
activation.getRule() );
}
}