Class ProcessEvaluator

java.lang.Object
com.aquima.interactions.process.impl.ProcessEvaluator
All Implemented Interfaces:
IProcessEvaluator

public class ProcessEvaluator extends Object implements 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 Details

    • ProcessEvaluator

      protected ProcessEvaluator(ProcessEngine engine, ProcessCase processCase, IUserData userData)
    • ProcessEvaluator

      protected ProcessEvaluator(ProcessEngine engine, IProcessCase processCase, IUserData userData, boolean caseUnlocked)
      Creates a new instance.
      Parameters:
      engine - the process engine
      processCase - the process case
      userData - User under whom the ProcessEvaluator does its work
      caseUnlocked - - indicates whether the evaluated case has just been unlocked. If true, this evaluator will also evaluate delayed events.
  • Method Details

    • getUserData

      public IUserData getUserData()
      Specified by:
      getUserData in interface IProcessEvaluator
      Returns:
      The current active user
    • getTraceEngine

      public ITraceEngine getTraceEngine()
      Specified by:
      getTraceEngine in interface IProcessEvaluator
      Returns:
      The trace engine
    • getApplicationId

      public String getApplicationId()
      Specified by:
      getApplicationId in interface IProcessEvaluator
      Returns:
      The application id of the current applicaiton
    • getProcessName

      public String getProcessName()
      Specified by:
      getProcessName in interface IProcessEvaluator
      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 interface IProcessEvaluator
      Returns:
      the ID of the process for this evaluator
    • getQueue

      protected IEvaluationQueue getQueue()
    • getDao

      protected ProcessCaseRepository getDao()
    • startProcess

      protected void startProcess(IProcessEventStartDefinition startDefinition)
    • continueWithEvent

      public void continueWithEvent(IMessageEvent messageEvent)
      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 interface IProcessEvaluator
      Parameters:
      messageEvent - The definition of the event that occurred.
    • evaluateTaskPriority

      protected void evaluateTaskPriority(DateTimeValue currentTime, String[] nodeIds)
      Evaluates the priorities of tasks.
      Parameters:
      currentTime - the reference time
      nodeIds - optionally restrict the evaluated tasks to only those with these nodeIds (may be null).
    • evaluateTimerTasks

      protected void evaluateTimerTasks(DateTimeValue currentTime)
    • reopenTask

      protected final void reopenTask(ITaskModel taskModel)
      Re-opens the given task. If the task is automatic, it will also be executed.
      Parameters:
      taskModel - the task to be re-opened
    • replayTimerEvent

      protected final long replayTimerEvent(ICaseEventModel caseEvent)
    • continueWithCaseDataChange

      public void 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 interface IProcessEvaluator
    • continueFromNode

      public void continueFromNode(ITaskModel task, String exitState, boolean caseDataChanged)
      Description copied from interface: IProcessEvaluator
      This method will assume the task as completed, and continue the process from that point.
      Specified by:
      continueFromNode in interface IProcessEvaluator
      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
    • evaluate

      public IValue evaluate(IExpression expression)
      Description copied from interface: IProcessEvaluator
      This method will evaluate the expression and return its result.
      Specified by:
      evaluate in interface IProcessEvaluator
      Parameters:
      expression - The expression that should be evaluated.
      Returns:
      The result of the expression.
    • evaluate

      public boolean evaluate(ICondition condition, boolean defaultResult)
      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 interface IProcessEvaluator
      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.
    • evaluate

      public IValue evaluate(AttributeReference attributeReference)
      Description copied from interface: IProcessEvaluator
      This method will the evaluate the value of the given attribute reference.
      Specified by:
      evaluate in interface IProcessEvaluator
      Parameters:
      attributeReference - The attribute reference that should be evaluated, may not be null
      Returns:
      IValue representing the value, never null
    • evaluateDecision

      public DMNDecisionTree evaluateDecision(String description, IExpression expression)
      Description copied from interface: IProcessEvaluator
      This method will evaluate the expression and return its result as a DMN decision tree.
      Specified by:
      evaluateDecision in interface IProcessEvaluator
      Parameters:
      description - the description
      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 interface IProcessEvaluator
      Parameters:
      description - the description
      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

      public boolean isMessageEventTriggered(String messageEventName)
      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 interface IProcessEvaluator
      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 interface IProcessEvaluator
      Returns:
      true if the case is locked, false otherwise
    • getTriggeredMessageEvent

      public TriggeredMessageEvent getTriggeredMessageEvent(String messageEventName)
      Description copied from interface: IProcessEvaluator
      This method returns the content of a triggered event.
      Specified by:
      getTriggeredMessageEvent in interface IProcessEvaluator
      Parameters:
      messageEventName - The name of the message event.
      Returns:
      The data content of the messageevent, or null.
    • handleCaseUpdates

      public boolean handleCaseUpdates(IProcessCaseUpdates updates)
      Description copied from interface: IProcessEvaluator
      This method allows updates to the case model
      Specified by:
      handleCaseUpdates in interface IProcessEvaluator
      Parameters:
      updates - Interface handling the updates,
      Returns:
      Indicator whether the case data was updated.
    • handleCaseUpdates

      public boolean handleCaseUpdates(IProcessCaseUpdates updates, ICaseUpdatesContext context)
      Description copied from interface: IProcessEvaluator
      This method allows updates to the case model
      Specified by:
      handleCaseUpdates in interface IProcessEvaluator
      Parameters:
      updates - Interface handling the updates,
      context - interface to provide context about the updates
      Returns:
      Indicator whether the case data was updated.
    • setChangeListener

      public void setChangeListener(IProcessCaseChangeListener changeListener)
    • 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 interface IProcessEvaluator
    • 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 interface IProcessEvaluator