Interface CaseInstanceBuilder


public interface CaseInstanceBuilder
Author:
Joram Barrez, Tijs Rademakers, Micha Kiener
  • Method Details

    • caseDefinitionId

      CaseInstanceBuilder caseDefinitionId(String caseDefinitionId)
      Set the case definition to be used for creating a new case instance by its id. If both the case definition id and the key are set, the id takes precedence and the key will be ignored. At least one of them needs to be specified within the builder.
      Parameters:
      caseDefinitionId - the id of the case definition the new case should be based on
      Returns:
      the case instance builder for method chaining
    • caseDefinitionKey

      CaseInstanceBuilder caseDefinitionKey(String caseDefinitionKey)
      Set the case definition to be used for creating a new case instance by its key. If both the case definition id and the key are set, the id takes precedence and the key will be ignored. At least one of them needs to be specified within the builder.
      Parameters:
      caseDefinitionKey - the key of the case definition the new case should be based on
      Returns:
      the case instance builder for method chaining
    • caseDefinitionParentDeploymentId

      CaseInstanceBuilder caseDefinitionParentDeploymentId(String parentDeploymentId)
      When looking up for a case definition by key it would first lookup for a case definition within the given parent deployment. Then it would fallback to the latest case definition with the given key.

      This is typically needed when the CaseInstanceBuilder is called for example from the process engine to start a case instance and it needs to lookup the case definition in the same deployment as the process. Or when starting a case via a case task from the cmmn engine

    • predefinedCaseInstanceId

      CaseInstanceBuilder predefinedCaseInstanceId(String caseInstanceId)
      If the new case instance should have a predefined id, you can set it using this method. If that predefined id is set, it will be used instead of creating a new one automatically.
      Parameters:
      caseInstanceId - the id of the new case instance to be used
      Returns:
      the case instance builder for method chaining
    • name

    • businessKey

      CaseInstanceBuilder businessKey(String businessKey)
    • businessStatus

      CaseInstanceBuilder businessStatus(String businessStatus)
    • variables

      CaseInstanceBuilder variables(Map<String,Object> variables)
    • variable

      CaseInstanceBuilder variable(String variableName, Object value)
    • transientVariables

      CaseInstanceBuilder transientVariables(Map<String,Object> transientVariables)
    • transientVariable

      CaseInstanceBuilder transientVariable(String variableName, Object value)
    • tenantId

      CaseInstanceBuilder tenantId(String tenantId)
    • owner

      CaseInstanceBuilder owner(String userId)
      Set the owner of the case to be created to the given user id.
      Parameters:
      userId - the id of the user to become the owner of the case
      Returns:
      the case instance builder for method chaining
    • assignee

      CaseInstanceBuilder assignee(String userId)
      Set the assignee of the case to be created to the given user id.
      Parameters:
      userId - the id of the user to become the assignee of the case
      Returns:
      the case instance builder for method chaining
    • overrideCaseDefinitionTenantId

      CaseInstanceBuilder overrideCaseDefinitionTenantId(String tenantId)
      Indicator to override the tenant id of the case definition with the provided value. The tenantId to lookup the case definition should still be provided if needed.
    • startFormVariables

      CaseInstanceBuilder startFormVariables(Map<String,Object> formVariables)
      Allows to pass any variables if they come from a form. The difference with regular variables(Map) is that the start form will be fetched and the variables matched with the FormInfo.
    • outcome

      CaseInstanceBuilder outcome(String outcome)
      Saves the outcome of the start form for the case, if this case should be started out of a start form. You can additionally save any form variables along with the outcome and start the case using startWithForm().
      Parameters:
      outcome - the outcome to be registered in the builder
      Returns:
      the case instance builder for method chaining
    • callbackId

      CaseInstanceBuilder callbackId(String callbackId)
      Set callback id of the newly created case instance.
      Parameters:
      callbackId - id of the callback
      Returns:
      case instance builder which creates case instance with defined callback id
    • callbackType

      CaseInstanceBuilder callbackType(String callbackType)
      Set callback type of the newly created case instance.
      Parameters:
      callbackType - type of the callback
      Returns:
      case instance builder which creates case instance with defined callback type
    • referenceId

      CaseInstanceBuilder referenceId(String referenceId)
      Set the reference id on the newly create case instance.
    • referenceType

      CaseInstanceBuilder referenceType(String referenceType)
      Set the reference type on the newly create case instance.
    • parentId

      CaseInstanceBuilder parentId(String parentCaseInstanceId)
      Set parent case instanceId of the newly create case instance
      Parameters:
      parentCaseInstanceId - parent case instance identifier
      Returns:
      modified case instance builder which creates case instance with the reference to parent
    • fallbackToDefaultTenant

      CaseInstanceBuilder fallbackToDefaultTenant()
      If case definition is not found by key in the specified tenant use default tenant search as a fallback
      Returns:
      modified case instance builder
    • start

      CaseInstance start()
      Once all the information is set using this builder API, the start method will create the case instance, initialize it according all the data in the builder and then evaluate the case model to start the case. It will be initialized, evaluated and started in a single transaction, synchronously, so this method returns once the case model will hit a wait state.
      Returns:
      the case instance
    • startAsync

      CaseInstance startAsync()
      Once all the information is set using this builder API, the startAsync method will create the case instance and initialize its data, but the case model is not yet evaluated, but will be started and evaluated asynchronously in a different transaction.
      Returns:
      the case instance as being persisted, but not yet evaluated through the case model
    • startWithForm

      CaseInstance startWithForm()
      Once all the information is set using this builder API, the startWithForm method will create the case instance and initialize its data by additionally using the submitted form variables and handling them with the start form provided with the case model (e.g. validation).
      Returns:
      the case instance as being persisted, but not yet evaluated through the case model
    • getCaseDefinitionId

      String getCaseDefinitionId()
    • getCaseDefinitionKey

      String getCaseDefinitionKey()
    • getCaseDefinitionParentDeploymentId

      String getCaseDefinitionParentDeploymentId()
    • getPredefinedCaseInstanceId

      String getPredefinedCaseInstanceId()
    • getName

      String getName()
    • getBusinessKey

      String getBusinessKey()
    • getBusinessStatus

      String getBusinessStatus()
    • getVariables

      Map<String,Object> getVariables()
    • getTransientVariables

      Map<String,Object> getTransientVariables()
    • getTenantId

      String getTenantId()
    • getOwner

      String getOwner()
    • getAssignee

      String getAssignee()
    • getOverrideDefinitionTenantId

      String getOverrideDefinitionTenantId()
    • getStartFormVariables

      Map<String,Object> getStartFormVariables()
    • getOutcome

      String getOutcome()
    • getCallbackId

      String getCallbackId()
    • getCallbackType

      String getCallbackType()
    • getReferenceId

      String getReferenceId()
    • getReferenceType

      String getReferenceType()
    • getParentId

      String getParentId()
    • isFallbackToDefaultTenant

      boolean isFallbackToDefaultTenant()
    • isStartWithForm

      boolean isStartWithForm()