use of org.kie.internal.task.api.model.InternalI18NText in project jbpm by kiegroup.
the class DefaultChecklistManager method setTaskName.
private void setTaskName(InternalTask task, String name) {
List<I18NText> names = new ArrayList<I18NText>();
I18NText text = TaskModelProvider.getFactory().newI18NText();
((InternalI18NText) text).setLanguage("en-UK");
((InternalI18NText) text).setText(name);
names.add(text);
task.setNames(names);
List<I18NText> subjects = new ArrayList<I18NText>();
text = TaskModelProvider.getFactory().newI18NText();
((InternalI18NText) text).setLanguage("en-UK");
((InternalI18NText) text).setText(name);
subjects.add(text);
task.setSubjects(subjects);
}
use of org.kie.internal.task.api.model.InternalI18NText in project jbpm by kiegroup.
the class DefaultChecklistManager method updateTaskDescription.
public void updateTaskDescription(long taskId, String description) {
RuntimeEngine runtime = getRuntime();
List<I18NText> descriptions = new ArrayList<I18NText>();
I18NText text = TaskModelProvider.getFactory().newI18NText();
((InternalI18NText) text).setLanguage("en-UK");
((InternalI18NText) text).setText(description);
descriptions.add(text);
((InternalTaskService) runtime.getTaskService()).setDescriptions(taskId, descriptions);
manager.disposeRuntimeEngine(runtime);
}
use of org.kie.internal.task.api.model.InternalI18NText in project jbpm by kiegroup.
the class DefaultChecklistManager method updateTaskName.
public void updateTaskName(long taskId, String name) {
RuntimeEngine runtime = getRuntime();
List<I18NText> names = new ArrayList<I18NText>();
I18NText text = TaskModelProvider.getFactory().newI18NText();
((InternalI18NText) text).setLanguage("en-UK");
((InternalI18NText) text).setText(name);
names.add(text);
((InternalTaskService) runtime.getTaskService()).setTaskNames(taskId, names);
manager.disposeRuntimeEngine(runtime);
}
use of org.kie.internal.task.api.model.InternalI18NText in project jbpm by kiegroup.
the class UserTaskServiceImpl method setName.
@Override
public void setName(String deploymentId, Long taskId, String name) {
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(name);
List<I18NText> names = new ArrayList<I18NText>();
names.add(text);
TaskService taskService = engine.getTaskService();
// perform actual operation
((InternalTaskService) taskService).setTaskNames(taskId, names);
} finally {
disposeRuntimeEngine(manager, engine);
}
}
use of org.kie.internal.task.api.model.InternalI18NText in project jbpm by kiegroup.
the class UserTaskAdminServiceImpl method buildEmailNotification.
@Override
public EmailNotification buildEmailNotification(String subjectStr, List<OrganizationalEntity> recipients, String bodyStr, String fromStr, String replyToStr) {
EmailNotification emailNotification = TaskModelProvider.getFactory().newEmialNotification();
Map<Language, EmailNotificationHeader> emailHeaders = new HashMap<Language, EmailNotificationHeader>();
List<I18NText> subjects = new ArrayList<I18NText>();
List<I18NText> names = new ArrayList<I18NText>();
String locale = "en-UK";
EmailNotificationHeader emailHeader = TaskModelProvider.getFactory().newEmailNotificationHeader();
emailHeader.setBody(bodyStr);
emailHeader.setFrom(fromStr);
emailHeader.setReplyTo(replyToStr);
emailHeader.setLanguage(locale);
emailHeader.setSubject(subjectStr);
Language lang = TaskModelProvider.getFactory().newLanguage();
lang.setMapkey(locale);
emailHeaders.put(lang, emailHeader);
I18NText subject = TaskModelProvider.getFactory().newI18NText();
((InternalI18NText) subject).setLanguage(locale);
((InternalI18NText) subject).setText(emailHeader.getSubject());
;
subjects.add(subject);
names.add(subject);
emailNotification.setEmailHeaders(emailHeaders);
emailNotification.setNames(names);
emailNotification.setRecipients(new ArrayList<>(recipients));
emailNotification.setSubjects(subjects);
return emailNotification;
}
Aggregations