if ( handle.getEntryPoint() != this ) {
throw new IllegalArgumentException( "Invalid Entry Point. You updated the FactHandle on entry point '" + handle.getEntryPoint().getEntryPointId() + "' instead of '" + getEntryPointId() + "'" );
}
final ObjectTypeConf typeConf = this.typeConfReg.getObjectTypeConf( this.entryPoint,
object );
// only needed if we maintain tms, but either way we must get it before we do the update
int status = -1;
if ( typeConf.isTMSEnabled() ) {
status = handle.getEqualityKey().getStatus();
}
if ( handle.getId() == -1 || object == null || (handle.isEvent() && ((EventFactHandle) handle).isExpired()) ) {
// the handle is invalid, most likely already retracted, so return and we cannot assert a null object
return handle;
}
if ( activation != null ) {
// release resources so that they can be GC'ed
activation.getPropagationContext().releaseResources();
}
if ( originalObject != object || !AssertBehaviour.IDENTITY.equals( this.ruleBase.getConfiguration().getAssertBehaviour() ) ) {
this.objectStore.removeHandle( handle );
// set anyway, so that it updates the hashCodes
handle.setObject( object );
this.objectStore.addHandle( handle,
object );
}
this.handleFactory.increaseFactHandleRecency( handle );
Rule rule = activation == null ? null : activation.getRule();
final PropagationContext propagationContext = new PropagationContextImpl( this.wm.getNextPropagationIdCounter(),
PropagationContext.MODIFICATION,
rule,
(activation == null) ? null : activation.getTuple(),
handle,
entryPoint,
mask,
modifiedClass,
null );
if ( typeConf.isTMSEnabled() ) {
EqualityKey newKey = tms.get( object );
EqualityKey oldKey = handle.getEqualityKey();
if ( newKey == null ) {
if ( oldKey.getStatus() == EqualityKey.JUSTIFIED ) {
// new target key is JUSTFIED, updates are always STATED