use of org.camunda.bpm.engine.impl.persistence.entity.TaskManager in project camunda-bpm-platform by camunda.
the class SetTaskPriorityCmd method execute.
public Void execute(CommandContext commandContext) {
ensureNotNull("taskId", taskId);
TaskManager taskManager = commandContext.getTaskManager();
TaskEntity task = taskManager.findTaskById(taskId);
ensureNotNull("Cannot find task with id " + taskId, "task", task);
checkTaskPriority(task, commandContext);
task.setPriority(priority);
task.createHistoricTaskDetails(UserOperationLogEntry.OPERATION_TYPE_SET_PRIORITY);
return null;
}
use of org.camunda.bpm.engine.impl.persistence.entity.TaskManager in project camunda-bpm-platform by camunda.
the class GetTaskFormCmd method execute.
public TaskFormData execute(CommandContext commandContext) {
TaskManager taskManager = commandContext.getTaskManager();
TaskEntity task = taskManager.findTaskById(taskId);
ensureNotNull("No task found for taskId '" + taskId + "'", "task", task);
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkReadTask(task);
}
if (task.getTaskDefinition() != null) {
TaskFormHandler taskFormHandler = task.getTaskDefinition().getTaskFormHandler();
ensureNotNull("No taskFormHandler specified for task '" + taskId + "'", "taskFormHandler", taskFormHandler);
return taskFormHandler.createTaskForm(task);
} else {
// Standalone task, no TaskFormData available
return null;
}
}
use of org.camunda.bpm.engine.impl.persistence.entity.TaskManager in project camunda-bpm-platform by camunda.
the class GetIdentityLinksForTaskCmd method execute.
@SuppressWarnings({ "unchecked", "rawtypes" })
public List<IdentityLink> execute(CommandContext commandContext) {
ensureNotNull("taskId", taskId);
TaskManager taskManager = commandContext.getTaskManager();
TaskEntity task = taskManager.findTaskById(taskId);
ensureNotNull("Cannot find task with id " + taskId, "task", task);
checkGetIdentityLink(task, commandContext);
List<IdentityLink> identityLinks = (List) task.getIdentityLinks();
// and of course this leads to exception while trying to delete a non-existing identityLink
if (task.getAssignee() != null) {
IdentityLinkEntity identityLink = new IdentityLinkEntity();
identityLink.setUserId(task.getAssignee());
identityLink.setTask(task);
identityLink.setType(IdentityLinkType.ASSIGNEE);
identityLinks.add(identityLink);
}
if (task.getOwner() != null) {
IdentityLinkEntity identityLink = new IdentityLinkEntity();
identityLink.setUserId(task.getOwner());
identityLink.setTask(task);
identityLink.setType(IdentityLinkType.OWNER);
identityLinks.add(identityLink);
}
return (List) task.getIdentityLinks();
}
use of org.camunda.bpm.engine.impl.persistence.entity.TaskManager in project camunda-bpm-platform by camunda.
the class DeleteIdentityLinkCmd method execute.
public Void execute(CommandContext commandContext) {
ensureNotNull("taskId", taskId);
TaskManager taskManager = commandContext.getTaskManager();
task = taskManager.findTaskById(taskId);
ensureNotNull("Cannot find task with id " + taskId, "task", task);
checkDeleteIdentityLink(task, commandContext);
if (IdentityLinkType.ASSIGNEE.equals(type)) {
task.setAssignee(null);
} else if (IdentityLinkType.OWNER.equals(type)) {
task.setOwner(null);
} else {
task.deleteIdentityLink(userId, groupId, type);
}
return null;
}
use of org.camunda.bpm.engine.impl.persistence.entity.TaskManager in project camunda-bpm-platform by camunda.
the class AddIdentityLinkCmd method execute.
public Void execute(CommandContext commandContext) {
ensureNotNull("taskId", taskId);
TaskManager taskManager = commandContext.getTaskManager();
task = taskManager.findTaskById(taskId);
EnsureUtil.ensureNotNull("Cannot find task with id " + taskId, "task", task);
checkAddIdentityLink(task, commandContext);
if (IdentityLinkType.ASSIGNEE.equals(type)) {
task.setAssignee(userId);
} else if (IdentityLinkType.OWNER.equals(type)) {
task.setOwner(userId);
} else {
task.addIdentityLink(userId, groupId, type);
}
return null;
}
Aggregations