|
jBPM distribution 6.0.0.CR5 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.drools.core.impl.AbstractRuntime
org.jbpm.process.StatefulProcessSession
public class StatefulProcessSession
Field Summary | |
---|---|
protected Queue<org.drools.core.common.WorkingMemoryAction> |
actionQueue
|
Fields inherited from class org.drools.core.impl.AbstractRuntime |
---|
logger |
Constructor Summary | |
---|---|
StatefulProcessSession(org.kie.internal.KnowledgeBase kbase,
KieSessionConfiguration sessionConfiguration,
Environment environment)
|
Method Summary | ||
---|---|---|
void |
abortProcessInstance(long processInstanceId)
Aborts the process instance with the given id. |
|
void |
addEventListener(AgendaEventListener listener)
Add an event listener. |
|
void |
addEventListener(ProcessEventListener listener)
Add a process event listener. |
|
void |
addEventListener(WorkingMemoryEventListener listener)
Add an event listener. |
|
ProcessInstance |
createProcessInstance(String processId,
org.kie.internal.process.CorrelationKey correlationKey,
Map<String,Object> parameters)
|
|
ProcessInstance |
createProcessInstance(String processId,
Map<String,Object> parameters)
Creates a new process instance (but does not yet start it). |
|
void |
delete(FactHandle handle)
Retracts the fact for which the given FactHandle was assigned. |
|
void |
destroy()
Destroys session permanently. |
|
void |
dispose()
Releases all the current session resources, setting up the session for garbage collection. |
|
void |
endOperation()
|
|
|
execute(Command<T> command)
Execute the command and return a ExecutionResults for the results of the Command. |
|
void |
executeQueuedActions()
|
|
int |
fireAllRules()
Fire all Matches on the Agenda. |
|
int |
fireAllRules(AgendaFilter agendaFilter)
Fire all Matches on the Agenda |
|
int |
fireAllRules(AgendaFilter agendaFilter,
int i)
Fire all Matches on the Agenda |
|
int |
fireAllRules(int max)
Fire Matches on the Agenda up to the given maximum number of Matches, before returning the control to the application. |
|
void |
fireUntilHalt()
Keeps firing Matches until a halt is called. |
|
void |
fireUntilHalt(AgendaFilter agendaFilter)
Keeps firing Matches until a halt is called. |
|
Queue<org.drools.core.common.WorkingMemoryAction> |
getActionQueue()
|
|
Agenda |
getAgenda()
Returns a reference to this session's Agenda . |
|
Collection<AgendaEventListener> |
getAgendaEventListeners()
Returns all event listeners. |
|
Calendars |
getCalendars()
|
|
Map<String,Channel> |
getChannels()
|
|
EntryPoint |
getEntryPoint(String name)
Returns the WorkingMemoryEntryPoint instance associated with the given name. |
|
String |
getEntryPointId()
Returns the String Id of this entry point |
|
Collection<? extends EntryPoint> |
getEntryPoints()
Returns a collection of all available working memory entry points for this session. |
|
Environment |
getEnvironment()
|
|
long |
getFactCount()
Returns the total number of facts currently in this entry point |
|
FactHandle |
getFactHandle(Object object)
Returns the fact handle associated with the given object. |
|
|
getFactHandles()
Returns all FactHandle s from the current session. |
|
|
getFactHandles(ObjectFilter filter)
Returns all FactHandle s from the current session for which the facts are accepted by
the given filter. |
|
Object |
getGlobal(String identifier)
|
|
Globals |
getGlobals()
|
|
int |
getId()
|
|
org.kie.internal.KnowledgeBase |
getKieBase()
Returns the KieBase reference from which this stateful session was created. |
|
long |
getLastIdleTimestamp()
|
|
Object |
getObject(FactHandle factHandle)
Returns the object associated with the given FactHandle. |
|
Collection<Object> |
getObjects()
Returns all facts from the current session as a Collection. |
|
Collection<Object> |
getObjects(ObjectFilter filter)
Returns all facts from the current session that are accepted by the given ObjectFilter . |
|
Collection<ProcessEventListener> |
getProcessEventListeners()
Returns all event listeners. |
|
ProcessInstance |
getProcessInstance(org.kie.internal.process.CorrelationKey correlationKey)
|
|
ProcessInstance |
getProcessInstance(long processInstanceId)
Returns the process instance with the given id. |
|
ProcessInstance |
getProcessInstance(long processInstanceId,
boolean readonly)
Returns the process instance with the given id. |
|
Collection<ProcessInstance> |
getProcessInstances()
Returns a collection of currently active process instances. |
|
InternalProcessRuntime |
getProcessRuntime()
|
|
QueryResults |
getQueryResults(String query,
Object... arguments)
Retrieve the QueryResults of the specified query and arguments |
|
SessionClock |
getSessionClock()
Returns the session clock instance assigned to this session |
|
KieSessionConfiguration |
getSessionConfiguration()
|
|
org.drools.core.time.TimerService |
getTimerService()
|
|
Collection<WorkingMemoryEventListener> |
getWorkingMemoryEventListeners()
Returns all event listeners. |
|
WorkItemManager |
getWorkItemManager()
Returns the WorkItemManager related to this session. |
|
void |
halt()
Request the engine to stop firing rules. |
|
FactHandle |
insert(Object object)
Inserts a new fact into this entry point |
|
LiveQuery |
openLiveQuery(String query,
Object[] arguments,
ViewChangedEventListener listener)
|
|
void |
queueWorkingMemoryAction(org.drools.core.common.WorkingMemoryAction action)
|
|
void |
registerChannel(String name,
Channel channel)
|
|
void |
removeEventListener(AgendaEventListener listener)
Remove an event listener. |
|
void |
removeEventListener(ProcessEventListener listener)
Remove a process event listener. |
|
void |
removeEventListener(WorkingMemoryEventListener listener)
Remove an event listener. |
|
void |
retract(FactHandle handle)
Retracts the fact for which the given FactHandle was assigned. |
|
void |
setEndOperationListener(org.drools.core.common.EndOperationListener listener)
|
|
void |
setGlobal(String identifier,
Object object)
Sets a global value in this session |
|
void |
setId(int id)
|
|
void |
signalEvent(String type,
Object event)
Signals the engine that an event has occurred. |
|
void |
signalEvent(String type,
Object event,
long processInstanceId)
Signals the process instance that an event has occurred. |
|
void |
startOperation()
|
|
ProcessInstance |
startProcess(String processId)
Start a new process instance. |
|
ProcessInstance |
startProcess(String processId,
org.kie.internal.process.CorrelationKey correlationKey,
Map<String,Object> parameters)
|
|
ProcessInstance |
startProcess(String processId,
Map<String,Object> parameters)
Start a new process instance. |
|
ProcessInstance |
startProcessInstance(long processInstanceId)
Starts the given process instance (which was created by using createProcesInstance but not yet started). |
|
void |
unregisterChannel(String name)
|
|
void |
update(FactHandle handle,
Object object)
Updates the fact for which the given FactHandle was assigned with the new fact set as the second parameter in this method. |
Methods inherited from class org.drools.core.impl.AbstractRuntime |
---|
getLogger, setLogger |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Queue<org.drools.core.common.WorkingMemoryAction> actionQueue
Constructor Detail |
---|
public StatefulProcessSession(org.kie.internal.KnowledgeBase kbase, KieSessionConfiguration sessionConfiguration, Environment environment)
Method Detail |
---|
public void abortProcessInstance(long processInstanceId)
ProcessRuntime
IllegalArgumentException
.
abortProcessInstance
in interface ProcessRuntime
processInstanceId
- the id of the process instancepublic ProcessInstance getProcessInstance(long processInstanceId)
ProcessRuntime
null
.
getProcessInstance
in interface ProcessRuntime
processInstanceId
- the id of the process instance
null
if it cannot be foundpublic ProcessInstance getProcessInstance(long processInstanceId, boolean readonly)
ProcessRuntime
null
.
getProcessInstance
in interface ProcessRuntime
processInstanceId
- the id of the process instancereadonly
- if this is true and when using persistence, this process instance
will not be tracked and updated by the engine
null
if it cannot be foundpublic Collection<ProcessInstance> getProcessInstances()
ProcessRuntime
getProcessInstances
in interface ProcessRuntime
public void signalEvent(String type, Object event)
ProcessRuntime
signalEvent
in interface ProcessRuntime
type
- the type of eventevent
- the data associated with this eventpublic void signalEvent(String type, Object event, long processInstanceId)
ProcessRuntime
signalEvent
in interface ProcessRuntime
type
- the type of eventevent
- the data associated with this eventprocessInstanceId
- the id of the process instance that should be signaledpublic ProcessInstance startProcess(String processId)
ProcessRuntime
startProcess
in interface ProcessRuntime
processId
- The id of the process that should be started
ProcessInstance
that represents the instance of the process that was startedpublic ProcessInstance startProcess(String processId, Map<String,Object> parameters)
ProcessRuntime
startProcess
in interface ProcessRuntime
processId
- the id of the process that should be startedparameters
- the process variables that should be set when starting the process instance
ProcessInstance
that represents the instance of the process that was startedpublic ProcessInstance createProcessInstance(String processId, Map<String,Object> parameters)
ProcessRuntime
createProcessInstance
in interface ProcessRuntime
processId
- the id of the process that should be startedparameters
- the process variables that should be set when creating the process instance
ProcessInstance
that represents the instance of the process that was created (but not yet started)public ProcessInstance startProcessInstance(long processInstanceId)
ProcessRuntime
startProcessInstance
in interface ProcessRuntime
processInstanceId
- the id of the process instance that needs to be started
ProcessInstance
that represents the instance of the process that was startedpublic void addEventListener(ProcessEventListener listener)
ProcessEventManager
addEventListener
in interface ProcessEventManager
listener
- the listener to add.public Collection<ProcessEventListener> getProcessEventListeners()
ProcessEventManager
getProcessEventListeners
in interface ProcessEventManager
public void removeEventListener(ProcessEventListener listener)
ProcessEventManager
removeEventListener
in interface ProcessEventManager
listener
- the listener to removepublic org.kie.internal.KnowledgeBase getKieBase()
KieRuntime
getKieBase
in interface KieRuntime
getKieBase
in interface org.kie.internal.runtime.StatefulKnowledgeSession
public WorkItemManager getWorkItemManager()
ProcessRuntime
WorkItemManager
related to this session. This can be used to
register new WorkItemHandler
s or to complete (or abort) WorkItem
s.
getWorkItemManager
in interface ProcessRuntime
WorkItemManager
related to this sessionpublic Environment getEnvironment()
getEnvironment
in interface KieRuntime
public InternalProcessRuntime getProcessRuntime()
getProcessRuntime
in interface org.drools.core.common.InternalKnowledgeRuntime
public KieSessionConfiguration getSessionConfiguration()
getSessionConfiguration
in interface KieRuntime
public org.drools.core.time.TimerService getTimerService()
getTimerService
in interface org.drools.core.common.InternalKnowledgeRuntime
public void startOperation()
startOperation
in interface org.drools.core.common.InternalKnowledgeRuntime
public void endOperation()
endOperation
in interface org.drools.core.common.InternalKnowledgeRuntime
public void executeQueuedActions()
executeQueuedActions
in interface org.drools.core.common.InternalKnowledgeRuntime
public Queue<org.drools.core.common.WorkingMemoryAction> getActionQueue()
getActionQueue
in interface org.drools.core.common.InternalKnowledgeRuntime
public void queueWorkingMemoryAction(org.drools.core.common.WorkingMemoryAction action)
queueWorkingMemoryAction
in interface org.drools.core.common.InternalKnowledgeRuntime
public void dispose()
KieSession
dispose
in interface KieSession
public void setId(int id)
setId
in interface org.drools.core.common.InternalKnowledgeRuntime
public int getId()
getId
in interface KieSession
public void setEndOperationListener(org.drools.core.common.EndOperationListener listener)
setEndOperationListener
in interface org.drools.core.common.InternalKnowledgeRuntime
public int fireAllRules()
StatefulRuleSession
fireAllRules
in interface StatefulRuleSession
public int fireAllRules(int max)
StatefulRuleSession
fireAllRules()
again.
fireAllRules
in interface StatefulRuleSession
max
- the maximum number of rules that should be fired
public int fireAllRules(AgendaFilter agendaFilter)
StatefulRuleSession
fireAllRules
in interface StatefulRuleSession
agendaFilter
- filters the Matches that may fire
public int fireAllRules(AgendaFilter agendaFilter, int i)
StatefulRuleSession
fireAllRules
in interface StatefulRuleSession
agendaFilter
- filters the Matches that may firei
- the maximum number of rules that should be fired
public void fireUntilHalt()
StatefulRuleSession
fireUntilHalt
in interface StatefulRuleSession
public void fireUntilHalt(AgendaFilter agendaFilter)
StatefulRuleSession
fireUntilHalt
in interface StatefulRuleSession
agendaFilter
- filters the Matches that may firepublic <T> T execute(Command<T> command)
CommandExecutor
execute
in interface CommandExecutor
public Calendars getCalendars()
getCalendars
in interface KieRuntime
public Map<String,Channel> getChannels()
getChannels
in interface KieRuntime
public Object getGlobal(String identifier)
getGlobal
in interface KieRuntime
public Globals getGlobals()
getGlobals
in interface KieRuntime
public SessionClock getSessionClock()
KieRuntime
getSessionClock
in interface KieRuntime
public void registerChannel(String name, Channel channel)
registerChannel
in interface KieRuntime
public void setGlobal(String identifier, Object object)
KieRuntime
setGlobal
in interface KieRuntime
identifier
- the global identifierobject
- the value assigned to the global identifierpublic void unregisterChannel(String name)
unregisterChannel
in interface KieRuntime
public Agenda getAgenda()
RuleRuntime
Agenda
.
getAgenda
in interface RuleRuntime
public QueryResults getQueryResults(String query, Object... arguments)
RuleRuntime
getQueryResults
in interface RuleRuntime
query
- The name of the query.arguments
- The arguments used for the query
public EntryPoint getEntryPoint(String name)
RuleRuntime
getEntryPoint
in interface RuleRuntime
public Collection<? extends EntryPoint> getEntryPoints()
RuleRuntime
getEntryPoints
in interface RuleRuntime
public void halt()
RuleRuntime
Request the engine to stop firing rules. If the engine is currently firing a rule, it will finish executing this rule's consequence before stopping.
This method will not remove active Matches from the Agenda.
In case the application later wants to continue firing rules from the point where it stopped,
it should just call org.kie.api.runtime.StatefulKnowledgeSession.fireAllRules()
or
org.kie.api.runtime.StatefulKnowledgeSession.fireUntilHalt()
again.
halt
in interface RuleRuntime
public LiveQuery openLiveQuery(String query, Object[] arguments, ViewChangedEventListener listener)
openLiveQuery
in interface RuleRuntime
public String getEntryPointId()
EntryPoint
getEntryPointId
in interface EntryPoint
public long getFactCount()
EntryPoint
getFactCount
in interface EntryPoint
public FactHandle getFactHandle(Object object)
EntryPoint
getFactHandle
in interface EntryPoint
object
- the fact for which the fact handle will be returned.
KieBaseConfiguration
public <T extends FactHandle> Collection<T> getFactHandles()
EntryPoint
FactHandle
s from the current session.
getFactHandles
in interface EntryPoint
public <T extends FactHandle> Collection<T> getFactHandles(ObjectFilter filter)
EntryPoint
FactHandle
s from the current session for which the facts are accepted by
the given filter.
getFactHandles
in interface EntryPoint
filter
- the filter to be applied to the returned collection of FactHandle
s.
public Object getObject(FactHandle factHandle)
EntryPoint
getObject
in interface EntryPoint
public Collection<Object> getObjects()
EntryPoint
Returns all facts from the current session as a Collection.
This class is not a general-purpose Collection implementation! While this class implements the Collection interface, it intentionally violates Collection general contract, which mandates the use of the equals method when comparing objects.
Instead the approach used when comparing objects with the contains(Object) method is dependent on the WorkingMemory configuration, where it can be configured for Identity or for Equality.
getObjects
in interface EntryPoint
public Collection<Object> getObjects(ObjectFilter filter)
EntryPoint
ObjectFilter
.
getObjects
in interface EntryPoint
filter
- the filter to be applied to the returned collection of facts.
public FactHandle insert(Object object)
EntryPoint
insert
in interface EntryPoint
object
- the fact to be inserted
public void retract(FactHandle handle)
EntryPoint
retract
in interface EntryPoint
handle
- the handle whose fact is to be retracted.public void delete(FactHandle handle)
EntryPoint
delete
in interface EntryPoint
handle
- the handle whose fact is to be retracted.public void update(FactHandle handle, Object object)
EntryPoint
update
in interface EntryPoint
handle
- the FactHandle for the fact to be updated.object
- the new value for the fact being updated.public void addEventListener(WorkingMemoryEventListener listener)
WorkingMemoryEventManager
addEventListener
in interface WorkingMemoryEventManager
listener
- The listener to add.public void addEventListener(AgendaEventListener listener)
WorkingMemoryEventManager
addEventListener
in interface WorkingMemoryEventManager
listener
- The listener to add.public Collection<AgendaEventListener> getAgendaEventListeners()
WorkingMemoryEventManager
getAgendaEventListeners
in interface WorkingMemoryEventManager
public Collection<WorkingMemoryEventListener> getWorkingMemoryEventListeners()
WorkingMemoryEventManager
getWorkingMemoryEventListeners
in interface WorkingMemoryEventManager
public void removeEventListener(WorkingMemoryEventListener listener)
WorkingMemoryEventManager
removeEventListener
in interface WorkingMemoryEventManager
listener
- The listener to remove.public void removeEventListener(AgendaEventListener listener)
WorkingMemoryEventManager
removeEventListener
in interface WorkingMemoryEventManager
listener
- The listener to remove.public long getLastIdleTimestamp()
getLastIdleTimestamp
in interface org.drools.core.common.InternalKnowledgeRuntime
public ProcessInstance startProcess(String processId, org.kie.internal.process.CorrelationKey correlationKey, Map<String,Object> parameters)
startProcess
in interface org.kie.internal.process.CorrelationAwareProcessRuntime
public ProcessInstance createProcessInstance(String processId, org.kie.internal.process.CorrelationKey correlationKey, Map<String,Object> parameters)
createProcessInstance
in interface org.kie.internal.process.CorrelationAwareProcessRuntime
public ProcessInstance getProcessInstance(org.kie.internal.process.CorrelationKey correlationKey)
getProcessInstance
in interface org.kie.internal.process.CorrelationAwareProcessRuntime
public void destroy()
KieSession
destroy
in interface KieSession
|
jBPM distribution 6.0.0.CR5 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |