Class ModifyProcessInstanceCommandImpl
- All Implemented Interfaces:
CommandWithCommunicationApiStep<ModifyProcessInstanceCommandStep1>,CommandWithOperationReferenceStep<ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep2>,FinalCommandStep<ModifyProcessInstanceResponse>,ModifyProcessInstanceCommandStep1,ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep2,ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.camunda.client.api.command.ModifyProcessInstanceCommandStep1
ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep2, ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3 -
Constructor Summary
ConstructorsConstructorDescriptionModifyProcessInstanceCommandImpl(long processInstanceKey, JsonMapper jsonMapper, io.camunda.zeebe.gateway.protocol.GatewayGrpc.GatewayStub asyncStub, Predicate<CredentialsProvider.StatusCode> retryPredicate, HttpClient httpClient, CamundaClientConfiguration config) -
Method Summary
Modifier and TypeMethodDescriptionactivateElement(String elementId) Create an activate instruction for the given element id.activateElement(String elementId, long ancestorElementInstanceKey) Create an activate instruction for the given element id.and()Acts as a boundary between the different activate and terminate instructions.moveElement(long sourceElementInstanceKey, String targetElementId) Create a move instruction for the given element instance.moveElement(long sourceElementInstanceKey, String targetElementId, long ancestorElementInstanceKey) Create a move instruction for the given element instance. the source element instance with given key will be terminated and will activate a new one at the target element id.moveElements(String sourceElementId, String targetElementId) Create a move instruction for the given element ids.moveElements(String sourceElementId, String targetElementId, long ancestorElementInstanceKey) Create a move instruction for the given element ids.moveElementsWithInferredAncestor(String sourceElementId, String targetElementId) Create a move instruction for the given element ids.moveElementsWithSourceParentAsAncestor(String sourceElementId, String targetElementId) Create a move instruction for the given element ids.moveElementWithInferredAncestor(long sourceElementInstanceKey, String targetElementId) Create a move instruction for the given element instance.moveElementWithSourceParentAsAncestor(long sourceElementInstanceKey, String targetElementId) Create a move instruction for the given element instance.operationReference(long operationReference) Set the Operation Reference.requestTimeout(Duration requestTimeout) Sets the request timeout for the command.send()Sends the command to the Camunda gateway.terminateElement(long elementInstanceKey) Create a terminate instruction for the given element instance key.terminateElements(String elementId) Create a terminate instruction for the given element id.useGrpc()Sets gRPC as the communication API for this command.useRest()Sets REST as the communication API for this command.withVariable(String key, Object value) Create aGatewayOuterClass.ModifyProcessInstanceRequest.VariableInstructionfor the element that's getting activated.withVariable(String key, Object value, String scopeId) Create aGatewayOuterClass.ModifyProcessInstanceRequest.VariableInstructionfor the element that's getting activated.withVariables(InputStream variables) Create aGatewayOuterClass.ModifyProcessInstanceRequest.VariableInstructionfor the element that's getting activated.withVariables(InputStream variables, String scopeId) Create aGatewayOuterClass.ModifyProcessInstanceRequest.VariableInstructionfor the element that's getting activated.withVariables(Object variables) Create aGatewayOuterClass.ModifyProcessInstanceRequest.VariableInstructionfor the element that's getting activated.withVariables(Object variables, String scopeId) Create aGatewayOuterClass.ModifyProcessInstanceRequest.VariableInstructionfor the element that's getting activated.withVariables(String variables) Create aGatewayOuterClass.ModifyProcessInstanceRequest.VariableInstructionfor the element that's getting activated.withVariables(String variables, String scopeId) Create aGatewayOuterClass.ModifyProcessInstanceRequest.VariableInstructionfor the element that's getting activated.withVariables(Map<String, Object> variables) Create aGatewayOuterClass.ModifyProcessInstanceRequest.VariableInstructionfor the element that's getting activated.withVariables(Map<String, Object> variables, String scopeId) Create aGatewayOuterClass.ModifyProcessInstanceRequest.VariableInstructionfor the element that's getting activated.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.camunda.client.api.command.FinalCommandStep
execute
-
Constructor Details
-
ModifyProcessInstanceCommandImpl
public ModifyProcessInstanceCommandImpl(long processInstanceKey, JsonMapper jsonMapper, io.camunda.zeebe.gateway.protocol.GatewayGrpc.GatewayStub asyncStub, Predicate<CredentialsProvider.StatusCode> retryPredicate, HttpClient httpClient, CamundaClientConfiguration config)
-
-
Method Details
-
activateElement
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3 activateElement(String elementId) Description copied from interface:ModifyProcessInstanceCommandStep1Create an activate instruction for the given element id.The element will be created within an existing element instance of the flow scope. When activating an element inside a multi-instance element the element instance key of the ancestor must be defined. For this use
ModifyProcessInstanceCommandStep1.activateElement(String, long).- Specified by:
activateElementin interfaceModifyProcessInstanceCommandStep1- Parameters:
elementId- the id of the element to activate- Returns:
- the builder for this command
-
activateElement
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3 activateElement(String elementId, long ancestorElementInstanceKey) Description copied from interface:ModifyProcessInstanceCommandStep1Create an activate instruction for the given element id.The element will be created within the scope that is passed. This scope must be an ancestor of the element that's getting activated.
- Specified by:
activateElementin interfaceModifyProcessInstanceCommandStep1- Parameters:
elementId- the id of the element to activateancestorElementInstanceKey- the element instance key in which the element will be created- Returns:
- the builder for this command
-
terminateElement
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep2 terminateElement(long elementInstanceKey) Description copied from interface:ModifyProcessInstanceCommandStep1Create a terminate instruction for the given element instance key.- Specified by:
terminateElementin interfaceModifyProcessInstanceCommandStep1- Parameters:
elementInstanceKey- the element instance key of the element to terminate- Returns:
- the builder for this command
-
terminateElements
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep2 terminateElements(String elementId) Description copied from interface:ModifyProcessInstanceCommandStep1Create a terminate instruction for the given element id. The element instances will be determined at runtime.- Specified by:
terminateElementsin interfaceModifyProcessInstanceCommandStep1- Parameters:
elementId- the id of the elements to terminate- Returns:
- the builder for this command
-
moveElements
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3 moveElements(String sourceElementId, String targetElementId) Description copied from interface:ModifyProcessInstanceCommandStep1Create a move instruction for the given element ids. The element instances will be determined at runtime. All source element instances will be terminated and will activate a new one at the target element id. For multi-instance elements, only the body element will activate a new element instance.The elements will be created within an existing element instance of the flow scope. When activating elements inside a multi-instance element, the element instance key of the ancestor must be defined. For this, use
ModifyProcessInstanceCommandStep1.moveElements(String, String, long)orModifyProcessInstanceCommandStep1.moveElementsWithInferredAncestor(String, String).- Specified by:
moveElementsin interfaceModifyProcessInstanceCommandStep1- Parameters:
sourceElementId- the id of the elements to movetargetElementId- the id of target element to move to- Returns:
- the builder for this command
-
moveElements
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3 moveElements(String sourceElementId, String targetElementId, long ancestorElementInstanceKey) Description copied from interface:ModifyProcessInstanceCommandStep1Create a move instruction for the given element ids. The element instances will be determined at runtime. All source element instances will be terminated and will activate a new one at the target element id. For multi-instance elements, only the body element will activate a new element instance.The elements will be created within the scope that is passed. This scope must be an ancestor of the elements that are getting activated.
- Specified by:
moveElementsin interfaceModifyProcessInstanceCommandStep1- Parameters:
sourceElementId- the id of the elements to movetargetElementId- the id of target element to move toancestorElementInstanceKey- the element instance key in which the elements will be created- Returns:
- the builder for this command
-
moveElementsWithInferredAncestor
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3 moveElementsWithInferredAncestor(String sourceElementId, String targetElementId) Description copied from interface:ModifyProcessInstanceCommandStep1Create a move instruction for the given element ids. The element instances will be determined at runtime. All source element instances will be terminated and will activate a new one at the target element id. For multi-instance elements, only the body element will activate a new element instance.This instructs the engine to derive the ancestor scope keys from the source element's hierarchy. The engine traverses the source element's ancestry to find an instance that matches one of the target element's flow scopes, ensuring the target is activated in the correct scope.
- Specified by:
moveElementsWithInferredAncestorin interfaceModifyProcessInstanceCommandStep1- Parameters:
sourceElementId- the id of the elements to movetargetElementId- the id of target element to move to- Returns:
- the builder for this command
-
moveElementsWithSourceParentAsAncestor
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3 moveElementsWithSourceParentAsAncestor(String sourceElementId, String targetElementId) Description copied from interface:ModifyProcessInstanceCommandStep1Create a move instruction for the given element ids. The element instances will be determined at runtime. All source element instances will be terminated and will activate a new one at the target element id. For multi-instance elements, only the body element will activate a new element instance.This instructs the engine to use the source's direct parent key as the ancestor scope key for the target element. This is a simpler alternative to
ModifyProcessInstanceCommandStep1.moveElementsWithInferredAncestor(String, String)that skips hierarchy traversal and directly uses the source's parent key. This is useful when source and target elements are siblings within the same flow scope.- Specified by:
moveElementsWithSourceParentAsAncestorin interfaceModifyProcessInstanceCommandStep1- Parameters:
sourceElementId- the id of the elements to movetargetElementId- the id of target element to move to- Returns:
- the builder for this command
-
moveElement
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3 moveElement(long sourceElementInstanceKey, String targetElementId) Description copied from interface:ModifyProcessInstanceCommandStep1Create a move instruction for the given element instance. This source element instance will be terminated and will activate a new one at the target element id. For multi-instance elements, only the body element will activate a new element instance.The target element will be created within an existing element instance of the flow scope. When activating elements inside a multi-instance element, the element instance key of the ancestor must be defined. For this, use
ModifyProcessInstanceCommandStep1.moveElement(long, String, long)orModifyProcessInstanceCommandStep1.moveElementWithInferredAncestor(long, String).- Specified by:
moveElementin interfaceModifyProcessInstanceCommandStep1- Parameters:
sourceElementInstanceKey- the key of the element to movetargetElementId- the id of target element to move to- Returns:
- the builder for this command
-
moveElement
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3 moveElement(long sourceElementInstanceKey, String targetElementId, long ancestorElementInstanceKey) Description copied from interface:ModifyProcessInstanceCommandStep1Create a move instruction for the given element instance. the source element instance with given key will be terminated and will activate a new one at the target element id. For multi-instance elements, only the body element will activate a new element instance.The target element will be created within the scope that is passed. This scope must be an ancestor of the elements that are getting activated.
- Specified by:
moveElementin interfaceModifyProcessInstanceCommandStep1- Parameters:
sourceElementInstanceKey- the key of the element to movetargetElementId- the id of target element to move toancestorElementInstanceKey- the element instance key in which the elements will be created- Returns:
- the builder for this command
-
moveElementWithInferredAncestor
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3 moveElementWithInferredAncestor(long sourceElementInstanceKey, String targetElementId) Description copied from interface:ModifyProcessInstanceCommandStep1Create a move instruction for the given element instance. The source element instance with * given key will be terminated and will activate a new one at the target element id. For multi-instance elements, only the body element will activate a new element instance.This instructs the engine to derive the ancestor scope key from the source element's hierarchy. The engine traverses the source element's ancestry to find an instance that matches one of the target element's flow scopes, ensuring the target is activated in the correct scope.
- Specified by:
moveElementWithInferredAncestorin interfaceModifyProcessInstanceCommandStep1- Parameters:
sourceElementInstanceKey- the key of the element to movetargetElementId- the id of target element to move to- Returns:
- the builder for this command
-
moveElementWithSourceParentAsAncestor
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3 moveElementWithSourceParentAsAncestor(long sourceElementInstanceKey, String targetElementId) Description copied from interface:ModifyProcessInstanceCommandStep1Create a move instruction for the given element instance. The source element instance with given key will be terminated and will activate a new one at the target element id. For multi-instance elements, only the body element will activate a new element instance.This instructs the engine to use the source's direct parent key as the ancestor scope key for the target element. This is a simpler alternative to
ModifyProcessInstanceCommandStep1.moveElementWithInferredAncestor(long, String)that skips hierarchy traversal and directly uses the source's parent key. This is useful when source and target elements are siblings within the same flow scope.- Specified by:
moveElementWithSourceParentAsAncestorin interfaceModifyProcessInstanceCommandStep1- Parameters:
sourceElementInstanceKey- the key of the element to movetargetElementId- the id of target element to move to- Returns:
- the builder for this command
-
and
Description copied from interface:ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep2Acts as a boundary between the different activate and terminate instructions. Use this if you want to activate or terminate another element. Otherwise,FinalCommandStep.send()the command.- Specified by:
andin interfaceModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep2- Returns:
- the builder for this command
-
withVariables
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3 withVariables(InputStream variables) Description copied from interface:ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3Create aGatewayOuterClass.ModifyProcessInstanceRequest.VariableInstructionfor the element that's getting activated. These variables will be created in the global scope of the process instance.- Specified by:
withVariablesin interfaceModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3- Parameters:
variables- the variables JSON document as stream- Returns:
- the builder for this command
-
withVariables
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3 withVariables(InputStream variables, String scopeId) Description copied from interface:ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3Create aGatewayOuterClass.ModifyProcessInstanceRequest.VariableInstructionfor the element that's getting activated. These variables will be created in the scope of the passed element.- Specified by:
withVariablesin interfaceModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3- Parameters:
variables- the variables JSON document as streamscopeId- the id of the element in which scope the variables should be created- Returns:
- the builder for this command
-
withVariables
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3 withVariables(String variables) Description copied from interface:ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3Create aGatewayOuterClass.ModifyProcessInstanceRequest.VariableInstructionfor the element that's getting activated. These variables will be created in the global scope of the process instance.- Specified by:
withVariablesin interfaceModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3- Parameters:
variables- the variables JSON document as String- Returns:
- the builder for this command
-
withVariables
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3 withVariables(String variables, String scopeId) Description copied from interface:ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3Create aGatewayOuterClass.ModifyProcessInstanceRequest.VariableInstructionfor the element that's getting activated. These variables will be created in the scope of the passed element.- Specified by:
withVariablesin interfaceModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3- Parameters:
variables- the variables JSON document as StringscopeId- the id of the element in which scope the variables should be created- Returns:
- the builder for this command
-
withVariables
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3 withVariables(Map<String, Object> variables) Description copied from interface:ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3Create aGatewayOuterClass.ModifyProcessInstanceRequest.VariableInstructionfor the element that's getting activated. These variables will be created in the global scope of the process instance.- Specified by:
withVariablesin interfaceModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3- Parameters:
variables- the variables JSON document as map- Returns:
- the builder for this command
-
withVariables
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3 withVariables(Map<String, Object> variables, String scopeId) Description copied from interface:ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3Create aGatewayOuterClass.ModifyProcessInstanceRequest.VariableInstructionfor the element that's getting activated. These variables will be created in the scope of the passed element.- Specified by:
withVariablesin interfaceModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3- Parameters:
variables- the variables JSON document as mapscopeId- the id of the element in which scope the variables should be created- Returns:
- the builder for this command
-
withVariables
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3 withVariables(Object variables) Description copied from interface:ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3Create aGatewayOuterClass.ModifyProcessInstanceRequest.VariableInstructionfor the element that's getting activated. These variables will be created in the global scope of the process instance.- Specified by:
withVariablesin interfaceModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3- Parameters:
variables- the variables document as object to be serialized to JSON- Returns:
- the builder for this command
-
withVariables
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3 withVariables(Object variables, String scopeId) Description copied from interface:ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3Create aGatewayOuterClass.ModifyProcessInstanceRequest.VariableInstructionfor the element that's getting activated. These variables will be created in the scope of the passed element.- Specified by:
withVariablesin interfaceModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3- Parameters:
variables- the variables document as object to be serialized to JSONscopeId- the id of the element in which scope the variables should be created- Returns:
- the builder for this command
-
withVariable
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3 withVariable(String key, Object value) Description copied from interface:ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3Create aGatewayOuterClass.ModifyProcessInstanceRequest.VariableInstructionfor the element that's getting activated. This variable will be created in the global scope of the process instance.- Specified by:
withVariablein interfaceModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3- Parameters:
key- the key of the variable to be serialized to JSONvalue- the value of the variable to be serialized to JSON- Returns:
- the builder for this command
-
withVariable
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3 withVariable(String key, Object value, String scopeId) Description copied from interface:ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3Create aGatewayOuterClass.ModifyProcessInstanceRequest.VariableInstructionfor the element that's getting activated. This variable will be created in the scope of the passed element.- Specified by:
withVariablein interfaceModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep3- Parameters:
key- the key of the variable to be serialized to JSONvalue- the value of the variable to be serialized to JSONscopeId- the id of the element in which scope the variable should be created- Returns:
- the builder for this command
-
requestTimeout
Description copied from interface:FinalCommandStepSets the request timeout for the command. The default request timeout can be configured usingCamundaClientBuilder.defaultRequestTimeout(Duration).- Specified by:
requestTimeoutin interfaceFinalCommandStep<ModifyProcessInstanceResponse>- Parameters:
requestTimeout- the request timeout- Returns:
- the configured command
-
send
Description copied from interface:FinalCommandStepSends the command to the Camunda gateway. This operation is asynchronous. In case of success, the future returns the event that was generated by the Camunda gateway in response to the command.Call
CamundaFuture.join()to wait until the response is available.Future<JobEventinvalid input: '>' future = command.send(); JobEvent event = future.join();- Specified by:
sendin interfaceFinalCommandStep<ModifyProcessInstanceResponse>- Returns:
- a future tracking state of success/failure of the command.
-
operationReference
public ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep2 operationReference(long operationReference) Description copied from interface:CommandWithOperationReferenceStepSet the Operation Reference.This is a key chosen by the user and will be part of all records resulted from this operation
- Specified by:
operationReferencein interfaceCommandWithOperationReferenceStep<ModifyProcessInstanceCommandStep1.ModifyProcessInstanceCommandStep2>- Parameters:
operationReference- a reference key chosen by the user and will be part of all records resulted from this operation- Returns:
- the builder for this command with the operation reference specified
-
useRest
Description copied from interface:CommandWithCommunicationApiStepSets REST as the communication API for this command. If this command doesn't support communication over REST, it simply returns the command builder instance unchanged. The default communication API can be configured usingCamundaClientBuilder.preferRestOverGrpc(boolean).- Specified by:
useRestin interfaceCommandWithCommunicationApiStep<ModifyProcessInstanceCommandStep1>- Returns:
- the configured command
-
useGrpc
Description copied from interface:CommandWithCommunicationApiStepSets gRPC as the communication API for this command. If this command doesn't support communication over gRPC, it simply returns the command builder instance unchanged. The default communication API can be configured usingCamundaClientBuilder.preferRestOverGrpc(boolean).- Specified by:
useGrpcin interfaceCommandWithCommunicationApiStep<ModifyProcessInstanceCommandStep1>- Returns:
- the configured command
-