public Void execute(CommandContext commandContext) {
if(jobId == null && jobDefinitionId == null && processInstanceId == null && processDefinitionId == null && processDefinitionKey == null) {
throw new ProcessEngineException("Job id, job definition id, process instance id, process definition id nor process definition key cannot be null");
}
JobManager jobManager = commandContext.getJobManager();
SuspensionState suspensionState = getSuspensionState();
if (jobId != null) {
jobManager.updateJobSuspensionStateById(jobId, suspensionState);
} else
if (jobDefinitionId != null) {
jobManager.updateJobSuspensionStateByJobDefinitionId(jobDefinitionId, suspensionState);
} else
if (processInstanceId != null) {
jobManager.updateJobSuspensionStateByProcessInstanceId(processInstanceId, suspensionState);
} else
if (processDefinitionId != null) {
jobManager.updateJobSuspensionStateByProcessDefinitionId(processDefinitionId, suspensionState);
} else
if (processDefinitionKey != null) {
jobManager.updateJobSuspensionStateByProcessDefinitionKey(processDefinitionKey, suspensionState);
}
return null;
}