this.disconnected = disconnected;
}
public Collection<FactHandle> execute(Context context) {
StatefulKnowledgeSession ksession = ((KnowledgeCommandContext) context).getStatefulKnowledgesession();
WorkingMemoryEntryPoint ep = ksession.getWorkingMemoryEntryPoint(entryPoint);
Collection<FactHandle> disconnectedFactHandles = new ArrayList<FactHandle>();
if ( filter != null ) {
Collection<InternalFactHandle> factHandles = ep.getFactHandles( this.filter );
if(factHandles != null && disconnected){
for(InternalFactHandle factHandle: factHandles){
InternalFactHandle handle = factHandle.clone();
handle.disconnect();
disconnectedFactHandles.add(handle);
}
return disconnectedFactHandles;
}
else {
return ksession.getFactHandles( this.filter );
}
} else {
Collection<InternalFactHandle> factHandles = ep.getFactHandles( );
if(factHandles != null && disconnected){
for(InternalFactHandle factHandle: factHandles){
InternalFactHandle handle = factHandle.clone();
handle.disconnect();
disconnectedFactHandles.add(handle);