use of com.axelor.team.db.TeamTask in project axelor-open-suite by axelor.
the class WkfUserActionServiceImpl method createUserAction.
@Override
@Transactional
public void createUserAction(WkfTaskConfig wkfTaskConfig, DelegateExecution execution) {
String title = wkfTaskConfig.getTaskEmailTitle();
if (title == null) {
return;
}
try {
FullContext wkfContext = getModelCtx(wkfTaskConfig, execution);
if (wkfContext != null) {
title = processTitle(title, wkfContext);
}
TeamTask teamTask = new TeamTask(title);
teamTask.setStatus("new");
if (wkfTaskConfig.getDeadlineFieldPath() != null) {
teamTask.setTaskDate(getDeadLineDate(wkfTaskConfig.getDeadlineFieldPath(), wkfContext));
}
if (teamTask.getTaskDate() == null) {
teamTask.setTaskDate(LocalDate.now());
}
String userPath = getUserPath(wkfTaskConfig, execution.getProcessDefinitionId());
if (userPath != null) {
teamTask.setAssignedTo(getUser(userPath, wkfContext));
}
String url = Beans.get(WkfEmailService.class).createUrl(wkfContext, wkfTaskConfig.getDefaultForm());
teamTask.setDescription(String.format(DESCRIPTION, execution.getCurrentActivityName(), url, url));
teamTaskRepository.save(teamTask);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
Aggregations