Search in sources :

Example 1 with OpenQueryViewChangedEventListenerAdapter

use of org.drools.core.runtime.rule.impl.OpenQueryViewChangedEventListenerAdapter in project drools by kiegroup.

the class StatefulKnowledgeSessionImpl method openLiveQuery.

public LiveQuery openLiveQuery(final String query, final Object[] arguments, final ViewChangedEventListener listener) {
    try {
        startOperation();
        this.lock.lock();
        this.kBase.executeQueuedActions();
        agenda.executeFlush();
        DroolsQuery queryObject = new DroolsQuery(query, arguments, new OpenQueryViewChangedEventListenerAdapter(listener), true, null, null, null, null, null);
        InternalFactHandle handle = this.handleFactory.newFactHandle(queryObject, null, this, this);
        final PropagationContext pCtx = pctxFactory.createPropagationContext(getNextPropagationIdCounter(), PropagationContext.Type.INSERTION, null, null, handle, getEntryPoint());
        evalQuery(queryObject.getName(), queryObject, handle, pCtx, false);
        return new LiveQueryImpl(this, handle);
    } finally {
        this.lock.unlock();
        endOperation();
    }
}
Also used : OpenQueryViewChangedEventListenerAdapter(org.drools.core.runtime.rule.impl.OpenQueryViewChangedEventListenerAdapter) PropagationContext(org.drools.core.spi.PropagationContext) InternalFactHandle(org.drools.core.common.InternalFactHandle) LiveQueryImpl(org.drools.core.runtime.rule.impl.LiveQueryImpl) DroolsQuery(org.drools.core.base.DroolsQuery)

Aggregations

DroolsQuery (org.drools.core.base.DroolsQuery)1 InternalFactHandle (org.drools.core.common.InternalFactHandle)1 LiveQueryImpl (org.drools.core.runtime.rule.impl.LiveQueryImpl)1 OpenQueryViewChangedEventListenerAdapter (org.drools.core.runtime.rule.impl.OpenQueryViewChangedEventListenerAdapter)1 PropagationContext (org.drools.core.spi.PropagationContext)1