Package org.drools.core
Interface WorkingMemory
- All Superinterfaces:
EntryPoint,KieBaseEventManager,ReteEvaluator,ValueResolver,WorkingMemoryEntryPoint,WorkingMemoryEventManager
- All Known Subinterfaces:
InternalWorkingMemory,InternalWorkingMemoryActions
public interface WorkingMemory
extends ReteEvaluator, WorkingMemoryEventManager, WorkingMemoryEntryPoint
A knowledge session for a
RuleBase.
While this object can be serialised out, it cannot be serialised in. This is because
the RuleBase reference is transient. Please see the RuleBase interface for serializing
in WorkingMemories from an InputStream.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.drools.core.common.ReteEvaluator
ReteEvaluator.InternalOperationType -
Method Summary
Modifier and TypeMethodDescriptionvoidclearActivationGroup(String group) Clears the Activation Group, cancellings all its ActivationsvoidClear the Agenda.voidclearAgendaGroup(String group) Clear the Agenda Group, cancelling all its Activations.voidclearRuleFlowGroup(String group) Clears the RuleFlow group, cancelling all its ActivationsintFire all items on the agenda until empty.intfireAllRules(int fireLimit) Fire all items on the agenda until empty or at most 'fireLimit' rules have firedintfireAllRules(AgendaFilter agendaFilter) Fire all items on the agenda until empty, using the given AgendaFilerintfireAllRules(AgendaFilter agendaFilter, int fireLimit) Fire all items on the agenda using the given AgendaFiler until empty or at most 'fireLimit' rules have firedReturns the Agenda for this WorkingMemory.Returns the process instance with the given id.getProcessInstance(String id, boolean readOnly) Returns the list of process instances of this working memory.getQueryResults(String query, Object... arguments) Retrieve the QueryResults of the specified query and argumentsvoidhalt()Stops rule firing after the current rule finishes executingReturns an Iterator for the FactHandles in the Working Memory.iterateFactHandles(ObjectFilter filter) Returns an Iterator for the Objects in the Working Memory.Iterator<?>Returns an Iterator for the Objects in the Working Memory.Iterator<?>iterateObjects(ObjectFilter filter) Returns an Iterator for the Objects in the Working Memory.voidSet the focus to the specified AgendaGroupvoidSet a specific instance as a global in this working memory.voidsetGlobalResolver(GlobalResolver globalResolver) Sets the GlobalResolver instance to be used when resolving globals, replaces the current GlobalResolver.startProcess(String processId) Starts a new process instance for the process with the given id.startProcess(String processId, Map<String, Object> parameters) Starts a new process instance for the process with the given id.Methods inherited from interface org.kie.api.runtime.rule.EntryPoint
delete, delete, getEntryPointId, getFactCount, getFactHandle, getFactHandles, getFactHandles, getInstancesOf, getObject, getObjects, getObjects, getSingleInstanceOf, insert, retract, update, updateMethods inherited from interface org.kie.api.event.kiebase.KieBaseEventManager
addEventListener, getKieBaseEventListeners, removeEventListenerMethods inherited from interface org.drools.core.common.ReteEvaluator
addPropagation, createFactHandle, createKnowledgeHelper, dispose, enableTMS, endOperation, getActivationsManager, getAgendaEventSupport, getCalendars, getDefaultEntryPoint, getDefaultEntryPointId, getEntryPoint, getEntryPoints, getFactHandle, getFactHandleFactory, getGlobal, getIdentifier, getKnowledgeBase, getNextPropagationIdCounter, getNodeMemories, getNodeMemory, getRuleEventSupport, getRuleRuntimeEventSupport, getRuleSessionConfiguration, getSessionClock, getSessionConfiguration, getTimerJobInstances, getTimerService, getWorkingMemoryActionListener, insert, isSequential, isThreadSafe, isTMSEnabled, onWorkingMemoryAction, setWorkingMemoryActionListener, startOperationMethods inherited from interface org.drools.base.base.ValueResolver
getCurrentTime, getGlobalResolver, getRuleBaseMethods inherited from interface org.drools.core.WorkingMemoryEntryPoint
delete, delete, dispose, getEntryPoint, getEntryPointNode, getHandleFactory, getKnowledgeBase, getObjectStore, getObjectTypeConfigurationRegistry, getReteEvaluator, getRuleUnit, insert, reset, setRuleUnit, updateMethods inherited from interface org.drools.core.WorkingMemoryEventManager
addEventListener, addEventListener, getAgendaEventListeners, getRuleRuntimeEventListeners, removeEventListener, removeEventListener
-
Method Details
-
getAgenda
Agenda getAgenda()Returns the Agenda for this WorkingMemory. While the WorkingMemory interface is considered public, the Agenda interface is more subject to change.- Returns:
- the Agenda
-
setGlobal
Set a specific instance as a global in this working memory. Null values will return doing nothing. The global identifier and its type must be declared in the drl.- Specified by:
setGlobalin interfaceReteEvaluator- Parameters:
identifier- the identifier under which to populate the datavalue- the global value, cannot be null
-
getEnvironment
Environment getEnvironment() -
setGlobalResolver
Sets the GlobalResolver instance to be used when resolving globals, replaces the current GlobalResolver. Typcicaly a delegating GlobalResolver is created that first gets a reference to the current GlobalResolver, for delegating- Parameters:
globalResolver-
-
fireAllRules
int fireAllRules()Fire all items on the agenda until empty.- Specified by:
fireAllRulesin interfaceReteEvaluator
-
fireAllRules
Fire all items on the agenda until empty, using the given AgendaFiler- Specified by:
fireAllRulesin interfaceReteEvaluator
-
fireAllRules
int fireAllRules(int fireLimit) Fire all items on the agenda until empty or at most 'fireLimit' rules have fired- Specified by:
fireAllRulesin interfaceReteEvaluator
-
fireAllRules
Fire all items on the agenda using the given AgendaFiler until empty or at most 'fireLimit' rules have fired- Specified by:
fireAllRulesin interfaceReteEvaluator
-
iterateObjects
Iterator<?> iterateObjects()Returns an Iterator for the Objects in the Working Memory. This Iterator is not thread safe. This means that any working memory actions during iteration may invalidate the iterator.- Returns:
- the Iterator
-
iterateObjects
Returns an Iterator for the Objects in the Working Memory. This Iterator will filter out any objects that the ObjectFilter does not accept. This Iterator is not thread safe. This means that any working memory actions during iteration may invalidate the iterator.- Parameters:
filter-- Returns:
- the Iterator
-
iterateFactHandles
Iterator<InternalFactHandle> iterateFactHandles()Returns an Iterator for the FactHandles in the Working Memory. This Iterator is not thread safe. This means that any working memory actions during iteration may invalidate the iterator.- Returns:
- the Iterator
-
iterateFactHandles
Returns an Iterator for the Objects in the Working Memory. This Iterator will filter out any objects that the ObjectFilter does not accept. This Iterator is not thread safe. This means that any working memory actions during iteration may invalidate the iterator.- Parameters:
filter-- Returns:
- the Iterator
-
setFocus
Set the focus to the specified AgendaGroup- Parameters:
focus-
-
getQueryResults
Retrieve the QueryResults of the specified query and arguments- Specified by:
getQueryResultsin interfaceReteEvaluator- Parameters:
query- The name of the query.arguments- The arguments used for the query- Returns:
- The QueryResults of the specified query. If no results match the query it is empty.
- Throws:
IllegalArgumentException- if no query named "query" is found in the rulebase
-
clearAgenda
void clearAgenda()Clear the Agenda. Iterates over each AgendaGroup cancalling all Activations. -
clearAgendaGroup
Clear the Agenda Group, cancelling all its Activations. -
clearActivationGroup
Clears the Activation Group, cancellings all its Activations- Parameters:
group-
-
clearRuleFlowGroup
Clears the RuleFlow group, cancelling all its Activations- Parameters:
group-
-
startProcess
Starts a new process instance for the process with the given id. -
startProcess
Starts a new process instance for the process with the given id. -
getProcessInstances
Collection<ProcessInstance> getProcessInstances()Returns the list of process instances of this working memory. This list is unmodifiable.- Returns:
- the list of process instances
-
getProcessInstance
Returns the process instance with the given id.- Returns:
- the process instance with the given id
-
getProcessInstance
-
getWorkItemManager
WorkItemManager getWorkItemManager() -
halt
void halt()Stops rule firing after the current rule finishes executing
-