}
break;
}
case NodeTypeEnums.AccumulateNode: {
// accumulate nodes generate new facts on-demand and need special procedures when de-serializing from persistent storage
AccumulateMemory memory = (AccumulateMemory) context.wm.getNodeMemory( (BetaNode) sink );
memory.betaMemory.getLeftTupleMemory().add( parentLeftTuple );
AccumulateContext accctx = new AccumulateContext();
parentLeftTuple.setObject( accctx );
// first we de-serialize the generated fact handle
InternalFactHandle handle = readFactHandle( context );
accctx.result = new RightTuple( handle,
(RightTupleSink) sink );
// then we de-serialize the associated accumulation context
accctx.context = (Serializable[]) stream.readObject();
// then we de-serialize the boolean propagated flag
accctx.propagated = stream.readBoolean();
// then we de-serialize all the propagated tuples
short head = -1;
while (( head = stream.readShort() ) != PersisterEnums.END) {
switch (head) {
case PersisterEnums.RIGHT_TUPLE: {
int factHandleId = stream.readInt();
RightTupleKey key = new RightTupleKey( factHandleId,
sink );
RightTuple rightTuple = context.rightTuples.get( key );
// just wiring up the match record
sink.createLeftTuple( parentLeftTuple,
rightTuple,
null,
null,
sink,
true );
break;
}
case PersisterEnums.LEFT_TUPLE: {
int sinkId = stream.readInt();
LeftTupleSink childSink = (LeftTupleSink) sinks.get( sinkId );
LeftTuple childLeftTuple = new LeftTupleImpl( parentLeftTuple,
accctx.result,
childSink,
true );
readLeftTuple( childLeftTuple,
context );
break;
}
default: {
throw new RuntimeDroolsException(
"Marshalling error. This is a bug. Please contact the development team." );
}
}
}
break;
}
case NodeTypeEnums.RightInputAdaterNode: {
// RIANs generate new fact handles on-demand to wrap tuples and need special procedures when de-serializing from persistent storage
ObjectHashMap memory = (ObjectHashMap) context.wm.getNodeMemory( (MemoryFactory) sink );
// create fact handle
int id = stream.readInt();
long recency = stream.readLong();
InternalFactHandle handle = new DefaultFactHandle(
id,
parentLeftTuple,
recency,
context.wm.getEntryPoints().get( EntryPoint.DEFAULT.getEntryPointId() ) );
memory.put( parentLeftTuple,
handle );
readRightTuples( handle,
context );