Class CaseInstanceHelperImpl

java.lang.Object
org.flowable.cmmn.engine.impl.runtime.CaseInstanceHelperImpl
All Implemented Interfaces:
CaseInstanceHelper

public class CaseInstanceHelperImpl extends Object implements CaseInstanceHelper
Author:
Joram Barrez, Micha Kiener
  • Field Details

  • Constructor Details

  • Method Details

    • startCaseInstance

      public CaseInstanceEntity startCaseInstance(CaseInstanceBuilder caseInstanceBuilder)
      Specified by:
      startCaseInstance in interface CaseInstanceHelper
    • startCaseInstanceAsync

      public CaseInstanceEntity startCaseInstanceAsync(CaseInstanceBuilder caseInstanceBuilder)
      Specified by:
      startCaseInstanceAsync in interface CaseInstanceHelper
    • copyHistoricCaseInstanceToRuntime

      public CaseInstanceEntity copyHistoricCaseInstanceToRuntime(HistoricCaseInstance caseInstance)
      Description copied from interface: CaseInstanceHelper
      Creates a new case instance within the runtime based on the given historic and ended case instance to be reactivated later on. This method only copies all relevant data like the case instance, its plan items and variables to the runtime, but does not further reactivate plan items or trigger the reactivation listener. But it also sets the state of the runtime case instance to active and keeps the historic one in sync.
      Specified by:
      copyHistoricCaseInstanceToRuntime in interface CaseInstanceHelper
      Parameters:
      caseInstance - the historic case instance to copy back to the runtime
      Returns:
      the copied case instance entity added back to the runtime
    • getCaseDefinition

      protected CaseDefinition getCaseDefinition(CaseInstanceBuilder caseInstanceBuilder, CommandContext commandContext)
    • startCaseInstance

      protected CaseInstanceEntity startCaseInstance(CommandContext commandContext, CaseDefinition caseDefinition, CaseInstanceBuilder caseInstanceBuilder)
    • startCaseInstanceAsync

      protected CaseInstanceEntity startCaseInstanceAsync(CommandContext commandContext, CaseDefinition caseDefinition, CaseInstanceBuilder caseInstanceBuilder)
    • copyHistoricCaseInstanceToRuntime

      protected CaseInstanceEntity copyHistoricCaseInstanceToRuntime(CommandContext commandContext, CaseDefinition caseDefinition, HistoricCaseInstance caseInstance)
      This is the first part of reactivating a case instance from the history. It copies the historic data back to the runtime which is the case instance, its plan items and the variables. This method does not trigger the reactivation listener, just checks, if it is there, but there is no reactivation of plan items, etc. Just the copy of the historic data back to the runtime.
      Parameters:
      commandContext - the command context to execute within
      caseDefinition - the case definition to get the case model from
      caseInstance - the historic case instance to copy back to the runtime
      Returns:
      the copied runtime case instance entity for further processing
    • createAsyncInitJob

      protected void createAsyncInitJob(CaseInstanceEntity caseInstance, CaseDefinition caseDefinition, org.flowable.cmmn.model.Case caseModel, JobService jobService, CommandContext commandContext)
    • getCmmnModel

      protected org.flowable.cmmn.model.CmmnModel getCmmnModel(CommandContext commandContext, CaseDefinition caseDefinition)
    • getCaseModel

      protected org.flowable.cmmn.model.Case getCaseModel(CaseDefinition caseDefinition, org.flowable.cmmn.model.CmmnModel cmmnModel)
    • initializeCaseInstanceEntity

      protected CaseInstanceEntity initializeCaseInstanceEntity(CommandContext commandContext, CaseDefinition caseDefinition, org.flowable.cmmn.model.CmmnModel cmmnModel, org.flowable.cmmn.model.Case caseModel, CaseInstanceBuilder caseInstanceBuilder)
    • applyCaseInstanceBuilder

      protected void applyCaseInstanceBuilder(CmmnEngineConfiguration cmmnEngineConfiguration, CaseInstanceBuilder caseInstanceBuilder, org.flowable.cmmn.model.Case caseModel, CaseInstanceEntity caseInstanceEntity, CaseDefinition caseDefinition, StartCaseInstanceBeforeContext instanceBeforeContext, CommandContext commandContext)
    • resolveFormInfo

      protected FormInfo resolveFormInfo(org.flowable.cmmn.model.Stage planModel, CaseDefinition caseDefinition, String tenantId, FormRepositoryService formRepositoryService, CmmnEngineConfiguration cmmnEngineConfiguration)
    • isFormFieldValidationEnabled

      protected boolean isFormFieldValidationEnabled(CmmnEngineConfiguration cmmnEngineConfiguration, org.flowable.cmmn.model.Stage stage)
    • createCaseInstanceEntityFromDefinition

      protected CaseInstanceEntity createCaseInstanceEntityFromDefinition(CommandContext commandContext, CaseDefinition caseDefinition, StartCaseInstanceBeforeContext instanceBeforeContext)
    • createCaseInstanceEntityFromHistoricCaseInstance

      protected CaseInstanceEntity createCaseInstanceEntityFromHistoricCaseInstance(CommandContext commandContext, HistoricCaseInstance historicCaseInstance)
      Creates a new runtime case instance based on the given historic one by copying all of its data, but setting its state to active again. Plan items as well as variables are copied to the runtime as well. The historic instance is reflecting the same state as well as it is no longer terminated.
      Parameters:
      commandContext - the command context to execute within
      historicCaseInstance - the historic case instance to be copied back to the runtime
      Returns:
      the newly created runtime case instance, initialized from the historic one
    • createCasePlanItemsFromHistoricCaseInstance

      protected List<PlanItemInstanceEntity> createCasePlanItemsFromHistoricCaseInstance(HistoricCaseInstance historicCaseInstance, CaseInstanceEntity newCaseInstance)
      Creates new plan item instances for the runtime according the historic ones, even though they are all completed, ended or terminated. Later on, they might be reactivated according the case model, but this is not part of this method.
      Parameters:
      historicCaseInstance - the historic case instance to copy the plan items from
      newCaseInstance - the newly created runtime copy of the historic case instance where the new plan items are attached to
      Returns:
      the list of newly copied plan item instances in the runtime
    • createCaseVariablesFromHistoricCaseInstance

      protected Map<String,VariableInstanceEntity> createCaseVariablesFromHistoricCaseInstance(HistoricCaseInstance historicCaseInstance)
      Creates new variables in the runtime according the history of the provided case instance.
      Parameters:
      historicCaseInstance - the historic case instance to copy its variables back to the runtime
      Returns:
      the map of the created variables
    • callCaseInstanceStateChangeCallbacks

      public void callCaseInstanceStateChangeCallbacks(CallbackData callbackData)
      Specified by:
      callCaseInstanceStateChangeCallbacks in interface CaseInstanceHelper