Class AbstractSetTaskPropertyCmd<T>

java.lang.Object
org.camunda.bpm.engine.impl.cmd.AbstractSetTaskPropertyCmd<T>
Type Parameters:
T - the type of the value to set by this command
All Implemented Interfaces:
Serializable, Command<Void>
Direct Known Subclasses:
AbstractAddIdentityLinkCmd, SetTaskDescriptionCmd, SetTaskDueDateCmd, SetTaskFollowUpDateCmd, SetTaskNameCmd, SetTaskPriorityCmd

public abstract class AbstractSetTaskPropertyCmd<T> extends Object implements Command<Void>, Serializable
Abstract command class, meant to encapsulate boilerplate logic for concrete commands that wish to set a property on a task and inherit authorization, multi-tenancy
See Also:
  • Field Details

    • taskId

      protected final String taskId
    • value

      protected final T value
  • Constructor Details

    • AbstractSetTaskPropertyCmd

      public AbstractSetTaskPropertyCmd(String taskId, T value)
      Constructor of Commands that wish to set a property to a given task.
      Parameters:
      taskId - the id of the task whose property should be changed
      value - the new value to set to the referenced task
      Throws:
      NullValueException - in case the given taskId or the given value are null
      NotFoundException - in case the referenced task does not exist
    • AbstractSetTaskPropertyCmd

      protected AbstractSetTaskPropertyCmd(String taskId, T value, boolean skipValueValidation)
      Constructor with parameterized validation for the given input. Used by implementations that wish to avoid validation e.g SetTaskPriorityCmd.
      Parameters:
      taskId - the id of the task whose property should be changed
      value - the new value to set to the referenced task
      skipValueValidation - if true, the validation of the value will be excluded
  • Method Details

    • execute

      public Void execute(CommandContext context)
      Executes this command against the command context to perform the set-operation.
      Specified by:
      execute in interface Command<T>
      Parameters:
      context - the command context
      Throws:
      NotFoundException - in case the referenced task does not exist
    • logOperation

      protected void logOperation(CommandContext context, TaskEntity task)
    • validateAndGet

      protected TaskEntity validateAndGet(String taskId, CommandContext context)
      Validates the given taskId against to verify it references an existing task before returning the task.
      Parameters:
      taskId - the given taskId, non-null
      context - the context, non-null
      Returns:
      the corresponding task entity
    • checkTaskAgainstContext

      protected void checkTaskAgainstContext(TaskEntity task, CommandContext context)
      Perform multi-tenancy & authorization checks on the given task against the given command context.
      Parameters:
      task - the given task
      context - the given command context to check against
    • getUserOperationLogName

      protected abstract String getUserOperationLogName()
      Returns the User Operation Log name that corresponds to this command. Meant to be implemented by concretions.
      Returns:
      the user operation log name
    • executeSetOperation

      protected abstract void executeSetOperation(TaskEntity task, T value)
      Executes the set operation of the concrete command.
      Parameters:
      task - the task entity on which to set a property
      value - the value to se
    • ensureNotNullAndGet

      protected <T> T ensureNotNullAndGet(String variableName, T value)
      Ensures the value is not null and returns the value.
      Type Parameters:
      T - the type of the value
      Parameters:
      value - the value
      Returns:
      the value
      Throws:
      NullValueException - in case the given value is null