use of org.kie.api.task.TaskService in project jbpm by kiegroup.
the class UserTaskServiceImpl method suspend.
@Override
public void suspend(String deploymentId, Long taskId, String userId) {
UserTaskInstanceDesc task = dataService.getTaskById(taskId);
validateTask(deploymentId, taskId, task);
RuntimeManager manager = getRuntimeManager(task);
if (manager == null) {
logger.warn("Cannot find runtime manager for task {}", taskId);
return;
}
RuntimeEngine engine = manager.getRuntimeEngine(ProcessInstanceIdContext.get(task.getProcessInstanceId()));
try {
TaskService taskService = engine.getTaskService();
// perform actual operation
taskService.suspend(taskId, userId);
} catch (PermissionDeniedException e) {
throw new TaskNotFoundException(e.getMessage());
} finally {
disposeRuntimeEngine(manager, engine);
}
}
use of org.kie.api.task.TaskService in project jbpm by kiegroup.
the class UserTaskServiceImpl method delegate.
@Override
public void delegate(String deploymentId, Long taskId, String userId, String targetUserId) {
UserTaskInstanceDesc task = dataService.getTaskById(taskId);
validateTask(deploymentId, taskId, task);
RuntimeManager manager = getRuntimeManager(task);
if (manager == null) {
logger.warn("Cannot find runtime manager for task {}", taskId);
return;
}
RuntimeEngine engine = manager.getRuntimeEngine(ProcessInstanceIdContext.get(task.getProcessInstanceId()));
try {
TaskService taskService = engine.getTaskService();
// perform actual operation
taskService.delegate(taskId, userId, targetUserId);
} catch (PermissionDeniedException e) {
throw new TaskNotFoundException(e.getMessage());
} finally {
disposeRuntimeEngine(manager, engine);
}
}
use of org.kie.api.task.TaskService in project jbpm by kiegroup.
the class UserTaskServiceImpl method getCommentsByTaskId.
@Override
public List<Comment> getCommentsByTaskId(String deploymentId, Long taskId) {
UserTaskInstanceDesc task = dataService.getTaskById(taskId);
validateTask(deploymentId, taskId, task);
RuntimeManager manager = getRuntimeManager(task);
if (manager == null) {
logger.warn("Cannot find runtime manager for task {}", taskId);
return Collections.emptyList();
}
RuntimeEngine engine = manager.getRuntimeEngine(ProcessInstanceIdContext.get(task.getProcessInstanceId()));
try {
TaskService taskService = engine.getTaskService();
// perform actual operation
return ((InternalTaskService) taskService).getAllCommentsByTaskId(taskId);
} finally {
disposeRuntimeEngine(manager, engine);
}
}
use of org.kie.api.task.TaskService in project jbpm by kiegroup.
the class UserTaskServiceImpl method nominate.
@Override
public void nominate(String deploymentId, Long taskId, String userId, List<OrganizationalEntity> potentialOwners) {
UserTaskInstanceDesc task = dataService.getTaskById(taskId);
validateTask(deploymentId, taskId, task);
RuntimeManager manager = getRuntimeManager(task);
if (manager == null) {
logger.warn("Cannot find runtime manager for task {}", taskId);
return;
}
RuntimeEngine engine = manager.getRuntimeEngine(ProcessInstanceIdContext.get(task.getProcessInstanceId()));
try {
TaskService taskService = engine.getTaskService();
// perform actual operation
taskService.nominate(taskId, userId, potentialOwners);
} catch (PermissionDeniedException e) {
throw new TaskNotFoundException(e.getMessage());
} finally {
disposeRuntimeEngine(manager, engine);
}
}
use of org.kie.api.task.TaskService in project jbpm by kiegroup.
the class UserTaskServiceImpl method execute.
@Override
public <T> T execute(String deploymentId, Command<T> command) {
Long processInstanceId = CommonUtils.getProcessInstanceId(command);
RuntimeManager manager = getRuntimeManager(deploymentId, command);
RuntimeEngine engine = manager.getRuntimeEngine(ProcessInstanceIdContext.get(processInstanceId));
try {
TaskService taskService = engine.getTaskService();
// perform actual operation
return taskService.execute(command);
} finally {
disposeRuntimeEngine(manager, engine);
}
}
Aggregations