Interface CompleteJobCommandStep1.CompleteJobCommandStep2

All Superinterfaces:
FinalCommandStep<CompleteJobResponse>
All Known Implementing Classes:
CompleteJobCommandImpl
Enclosing interface:
CompleteJobCommandStep1

public static interface CompleteJobCommandStep1.CompleteJobCommandStep2 extends FinalCommandStep<CompleteJobResponse>
  • Method Details

    • deny

      Indicates 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 to false.

      Example usage:

      
       client.newCompleteJobCommand(jobKey)
           .withResult()
           .deny(true)
           .send();
       
      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.
    • deny

      CompleteJobCommandStep1.CompleteJobCommandStep2 deny(boolean isDenied, String deniedReason)
      Indicates whether the worker denies the work, i.e. explicitly doesn't approve it and provides the reason to deny. As a result, the completion request is rejected and the task remains active.

      Example usage:

      
       client.newCompleteJobCommand(jobKey)
           .withResult()
           .deny(true, "Reason to deny lifecycle transition")
           .send();
       
      Parameters:
      isDenied - indicates if the worker has denied the reason for the job
      deniedReason - indicates the reason why the worker denied the job
      Returns:
      the builder for this command. Call FinalCommandStep.send() to complete the command and send it to the broker.
    • deniedReason

      Indicates the reason why the worker denied the work. For example, a user task listener can deny the completion of a task by setting the deny flag to true and specifying the reason to deny. In this example, the completion of a task is represented by a job that the worker can complete as denied and provided the reason to deny. As a result, the completion request is rejected and the task remains active. Defaults to an empty string.

      Example usage:

      
       client.newCompleteJobCommand(jobKey)
           .withResult()
           .deny(true)
           .deniedReason("Reason to deny lifecycle transition")
           .send();
       
      Parameters:
      deniedReason - indicates the reason why the worker denied the job
      Returns:
      the builder for this command. Call FinalCommandStep.send() to complete the command and send it to the broker.
    • correct

      Applies 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();
       
      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

      Dynamically applies corrections to the user task attributes using a lambda expression.

      This method is a functional alternative to correct(JobResultCorrections). It allows the worker to modify key user task attributes (such as assignee, dueDate, priority, and so on) directly via a lambda expression. The lambda receives the current JobResultCorrections instance, which can be updated as needed. If no corrections have been set yet, a default JobResultCorrections instance 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();
       
      Parameters:
      corrections - a lambda expression to modify the JobResultCorrections.
      Returns:
      the builder for this command. Call FinalCommandStep.send() to complete the command and send it to the broker.
    • correctAssignee

      Correct the assignee of the task.
      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

      Correct the due date of the task.
      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

      CompleteJobCommandStep1.CompleteJobCommandStep2 correctFollowUpDate(String followUpDate)
      Correct the follow up date of the task.
      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

      CompleteJobCommandStep1.CompleteJobCommandStep2 correctCandidateUsers(List<String> candidateUsers)
      Correct the candidate users of the task.
      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

      CompleteJobCommandStep1.CompleteJobCommandStep2 correctCandidateGroups(List<String> candidateGroups)
      Correct the candidate groups of the task.
      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

      Correct the priority of the task.
      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

      Marks 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();
       
      Returns:
      the builder for this command. Call FinalCommandStep.send() to complete the command and send it to the broker.