Class CompleteJobCommandImpl
- All Implemented Interfaces:
CommandWithCommunicationApiStep<CompleteJobCommandStep1>,CompleteJobCommandStep1,CompleteJobCommandStep1.CompleteJobCommandStep2,FinalCommandStep<CompleteJobResponse>
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.camunda.client.api.command.CompleteJobCommandStep1
CompleteJobCommandStep1.CompleteJobCommandStep2 -
Field Summary
Fields inherited from class io.camunda.client.impl.command.CommandWithVariables
objectMapper -
Constructor Summary
ConstructorsConstructorDescriptionCompleteJobCommandImpl(GatewayGrpc.GatewayStub asyncStub, JsonMapper jsonMapper, long key, Duration requestTimeout, Predicate<CredentialsProvider.StatusCode> retryPredicate, HttpClient httpClient, boolean preferRestOverGrpc) -
Method Summary
Modifier and TypeMethodDescriptioncorrect(JobResultCorrections corrections) Applies corrections to the user task attributes.correct(UnaryOperator<JobResultCorrections> corrections) Dynamically applies corrections to the user task attributes using a lambda expression.correctAssignee(String assignee) Correct the assignee of the task.correctCandidateGroups(List<String> candidateGroups) Correct the candidate groups of the task.correctCandidateUsers(List<String> candidateUsers) Correct the candidate users of the task.correctDueDate(String dueDate) Correct the due date of the task.correctFollowUpDate(String followUpDate) Correct the follow up date of the task.correctPriority(Integer priority) Correct the priority of the task.deny(boolean isDenied) Indicates whether the worker denies the work, i.e. explicitly doesn't approve it.requestTimeout(Duration requestTimeout) Sets the request timeout for the command.Marks the completion of configuring the result of the job.send()Sends the command to the Camunda gateway.protected CompleteJobCommandStep1setVariablesInternal(String variables) useGrpc()Experimental: This method is under development, and as such using it may have no effect on the command builder when called.useRest()Experimental: This method is under development, and as such using it may have no effect on the command builder when called.Initializes the job result to allow corrections or a denial to be configured.withResult(CompleteJobResult jobResult) Sets the result of the completed job, allowing the worker to apply corrections to user task attributes or explicitly deny the user task lifecycle transition.withResult(UnaryOperator<CompleteJobResult> jobResultModifier) Modifies the result of the completed job using a lambda expression, allowing the worker to dynamically apply corrections to user task attributes or explicitly deny the user task lifecycle transition.Methods inherited from class io.camunda.client.impl.command.CommandWithVariables
variable, variables, variables, variables, variables
-
Constructor Details
-
CompleteJobCommandImpl
public CompleteJobCommandImpl(GatewayGrpc.GatewayStub asyncStub, JsonMapper jsonMapper, long key, Duration requestTimeout, Predicate<CredentialsProvider.StatusCode> retryPredicate, HttpClient httpClient, boolean preferRestOverGrpc)
-
-
Method Details
-
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<CompleteJobResponse>- 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<CompleteJobResponse>- Returns:
- a future tracking state of success/failure of the command.
-
withResult
Description copied from interface:CompleteJobCommandStep1Initializes the job result to allow corrections or a denial to be configured.This method is used to apply changes to user task attributes (such as
assignee,priority,dueDate, and so on) or explicitly deny a user task lifecycle transition.Example usage:
client.newCompleteJobCommand(jobKey) .withResult() .correctAssignee("john_doe") // dynamically reassigns the task to 'john_doe' .correctPriority(84) // adjusts the priority of the task .correctDueDate("2024-11-22T11:44:55.0000Z") // sets a new due date .send();- Specified by:
withResultin interfaceCompleteJobCommandStep1- Returns:
- the builder for this command.
-
withResult
Description copied from interface:CompleteJobCommandStep1Sets the result of the completed job, allowing the worker to apply corrections to user task attributes or explicitly deny the user task lifecycle transition.The
CompleteJobResultobject provides a flexible way to:- Correct user task attributes such as
assignee,dueDate,priority, and more. - Deny the lifecycle transition associated with the user task.
final CompleteJobResult jobResult = new CompleteJobResult() .correctAssignee("newAssignee") // dynamically assigns the task .correctPriority(42); // updates the task priority client.newCompleteJobCommand(jobKey) .withResult(jobResult) .send();- Specified by:
withResultin interfaceCompleteJobCommandStep1- Parameters:
jobResult- the result of the job, containing corrections and/or a denial flag.- Returns:
- the builder for this command. Call
FinalCommandStep.send()to finalize the command and send it to the broker.
- Correct user task attributes such as
-
withResult
Description copied from interface:CompleteJobCommandStep1Modifies the result of the completed job using a lambda expression, allowing the worker to dynamically apply corrections to user task attributes or explicitly deny the user task lifecycle transition.This is a convenience method for
CompleteJobCommandStep1.withResult(CompleteJobResult), allowing modifications to be applied directly via a functional interface rather than constructing theCompleteJobResultmanually, enabling:- Correcting user task attributes such as
assignee,dueDate,priority, and more. - Denying the lifecycle transition associated with the user task.
The lambda expression receives the current
CompleteJobResult, which can be modified as needed. If no result has been set yet, a defaultCompleteJobResultis provided for modification.client.newCompleteJobCommand(jobKey) .withResult(r -> r.deny(true)) .send();- Specified by:
withResultin interfaceCompleteJobCommandStep1- Parameters:
jobResultModifier- a function to modify theCompleteJobResult.- Returns:
- the builder for this command. Call
FinalCommandStep.send()to finalize the command and send it to the broker.
- Correcting user task attributes such as
-
deny
Description copied from interface:CompleteJobCommandStep1.CompleteJobCommandStep2Indicates whether the worker denies the work, i.e. explicitly doesn't approve it. For example, a user task listener can deny the completion of a task by setting this flag to true. In this example, the completion of a task is represented by a job that the worker can complete as denied. As a result, the completion request is rejected and the task remains active. Defaults tofalse.Example usage:
client.newCompleteJobCommand(jobKey) .withResult() .deny(true) .send();- Specified by:
denyin interfaceCompleteJobCommandStep1.CompleteJobCommandStep2- Parameters:
isDenied- indicates if the worker has denied the reason for the job- Returns:
- the builder for this command. Call
FinalCommandStep.send()to complete the command and send it to the broker.
-
correct
Description copied from interface:CompleteJobCommandStep1.CompleteJobCommandStep2Applies corrections to the user task attributes.This method allows the worker to modify key attributes of the user task (such as
assignee,candidateGroups, and so on)Example usage:
final JobResultCorrections corrections = new JobResultCorrections() .assignee("john_doe") // reassigns the task to 'john_doe' .priority(80) // sets a high priority .dueDate("2024-01-01T12:00:00Z") // updates the due date .candidateGroups(List.of("sales")) // allows the 'sales' group to claim the task .candidateUsers(List.of("alice")); // allows 'alice' to claim the task client.newCompleteJobCommand(jobKey) .withResult() .correct(corrections) .send();- Specified by:
correctin interfaceCompleteJobCommandStep1.CompleteJobCommandStep2- Parameters:
corrections- the corrections to apply to the user task.- Returns:
- the builder for this command. Call
FinalCommandStep.send()to complete the command and send it to the broker.
-
correct
public CompleteJobCommandStep1.CompleteJobCommandStep2 correct(UnaryOperator<JobResultCorrections> corrections) Description copied from interface:CompleteJobCommandStep1.CompleteJobCommandStep2Dynamically applies corrections to the user task attributes using a lambda expression.This method is a functional alternative to
CompleteJobCommandStep1.CompleteJobCommandStep2.correct(JobResultCorrections). It allows the worker to modify key user task attributes (such asassignee,dueDate,priority, and so on) directly via a lambda expression. The lambda receives the currentJobResultCorrectionsinstance, which can be updated as needed. If no corrections have been set yet, a defaultJobResultCorrectionsinstance is provided.Example usage:
client.newCompleteJobCommand(jobKey) .withResult() .correct(corrections -> corrections .assignee("john_doe") // dynamically reassigns the task to 'john_doe' .priority(80) // adjusts the priority of the task .dueDate("2024-01-01T12:00:00Z") // updates the due date .candidateGroups(List.of("sales")) // allows the 'sales' group to claim the task .candidateUsers(List.of("alice"))) // allows 'alice' to claim the task .send();- Specified by:
correctin interfaceCompleteJobCommandStep1.CompleteJobCommandStep2- Parameters:
corrections- a lambda expression to modify theJobResultCorrections.- Returns:
- the builder for this command. Call
FinalCommandStep.send()to complete the command and send it to the broker.
-
correctAssignee
Description copied from interface:CompleteJobCommandStep1.CompleteJobCommandStep2Correct the assignee of the task.- Specified by:
correctAssigneein interfaceCompleteJobCommandStep1.CompleteJobCommandStep2- Parameters:
assignee- assignee of the task- Returns:
- the builder for this command. Call
FinalCommandStep.send()to complete the command and send it to the broker.
-
correctDueDate
Description copied from interface:CompleteJobCommandStep1.CompleteJobCommandStep2Correct the due date of the task.- Specified by:
correctDueDatein interfaceCompleteJobCommandStep1.CompleteJobCommandStep2- Parameters:
dueDate- due date of the task- Returns:
- the builder for this command. Call
FinalCommandStep.send()to complete the command and send it to the broker.
-
correctFollowUpDate
Description copied from interface:CompleteJobCommandStep1.CompleteJobCommandStep2Correct the follow up date of the task.- Specified by:
correctFollowUpDatein interfaceCompleteJobCommandStep1.CompleteJobCommandStep2- Parameters:
followUpDate- follow up date of the task- Returns:
- the builder for this command. Call
FinalCommandStep.send()to complete the command and send it to the broker.
-
correctCandidateUsers
public CompleteJobCommandStep1.CompleteJobCommandStep2 correctCandidateUsers(List<String> candidateUsers) Description copied from interface:CompleteJobCommandStep1.CompleteJobCommandStep2Correct the candidate users of the task.- Specified by:
correctCandidateUsersin interfaceCompleteJobCommandStep1.CompleteJobCommandStep2- Parameters:
candidateUsers- candidate users of the task- Returns:
- the builder for this command. Call
FinalCommandStep.send()to complete the command and send it to the broker.
-
correctCandidateGroups
public CompleteJobCommandStep1.CompleteJobCommandStep2 correctCandidateGroups(List<String> candidateGroups) Description copied from interface:CompleteJobCommandStep1.CompleteJobCommandStep2Correct the candidate groups of the task.- Specified by:
correctCandidateGroupsin interfaceCompleteJobCommandStep1.CompleteJobCommandStep2- Parameters:
candidateGroups- candidate groups of the task- Returns:
- the builder for this command. Call
FinalCommandStep.send()to complete the command and send it to the broker.
-
correctPriority
Description copied from interface:CompleteJobCommandStep1.CompleteJobCommandStep2Correct the priority of the task.- Specified by:
correctPriorityin interfaceCompleteJobCommandStep1.CompleteJobCommandStep2- Parameters:
priority- priority of the task- Returns:
- the builder for this command. Call
FinalCommandStep.send()to complete the command and send it to the broker.
-
resultDone
Description copied from interface:CompleteJobCommandStep1.CompleteJobCommandStep2Marks the completion of configuring the result of the job.This method is optional and can be used to indicate that the result configuration (such as corrections or denial) is complete. It allows calling methods unrelated to the job result.
Calling this method has no effect on the final command sent to the broker. It is provided for readability and organizational clarity in method chaining.
Example usage:
client.newCompleteJobCommand(jobKey) .withResult() .correctAssignee("john_doe") .resultDone() // explicitly marks the end of result configuration .variable("we_can", "still_set_vars") .send();- Specified by:
resultDonein interfaceCompleteJobCommandStep1.CompleteJobCommandStep2- Returns:
- the builder for this command. Call
FinalCommandStep.send()to complete the command and send it to the broker.
-
useRest
Description copied from interface:CommandWithCommunicationApiStepExperimental: This method is under development, and as such using it may have no effect on the command builder when called. While unimplemented, it simply returns the command builder instance unchanged. This method already exists for software that is building support for a REST API in Camunda, and already wants to use this API during its development. As support for REST is added to Camunda, each of the commands that implement this method may start to take effect. Until this warning is removed, anything described below may not yet have taken effect, and the interface and its description are subject to change.Sets 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 using
CamundaClientBuilder.preferRestOverGrpc(boolean).- Specified by:
useRestin interfaceCommandWithCommunicationApiStep<CompleteJobCommandStep1>- Returns:
- the configured command
-
useGrpc
Description copied from interface:CommandWithCommunicationApiStepExperimental: This method is under development, and as such using it may have no effect on the command builder when called. While unimplemented, it simply returns the command builder instance unchanged. This method already exists for software that is building support for a REST API in Camunda, and already wants to use this API during its development. As support for REST is added to Zeebe, each of the commands that implement this method may start to take effect. Until this warning is removed, anything described below may not yet have taken effect, and the interface and its description are subject to change.Sets 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 using
CamundaClientBuilder.preferRestOverGrpc(boolean).- Specified by:
useGrpcin interfaceCommandWithCommunicationApiStep<CompleteJobCommandStep1>- Returns:
- the configured command
-
setVariablesInternal
- Specified by:
setVariablesInternalin classCommandWithVariables<CompleteJobCommandStep1>
-