use of org.jbpm.services.api.model.UserTaskInstanceDesc 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.jbpm.services.api.model.UserTaskInstanceDesc 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.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.
the class UserTaskServiceImpl method updateTask.
@Override
public void updateTask(String deploymentId, Long taskId, String userId, UserTaskInstanceDesc userTask, Map<String, Object> inputData, Map<String, Object> outputData) {
UserTaskInstanceDesc task = dataService.getTaskById(taskId);
validateTask(deploymentId, taskId, task);
UpdateTaskCommand command = new UpdateTaskCommand(taskId, userId, userTask, inputData, outputData);
execute(task.getDeploymentId(), ProcessInstanceIdContext.get(task.getProcessInstanceId()), command);
}
use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.
the class UserTaskServiceImpl method getRuntimeManager.
protected RuntimeManager getRuntimeManager(String deploymentId, Command<?> command) {
if (deploymentId == null && command instanceof TaskCommand<?>) {
Long taskId = ((TaskCommand<?>) command).getTaskId();
if (taskId != null) {
UserTaskInstanceDesc task = dataService.getTaskById(taskId);
deploymentId = task.getDeploymentId();
}
}
RuntimeManager manager = deploymentService.getRuntimeManager(deploymentId);
if (manager == null) {
InternalTaskService internalTaskService = getInternalTaskService();
if (internalTaskService != null) {
manager = new FalbackRuntimeManager(internalTaskService);
} else {
logger.warn("Cannot find runtime manager for deployment {}", deploymentId);
throw new RuntimeException("No runtime manager found for deployment " + deploymentId);
}
}
return manager;
}
use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.
the class UserTaskServiceImpl method getCommentById.
@Override
public Comment getCommentById(String deploymentId, Long taskId, Long commentId) {
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 null;
}
RuntimeEngine engine = manager.getRuntimeEngine(ProcessInstanceIdContext.get(task.getProcessInstanceId()));
try {
TaskService taskService = engine.getTaskService();
// perform actual operation
return ((InternalTaskService) taskService).getCommentById(commentId);
} finally {
disposeRuntimeEngine(manager, engine);
}
}
Aggregations