Class AbstractSetTaskPropertyCmd<T>

    • Field Detail

      • taskId

        protected final String taskId
      • value

        protected final T value
    • Constructor Detail

      • 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 excludeInputValidation)
        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
        excludeInputValidation - if true, the validation of the input will be excluded
    • Method Detail

      • 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
      • 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