Class ProcessEvaluator
java.lang.Object
com.aquima.interactions.process.impl.ProcessEvaluator
- All Implemented Interfaces:
IProcessEvaluator
This class is responsible for evaluating a process based on the current state, and determining the task that should
be scheduled.
- Since:
- 7.1
- Author:
- O. Kerpershoek
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ProcessEvaluator
(ProcessEngine engine, ProcessCase processCase, IUserData userData) protected
ProcessEvaluator
(ProcessEngine engine, IProcessCase processCase, IUserData userData, boolean caseUnlocked) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
continueFromNode
(ITaskModel task, String exitState, boolean caseDataChanged) This method will assume the task as completed, and continue the process from that point.void
This method may be invoked to force the process to be evaluated after a change in the case data.void
continueWithEvent
(IMessageEvent messageEvent) This method will check if any task is waiting for an event, and activated those tasks if needed.evaluate
(AttributeReference attributeReference) This method will the evaluate the value of the given attribute reference.boolean
evaluate
(ICondition condition, boolean defaultResult) This method will evaluate the condition and returns it's boolean result.evaluate
(IExpression expression) This method will evaluate the expression and return its result.evaluateDecision
(String description, ICondition condition, boolean defaultResult) This method will evaluate the condition and returns its boolean result as a DMN decision tree.evaluateDecision
(String description, IExpression expression) This method will evaluate the expression and return its result as a DMN decision tree.protected void
evaluateTaskPriority
(DateTimeValue currentTime, String[] nodeIds) Evaluates the priorities of tasks.protected void
evaluateTimerTasks
(DateTimeValue currentTime) protected ProcessCaseRepository
getDao()
long
protected IEvaluationQueue
getQueue()
getTriggeredMessageEvent
(String messageEventName) This method returns the content of a triggered event.boolean
handleCaseUpdates
(IProcessCaseUpdates updates) This method allows updates to the case modelboolean
handleCaseUpdates
(IProcessCaseUpdates updates, ICaseUpdatesContext context) This method allows updates to the case modelboolean
isMessageEventTriggered
(String messageEventName) This method returns a boolean indicating if the specified event has been raised/signaled/triggered during the current process evaluation.boolean
Checks whether the process case being evaluated is locked.void
Notify the evaluator that the execution of an automatic task has finished so that it may queue delayed events created by the automatic task.void
Notify the evaluator that case data has been changed so that cached data may be clearedprotected final void
reopenTask
(ITaskModel taskModel) Re-opens the given task.protected final long
replayTimerEvent
(ICaseEventModel caseEvent) void
setChangeListener
(IProcessCaseChangeListener changeListener) protected void
startProcess
(IProcessEventStartDefinition startDefinition)
-
Constructor Details
-
ProcessEvaluator
protected ProcessEvaluator(ProcessEngine engine, ProcessCase processCase, IUserData userData) throws UnknownAttributeException, UnknownEntityException -
ProcessEvaluator
protected ProcessEvaluator(ProcessEngine engine, IProcessCase processCase, IUserData userData, boolean caseUnlocked) throws UnknownAttributeException, UnknownEntityException Creates a new instance.- Parameters:
engine
-processCase
-userData
- User under who the ProcessEvaluator does its workcaseUnlocked
- - indicates whether the evaluated case has just been unlocked. If true, this evaluator will also evaluate delayed events.- Throws:
UnknownAttributeException
UnknownEntityException
-
-
Method Details
-
getUserData
- Specified by:
getUserData
in interfaceIProcessEvaluator
- Returns:
- The current active user
-
getTraceEngine
- Specified by:
getTraceEngine
in interfaceIProcessEvaluator
- Returns:
- The trace engine
-
getApplicationId
- Specified by:
getApplicationId
in interfaceIProcessEvaluator
- Returns:
- The application id of the current applicaiton
-
getProcessName
- Specified by:
getProcessName
in interfaceIProcessEvaluator
- Returns:
- The name of the process for this evaluator, may be null if the case was not started for a predefined process
-
getProcessCaseId
public long getProcessCaseId()- Specified by:
getProcessCaseId
in interfaceIProcessEvaluator
- Returns:
- the ID of the process for this evaluator
-
getQueue
-
getDao
-
startProcess
-
continueWithEvent
Description copied from interface:IProcessEvaluator
This method will check if any task is waiting for an event, and activated those tasks if needed. An event that has been triggered will stay active during the evaluation, but will be discarded once this evaluator has completed.- Specified by:
continueWithEvent
in interfaceIProcessEvaluator
- Parameters:
messageEvent
- The definition of the event that occurred.- Throws:
AppException
- This exception is thrown when the event could not be processed.
-
evaluateTaskPriority
Evaluates the priorities of tasks.- Parameters:
currentTime
- the reference timenodeIds
- optionally restrict the evaluated tasks to only those with these nodeIds (may be null).
-
evaluateTimerTasks
-
reopenTask
Re-opens the given task. If the task is automatic, it will also be executed.- Parameters:
taskModel
- the task to be re-opened
-
replayTimerEvent
- Throws:
ReplayCaseEventException
-
continueWithCaseDataChange
Description copied from interface:IProcessEvaluator
This method may be invoked to force the process to be evaluated after a change in the case data. A change in case data is mainly relevant for adhoc tasks and condition nodes.- Specified by:
continueWithCaseDataChange
in interfaceIProcessEvaluator
- Throws:
AppException
- This exception is thrown when the evaluation of the process failed.
-
continueFromNode
public void continueFromNode(ITaskModel task, String exitState, boolean caseDataChanged) throws AppException Description copied from interface:IProcessEvaluator
This method will assume the task as completed, and continue the process from that point.- Specified by:
continueFromNode
in interfaceIProcessEvaluator
- Parameters:
task
- The task that was completed, and from which the processing should continue.exitState
- The exit state/result of the completed task.caseDataChanged
- true if case data may have been changed, if true then conditional nodes and adhoc nodes will also be reevaluated- Throws:
AppException
- This exception is thrown when the process could not continue.
-
evaluate
Description copied from interface:IProcessEvaluator
This method will evaluate the expression and return its result.- Specified by:
evaluate
in interfaceIProcessEvaluator
- Parameters:
expression
- The expression that should be evaluated.- Returns:
- The result of the expression.
- Throws:
RuleEngineException
- This exception is thrown when the expression could not be evaluated.
-
evaluate
Description copied from interface:IProcessEvaluator
This method will evaluate the condition and returns it's boolean result. If the condition evaluates to false, or if no condition was available (null), the default result will be returned.- Specified by:
evaluate
in interfaceIProcessEvaluator
- Parameters:
condition
- The condition that should be evaluated (may be null).defaultResult
- The result that should be returned if the condition could not be evaluated.- Returns:
- Boolean containing the result of the condition.
- Throws:
RuleEngineException
- This exception is thrown when the condition could not be evaluated.
-
evaluate
Description copied from interface:IProcessEvaluator
This method will the evaluate the value of the given attribute reference.- Specified by:
evaluate
in interfaceIProcessEvaluator
- Parameters:
attributeReference
- The attribute reference that should be evaluated, may not be null- Returns:
- IValue representing the value, never null
-
evaluateDecision
Description copied from interface:IProcessEvaluator
This method will evaluate the expression and return its result as a DMN decision tree.- Specified by:
evaluateDecision
in interfaceIProcessEvaluator
expression
- The expression that should be evaluated.- Returns:
- The result of the decision.
-
evaluateDecision
public DMNDecisionTree evaluateDecision(String description, ICondition condition, boolean defaultResult) Description copied from interface:IProcessEvaluator
This method will evaluate the condition and returns its boolean result as a DMN decision tree. If the condition evaluates to false, or if no condition was available (null), the default result will be returned.- Specified by:
evaluateDecision
in interfaceIProcessEvaluator
condition
- The condition that should be evaluated (may be null).defaultResult
- The result that should be returned if the condition could not be evaluated.- Returns:
- DMNDecisionTree containing the result of the decision.
-
isMessageEventTriggered
Description copied from interface:IProcessEvaluator
This method returns a boolean indicating if the specified event has been raised/signaled/triggered during the current process evaluation.- Specified by:
isMessageEventTriggered
in interfaceIProcessEvaluator
- Parameters:
messageEventName
- The event that should be checked.- Returns:
- Boolean indicating if the event was triggered during the current evaluation.
-
isProcessCaseLocked
public boolean isProcessCaseLocked()Description copied from interface:IProcessEvaluator
Checks whether the process case being evaluated is locked.- Specified by:
isProcessCaseLocked
in interfaceIProcessEvaluator
- Returns:
- true if the case is locked, false otherwise
-
getTriggeredMessageEvent
Description copied from interface:IProcessEvaluator
This method returns the content of a triggered event.- Specified by:
getTriggeredMessageEvent
in interfaceIProcessEvaluator
- Parameters:
messageEventName
- The name of the message event.- Returns:
- The data content of the messageevent, or null.
-
handleCaseUpdates
public boolean handleCaseUpdates(IProcessCaseUpdates updates) throws ProcessException, UnknownAttributeException, UnknownEntityException Description copied from interface:IProcessEvaluator
This method allows updates to the case model- Specified by:
handleCaseUpdates
in interfaceIProcessEvaluator
- Parameters:
updates
- Interface handling the updates,- Returns:
- Indicator whether the case data was updated.
- Throws:
ProcessException
UnknownAttributeException
UnknownEntityException
-
handleCaseUpdates
public boolean handleCaseUpdates(IProcessCaseUpdates updates, ICaseUpdatesContext context) throws ProcessException, UnknownAttributeException, UnknownEntityException Description copied from interface:IProcessEvaluator
This method allows updates to the case model- Specified by:
handleCaseUpdates
in interfaceIProcessEvaluator
- Parameters:
updates
- Interface handling the updates,context
- interface to provide context about the updates- Returns:
- Indicator whether the case data was updated.
- Throws:
ProcessException
UnknownAttributeException
UnknownEntityException
-
setChangeListener
-
notifyCaseDataChanged
public void notifyCaseDataChanged()Description copied from interface:IProcessEvaluator
Notify the evaluator that case data has been changed so that cached data may be cleared- Specified by:
notifyCaseDataChanged
in interfaceIProcessEvaluator
-
notifyAutomaticTaskFinished
public void notifyAutomaticTaskFinished()Description copied from interface:IProcessEvaluator
Notify the evaluator that the execution of an automatic task has finished so that it may queue delayed events created by the automatic task.- Specified by:
notifyAutomaticTaskFinished
in interfaceIProcessEvaluator
-