Package org.camunda.bpm.engine.impl.cmd
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:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description AbstractSetTaskPropertyCmd(String taskId, T value)Constructor of Commands that wish to set a property to a given task.protectedAbstractSetTaskPropertyCmd(String taskId, T value, boolean excludeInputValidation)Constructor with parameterized validation for the given input.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcheckTaskAgainstContext(TaskEntity task, CommandContext context)Perform multi-tenancy & authorization checks on the given task against the given command context.protected <T> TensureNotNullAndGet(String variableName, T value)Ensures the value is not null and returns the value.Voidexecute(CommandContext context)Executes this command against the command context to perform the set-operation.protected abstract voidexecuteSetOperation(TaskEntity task, T value)Executes the set operation of the concrete command.protected abstract StringgetUserOperationLogName()Returns the User Operation Log name that corresponds to this command.protected voidlogOperation(CommandContext context, TaskEntity task)protected TaskEntityvalidateAndGet(String taskId, CommandContext context)Validates the given taskId against to verify it references an existing task before returning the task.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.camunda.bpm.engine.impl.interceptor.Command
isRetryable
-
-
-
-
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 changedvalue- the new value to set to the referenced task- Throws:
NullValueException- in case the given taskId or the given value are nullNotFoundException- 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.gSetTaskPriorityCmd.- Parameters:
taskId- the id of the task whose property should be changedvalue- the new value to set to the referenced taskexcludeInputValidation- 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:
executein interfaceCommand<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-nullcontext- 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 taskcontext- 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 propertyvalue- 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
-
-