public void updateSink(final ObjectSink sink,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
// JBRULES-612: the cache MUST be invalidated when a new node type is added to the network, so iterate and reset all caches.
final ObjectHashMap memory = (ObjectHashMap) workingMemory.getNodeMemory( this );
Iterator it = memory.iterator();
final ObjectTypeNode node = (ObjectTypeNode) sink;
ObjectType newObjectType = node.getObjectType();
for ( ObjectEntry entry = (ObjectEntry) it.next(); entry != null; entry = (ObjectEntry) it.next() ) {
ObjectTypeConf objectTypeConf = (ObjectTypeConf) entry.getValue();
if ( newObjectType.isAssignableFrom( objectTypeConf.getConcreteObjectTypeNode().getObjectType() ) ) {
objectTypeConf.resetCache();
ObjectTypeNode sourceNode = objectTypeConf.getConcreteObjectTypeNode();
FactHashTable table = (FactHashTable) workingMemory.getNodeMemory( sourceNode );
Iterator factIter = table.iterator();
for ( FactEntry factEntry = (FactEntry) factIter.next(); factEntry != null; factEntry = (FactEntry) factIter.next() ) {
sink.assertObject( factEntry.getFactHandle(),
context,
workingMemory );
}
}