use of com.liferay.ide.kaleo.core.model.TaskActionNotification in project liferay-ide by liferay.
the class TaskNotificationsDiagramNodeEditHandlerFactory method getNotifications.
@Override
protected List<ActionNotification> getNotifications() {
ListFactory<ActionNotification> factory = ListFactory.start();
Task task = getModelElement().nearest(Task.class);
if (task != null) {
ElementList<TaskActionNotification> taskNotifiations = task.getTaskNotifications();
for (TaskActionNotification notification : taskNotifiations) {
factory.add(notification);
}
}
return factory.result();
}
use of com.liferay.ide.kaleo.core.model.TaskActionNotification in project liferay-ide by liferay.
the class NotificationsListAddActionHandler method addNotificationDefaults.
public static void addNotificationDefaults(ActionNotification newNotification) {
String defaultTemplateLanguage = KaleoModelUtil.getDefaultValue(newNotification, KaleoCore.DEFAULT_TEMPLATE_LANGUAGE_KEY, TemplateLanguageType.FREEMARKER);
Node[] nodes = new Node[0];
if (newNotification.nearest(Task.class) != null) {
Task task = newNotification.nearest(Task.class);
ElementList<TaskActionNotification> taskNotifications = task.getTaskNotifications();
nodes = taskNotifications.toArray(new Node[0]);
} else {
ActionTimer actionTimer = newNotification.nearest(ActionTimer.class);
ElementList<ActionNotification> actionNotifications = actionTimer.getNotifications();
nodes = actionNotifications.toArray(new Node[0]);
}
String newName = getDefaultName("newNotification1", newNotification, nodes);
newNotification.setName(newName);
newNotification.setTemplateLanguage(defaultTemplateLanguage);
newNotification.setExecutionType(Executable.DEFAULT_EXECUTION_TYPE);
if (newNotification.nearest(Task.class) != null) {
newNotification.setTemplate("/* specify task notification template */");
} else {
newNotification.setTemplate("/* specify notification template */");
}
ElementList<NotificationTransport> notificationTransports = newNotification.getNotificationTransports();
NotificationTransport insertTransport = notificationTransports.insert();
insertTransport.setNotificationTransport("email");
}
Aggregations