Package org.drools.core.common
Interface InternalAgenda
-
- All Superinterfaces:
org.kie.api.runtime.rule.Agenda
- All Known Implementing Classes:
CompositeDefaultAgenda
,DefaultAgenda
,PartitionedDefaultAgenda
public interface InternalAgenda extends org.kie.api.runtime.rule.Agenda
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
activate()
void
activateRuleFlowGroup(String name)
Activates theRuleFlowGroup
with the given name.void
activateRuleFlowGroup(String name, long processInstanceId, String nodeInstanceId)
Activates theRuleFlowGroup
with the given name.void
addAgendaGroupOnStack(AgendaGroup agendaGroup)
void
addEagerRuleAgendaItem(RuleAgendaItem item)
void
addItemToActivationGroup(AgendaItem item)
void
addPropagation(PropagationEntry propagationEntry)
void
addQueryAgendaItem(RuleAgendaItem item)
int
agendaSize()
Iterates all the modules in the focus stack returning the total number ofActivation
svoid
cancelActivation(Activation activation)
void
clearAndCancel()
Clears all Activations from the Agendavoid
clearAndCancelActivationGroup(String name)
Clears all Activations from an Activation-Group.void
clearAndCancelActivationGroup(InternalActivationGroup activationGroup)
Clears all Activations from an Activation Group.void
clearAndCancelAgendaGroup(String name)
Clears all Activations from an Agenda Group.void
clearAndCancelRuleFlowGroup(String name)
AgendaItem
createAgendaItem(RuleTerminalNodeLeftTuple rtnLeftTuple, int salience, PropagationContext context, RuleAgendaItem ruleAgendaItem, InternalAgendaGroup agendaGroup)
RuleAgendaItem
createRuleAgendaItem(int salience, PathMemory rs, TerminalNode rtn)
void
deactivate()
void
deactivateRuleFlowGroup(String name)
Deactivates theRuleFlowGroup
with the given name.boolean
dispose(InternalWorkingMemory wm)
void
evaluateEagerList()
void
executeFlush()
void
executeTask(ExecutableEntry executable)
int
fireAllRules(org.kie.api.runtime.rule.AgendaFilter agendaFilter, int fireLimit)
Fires all activations currently in agenda that match the given agendaFilter until the fireLimit is reached or no more activations exist.int
fireNextItem(org.kie.api.runtime.rule.AgendaFilter filter, int fireCount, int fireLimit)
void
fireUntilHalt()
Keeps firing activations until a halt is called.void
fireUntilHalt(org.kie.api.runtime.rule.AgendaFilter agendaFilter)
Keeps firing activations until a halt is called.void
flushPropagations()
int
focusStackSize()
Iterates all theAgendGroup
s in the focus stack returning the total number of
Activation
sIterator<PropagationEntry>
getActionsIterator()
InternalActivationGroup
getActivationGroup(String name)
Map<String,InternalActivationGroup>
getActivationGroupsMap()
Activation[]
getActivations()
ActivationsFilter
getActivationsFilter()
Returns the current activations filter or null if none is setAgendaGroup
getAgendaGroup(String name)
AgendaGroup
getAgendaGroup(String name, InternalKnowledgeBase kBase)
AgendaGroup[]
getAgendaGroups()
Map<String,InternalAgendaGroup>
getAgendaGroupsMap()
String
getFocusName()
Returns the name of the agenda group that currently has the focusCollection<String>
getGroupsName()
KnowledgeHelper
getKnowledgeHelper()
InternalAgendaGroup
getNextFocus()
default PropagationList
getPropagationList()
RuleFlowGroup
getRuleFlowGroup(String name)
InternalWorkingMemory
getWorkingMemory()
Returns the WorkignMemory for this Agendavoid
halt()
Stop agenda from firing any other rule.void
handleException(InternalWorkingMemory wm, Activation activation, Exception e)
boolean
hasPendingPropagations()
void
insertAndStageActivation(AgendaItem activation)
boolean
isAlive()
boolean
isDeclarativeAgenda()
boolean
isFiring()
boolean
isParallelAgenda()
boolean
isRuleActiveInRuleFlowGroup(String ruleflowGroupName, String ruleName, long processInstanceId)
boolean
isRuleInstanceAgendaItem(String ruleflowGroupName, String ruleName, long processInstanceId)
Returns true if there is at least one activation of the given rule name in the given ruleflow group namevoid
modifyActivation(AgendaItem activation, boolean previouslyActive)
Adds the activation to the agenda.void
notifyWaitOnRest()
RuleAgendaItem
peekNextRule()
void
putOnAgendaGroupsMap(String name, InternalAgendaGroup group)
void
registerExpiration(PropagationContext expirationContext)
void
removeAgendaGroup(String name)
void
removeEagerRuleAgendaItem(RuleAgendaItem item)
void
removeQueryAgendaItem(RuleAgendaItem item)
void
reset()
void
setActivationsFilter(ActivationsFilter filter)
Sets a filter that prevents activations from being added to the agenda.void
setFocus(String name)
Sets the Agenda's focus to the specified AgendaGroupboolean
setFocus(AgendaGroup agendaGroup)
void
setWorkingMemory(InternalWorkingMemory workingMemory)
int
sizeOfRuleFlowGroup(String s)
void
stageLeftTuple(RuleAgendaItem ruleAgendaItem, AgendaItem justified)
boolean
tryDeactivate()
-
-
-
Method Detail
-
getWorkingMemory
InternalWorkingMemory getWorkingMemory()
Returns the WorkignMemory for this Agenda- Returns:
- The WorkingMemory
-
setFocus
void setFocus(String name)
Sets the Agenda's focus to the specified AgendaGroup
-
activateRuleFlowGroup
void activateRuleFlowGroup(String name)
Activates theRuleFlowGroup
with the given name. All activations in the givenRuleFlowGroup
are added to the agenda. As long as theRuleFlowGroup
remains active, its activations are automatically added to the agenda.
-
activateRuleFlowGroup
void activateRuleFlowGroup(String name, long processInstanceId, String nodeInstanceId)
Activates theRuleFlowGroup
with the given name. All activations in the givenRuleFlowGroup
are added to the agenda. As long as theRuleFlowGroup
remains active, its activations are automatically added to the agenda. The given processInstanceId and nodeInstanceId define the process context in which thisRuleFlowGroup
is used.
-
deactivateRuleFlowGroup
void deactivateRuleFlowGroup(String name)
Deactivates theRuleFlowGroup
with the given name. All activations in the givenRuleFlowGroup
are removed from the agenda. As long as theRuleFlowGroup
remains deactive, its activations are not added to the agenda
-
getAgendaGroups
AgendaGroup[] getAgendaGroups()
-
focusStackSize
int focusStackSize()
Iterates all theAgendGroup
s in the focus stack returning the total number of
Activation
s- Returns:
- total number of
Activation
s on the focus stack
-
agendaSize
int agendaSize()
Iterates all the modules in the focus stack returning the total number ofActivation
s- Returns:
- total number of activations on the focus stack
-
getActivations
Activation[] getActivations()
-
clearAndCancel
void clearAndCancel()
Clears all Activations from the Agenda
-
clearAndCancelAgendaGroup
void clearAndCancelAgendaGroup(String name)
Clears all Activations from an Agenda Group. Any Activations that are also in an Xor Group are removed the the Xor Group.
-
clearAndCancelActivationGroup
void clearAndCancelActivationGroup(String name)
Clears all Activations from an Activation-Group. Any Activations that are also in an Agenda Group are removed from the Agenda Group.
-
clearAndCancelActivationGroup
void clearAndCancelActivationGroup(InternalActivationGroup activationGroup)
Clears all Activations from an Activation Group. Any Activations that are also in an Agenda Group are removed from the Agenda Group.
-
clearAndCancelRuleFlowGroup
void clearAndCancelRuleFlowGroup(String name)
-
getFocusName
String getFocusName()
Returns the name of the agenda group that currently has the focus
-
fireNextItem
int fireNextItem(org.kie.api.runtime.rule.AgendaFilter filter, int fireCount, int fireLimit)
-
createAgendaItem
AgendaItem createAgendaItem(RuleTerminalNodeLeftTuple rtnLeftTuple, int salience, PropagationContext context, RuleAgendaItem ruleAgendaItem, InternalAgendaGroup agendaGroup)
-
cancelActivation
void cancelActivation(Activation activation)
-
modifyActivation
void modifyActivation(AgendaItem activation, boolean previouslyActive)
Adds the activation to the agenda. Depending on the mode the agenda is running, the activation may be added to the agenda priority queue (synchronously or asynchronously) or be executed immediately.
-
isDeclarativeAgenda
boolean isDeclarativeAgenda()
-
isRuleInstanceAgendaItem
boolean isRuleInstanceAgendaItem(String ruleflowGroupName, String ruleName, long processInstanceId)
Returns true if there is at least one activation of the given rule name in the given ruleflow group name
-
setWorkingMemory
void setWorkingMemory(InternalWorkingMemory workingMemory)
-
fireAllRules
int fireAllRules(org.kie.api.runtime.rule.AgendaFilter agendaFilter, int fireLimit)
Fires all activations currently in agenda that match the given agendaFilter until the fireLimit is reached or no more activations exist.- Parameters:
agendaFilter
- the filter on which activations may fire.fireLimit
- the maximum number of activations that may fire. If -1, then it will fire until no more activations exist.- Returns:
- the number of rules that were actually fired
-
halt
void halt()
Stop agenda from firing any other rule. It will finish the current rule execution though.
-
fireUntilHalt
void fireUntilHalt()
Keeps firing activations until a halt is called. If in a given moment, there is no activation to fire, it will wait for an activation to be added to an active agenda group or rule flow group.
-
fireUntilHalt
void fireUntilHalt(org.kie.api.runtime.rule.AgendaFilter agendaFilter)
Keeps firing activations until a halt is called. If in a given moment, there is no activation to fire, it will wait for an activation to be added to an active agenda group or rule flow group.- Parameters:
agendaFilter
- filters the activations that may fire
-
dispose
boolean dispose(InternalWorkingMemory wm)
-
isAlive
boolean isAlive()
-
reset
void reset()
-
getAgendaGroup
AgendaGroup getAgendaGroup(String name)
- Specified by:
getAgendaGroup
in interfaceorg.kie.api.runtime.rule.Agenda
-
removeAgendaGroup
void removeAgendaGroup(String name)
-
getAgendaGroup
AgendaGroup getAgendaGroup(String name, InternalKnowledgeBase kBase)
-
getActivationGroup
InternalActivationGroup getActivationGroup(String name)
- Specified by:
getActivationGroup
in interfaceorg.kie.api.runtime.rule.Agenda
-
getRuleFlowGroup
RuleFlowGroup getRuleFlowGroup(String name)
- Specified by:
getRuleFlowGroup
in interfaceorg.kie.api.runtime.rule.Agenda
-
setActivationsFilter
void setActivationsFilter(ActivationsFilter filter)
Sets a filter that prevents activations from being added to the agenda.
-
getActivationsFilter
ActivationsFilter getActivationsFilter()
Returns the current activations filter or null if none is set
-
createRuleAgendaItem
RuleAgendaItem createRuleAgendaItem(int salience, PathMemory rs, TerminalNode rtn)
-
peekNextRule
RuleAgendaItem peekNextRule()
-
isFiring
boolean isFiring()
-
executeTask
void executeTask(ExecutableEntry executable)
-
executeFlush
void executeFlush()
-
activate
void activate()
-
deactivate
void deactivate()
-
tryDeactivate
boolean tryDeactivate()
-
insertAndStageActivation
void insertAndStageActivation(AgendaItem activation)
-
addEagerRuleAgendaItem
void addEagerRuleAgendaItem(RuleAgendaItem item)
-
removeEagerRuleAgendaItem
void removeEagerRuleAgendaItem(RuleAgendaItem item)
-
addQueryAgendaItem
void addQueryAgendaItem(RuleAgendaItem item)
-
removeQueryAgendaItem
void removeQueryAgendaItem(RuleAgendaItem item)
-
setFocus
boolean setFocus(AgendaGroup agendaGroup)
-
stageLeftTuple
void stageLeftTuple(RuleAgendaItem ruleAgendaItem, AgendaItem justified)
-
getAgendaGroupsMap
Map<String,InternalAgendaGroup> getAgendaGroupsMap()
-
putOnAgendaGroupsMap
void putOnAgendaGroupsMap(String name, InternalAgendaGroup group)
-
addAgendaGroupOnStack
void addAgendaGroupOnStack(AgendaGroup agendaGroup)
-
evaluateEagerList
void evaluateEagerList()
-
getActivationGroupsMap
Map<String,InternalActivationGroup> getActivationGroupsMap()
-
getNextFocus
InternalAgendaGroup getNextFocus()
-
getGroupsName
Collection<String> getGroupsName()
-
sizeOfRuleFlowGroup
int sizeOfRuleFlowGroup(String s)
-
addItemToActivationGroup
void addItemToActivationGroup(AgendaItem item)
-
isRuleActiveInRuleFlowGroup
boolean isRuleActiveInRuleFlowGroup(String ruleflowGroupName, String ruleName, long processInstanceId)
-
registerExpiration
void registerExpiration(PropagationContext expirationContext)
-
addPropagation
void addPropagation(PropagationEntry propagationEntry)
-
flushPropagations
void flushPropagations()
-
notifyWaitOnRest
void notifyWaitOnRest()
-
getActionsIterator
Iterator<PropagationEntry> getActionsIterator()
-
hasPendingPropagations
boolean hasPendingPropagations()
-
handleException
void handleException(InternalWorkingMemory wm, Activation activation, Exception e)
-
isParallelAgenda
boolean isParallelAgenda()
-
getKnowledgeHelper
KnowledgeHelper getKnowledgeHelper()
-
getPropagationList
default PropagationList getPropagationList()
-
-