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:
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionAbstractSetTaskPropertyCmd
(String taskId, T value) Constructor of Commands that wish to set a property to a given task.protected
AbstractSetTaskPropertyCmd
(String taskId, T value, boolean skipValueValidation) Constructor with parameterized validation for the given input. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkTaskAgainstContext
(TaskEntity task, CommandContext context) Perform multi-tenancy & authorization checks on the given task against the given command context.protected <T> T
ensureNotNullAndGet
(String variableName, T value) Ensures the value is not null and returns the value.execute
(CommandContext context) Executes this command against the command context to perform the set-operation.protected abstract void
executeSetOperation
(TaskEntity task, T value) Executes the set operation of the concrete command.protected abstract String
Returns the User Operation Log name that corresponds to this command.protected void
logOperation
(CommandContext context, TaskEntity task) protected TaskEntity
validateAndGet
(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
-
Field Details
-
taskId
-
value
-
-
Constructor Details
-
AbstractSetTaskPropertyCmd
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
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 taskskipValueValidation
- if true, the validation of the value will be excluded
-
-
Method Details
-
execute
Executes this command against the command context to perform the set-operation.- Specified by:
execute
in interfaceCommand<T>
- Parameters:
context
- the command context- Throws:
NotFoundException
- in case the referenced task does not exist
-
logOperation
-
validateAndGet
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
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
Returns the User Operation Log name that corresponds to this command. Meant to be implemented by concretions.- Returns:
- the user operation log name
-
executeSetOperation
Executes the set operation of the concrete command.- Parameters:
task
- the task entity on which to set a propertyvalue
- the value to se
-
ensureNotNullAndGet
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
-