use of com.liferay.ide.kaleo.core.model.NotificationTransport 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");
}
use of com.liferay.ide.kaleo.core.model.NotificationTransport in project liferay-ide by liferay.
the class NotificationTypesDerivedValueService method compute.
@Override
protected String compute() {
StringBuilder data = new StringBuilder();
List<NotificationTransport> transports = context(Notification.class).getNotificationTransports();
for (NotificationTransport transport : transports) {
if (data.length() != 0) {
data.append(',');
}
data.append(transport.getNotificationTransport().content());
}
return data.toString();
}
Aggregations