Interface CompleteJobCommandStep1

All Superinterfaces:
CommandWithCommunicationApiStep<CompleteJobCommandStep1>, FinalCommandStep<CompleteJobResponse>
All Known Implementing Classes:
CompleteJobCommandImpl

  • Method Details

    • variables

      CompleteJobCommandStep1 variables(InputStream variables)
      Set the variables to complete the job with.
      Parameters:
      variables - the variables (JSON) as stream
      Returns:
      the builder for this command. Call FinalCommandStep.send() to complete the command and send it to the broker.
    • variables

      CompleteJobCommandStep1 variables(String variables)
      Set the variables to complete the job with.
      Parameters:
      variables - the variables (JSON) as String
      Returns:
      the builder for this command. Call FinalCommandStep.send() to complete the command and send it to the broker.
    • variables

      CompleteJobCommandStep1 variables(Map<String,Object> variables)
      Set the variables to complete the job with.
      Parameters:
      variables - the variables as map
      Returns:
      the builder for this command. Call FinalCommandStep.send() to complete the command and send it to the broker.
    • variables

      CompleteJobCommandStep1 variables(Object variables)
      Set the variables to complete the job with.
      Parameters:
      variables - the variables as object
      Returns:
      the builder for this command. Call FinalCommandStep.send() to complete the command and send it to the broker.
    • variable

      CompleteJobCommandStep1 variable(String key, Object value)
      Set a single variable to complete the job with.
      Parameters:
      key - the key of the variable as string
      value - the value of the variable as object
      Returns:
      the builder for this command. Call FinalCommandStep.send() to complete the command and send it to the broker.
    • withResult

      Initializes 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();
       
      Returns:
      the builder for this command.
    • withResult

      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.

      The CompleteJobResult object 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();
       
      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.
    • withResult

      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.

      This is a convenience method for withResult(CompleteJobResult), allowing modifications to be applied directly via a functional interface rather than constructing the CompleteJobResult manually, 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 default CompleteJobResult is provided for modification.

      
       client.newCompleteJobCommand(jobKey)
           .withResult(r -> r.deny(true))
           .send();
       
      Parameters:
      jobResultModifier - a function to modify the CompleteJobResult.
      Returns:
      the builder for this command. Call FinalCommandStep.send() to finalize the command and send it to the broker.