use of org.kie.internal.task.api.InternalTaskService in project jbpm by kiegroup.
the class UserTaskServiceImpl method setDescription.
@Override
public void setDescription(String deploymentId, Long taskId, String description) {
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 {
InternalI18NText text = (InternalI18NText) TaskModelProvider.getFactory().newI18NText();
text.setLanguage("en-UK");
text.setText(description);
List<I18NText> names = new ArrayList<I18NText>();
names.add(text);
TaskService taskService = engine.getTaskService();
// perform actual operation
((InternalTaskService) taskService).setDescriptions(taskId, names);
} finally {
disposeRuntimeEngine(manager, engine);
}
}
use of org.kie.internal.task.api.InternalTaskService in project jbpm by kiegroup.
the class UserTaskServiceImpl method setExpirationDate.
@Override
public void setExpirationDate(String deploymentId, Long taskId, Date date) {
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
((InternalTaskService) taskService).setExpirationDate(taskId, date);
} finally {
disposeRuntimeEngine(manager, engine);
}
}
use of org.kie.internal.task.api.InternalTaskService in project jbpm by kiegroup.
the class UserTaskServiceImpl method saveContent.
@Override
public Long saveContent(String deploymentId, Long taskId, Map<String, Object> values) {
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;
}
if (manager instanceof InternalRuntimeManager) {
values = process(values, ((InternalRuntimeManager) manager).getEnvironment().getClassLoader());
}
RuntimeEngine engine = manager.getRuntimeEngine(ProcessInstanceIdContext.get(task.getProcessInstanceId()));
try {
TaskService taskService = engine.getTaskService();
// perform actual operation
return ((InternalTaskService) taskService).addContent(taskId, (Map<String, Object>) values);
} finally {
disposeRuntimeEngine(manager, engine);
}
}
use of org.kie.internal.task.api.InternalTaskService in project jbpm by kiegroup.
the class UserTaskServiceImpl method deleteContent.
@Override
public void deleteContent(String deploymentId, Long taskId, Long contentId) {
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
((InternalTaskService) taskService).deleteContent(taskId, contentId);
} finally {
disposeRuntimeEngine(manager, engine);
}
}
Aggregations