Interface CaseInstanceBuilder
-
- All Known Implementing Classes:
CaseInstanceBuilderImpl
public interface CaseInstanceBuilder
A fluent builder to create a new case instance.
- Author:
- Roman Smirnov
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CaseInstanceBuilder
businessKey(java.lang.String businessKey)
A business key can be provided to associate the case instance with a certain identifier that has a clear business meaning.CaseInstanceBuilder
caseDefinitionTenantId(java.lang.String tenantId)
Specify the id of the tenant the case definition belongs to.CaseInstanceBuilder
caseDefinitionWithoutTenantId()
Specify that the case definition belongs to no tenant.CaseInstance
create()
Creates a newCaseInstance
, which will be in theACTIVE
state.CaseInstanceBuilder
setVariable(java.lang.String variableName, java.lang.Object variableValue)
Pass a variable to the case instance.CaseInstanceBuilder
setVariables(java.util.Map<java.lang.String,java.lang.Object> variables)
Pass a map of variables to the case instance.
-
-
-
Method Detail
-
businessKey
CaseInstanceBuilder businessKey(java.lang.String businessKey)
A business key can be provided to associate the case instance with a certain identifier that has a clear business meaning. This business key can then be used to easily look up that case instance, see
CaseInstanceQuery.caseInstanceBusinessKey(String)
. Providing such a business key is definitely a best practice.Note that a business key MUST be unique for the given case definition WHEN you have added a database constraint for it. In this case, only case instance from different case definition are allowed to have the same business key and the combination of caseDefinitionKey-businessKey must be unique.
- Parameters:
businessKey
- a key that uniquely identifies the case instance in the context of the given case definition.- Returns:
- the builder
-
caseDefinitionTenantId
CaseInstanceBuilder caseDefinitionTenantId(java.lang.String tenantId)
Specify the id of the tenant the case definition belongs to. Can only be used when the definition is referenced bykey
and not byid
.
-
caseDefinitionWithoutTenantId
CaseInstanceBuilder caseDefinitionWithoutTenantId()
Specify that the case definition belongs to no tenant. Can only be used when the definition is referenced bykey
and not byid
.
-
setVariable
CaseInstanceBuilder setVariable(java.lang.String variableName, java.lang.Object variableValue)
Pass a variable to the case instance.
Invoking this method multiple times allows passing multiple variables.
- Parameters:
variableName
- the name of the variable to setvariableValue
- the value of the variable to set- Returns:
- the builder
- Throws:
NotValidException
- when the given variable name is null
-
setVariables
CaseInstanceBuilder setVariables(java.util.Map<java.lang.String,java.lang.Object> variables)
Pass a map of variables to the case instance.
Invoking this method multiple times allows passing multiple variables.
- Parameters:
variables
- the map of variables- Returns:
- the builder
-
create
CaseInstance create()
Creates a new
CaseInstance
, which will be in theACTIVE
state.- Throws:
NotValidException
- when the given case definition key or id is null orNotFoundException
- when no case definition is deployed with the given key or id.ProcessEngineException
- when an internal exception happens during the execution of the command
-
-