Search in sources :

Example 1 with TaskActionNotification

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();
}
Also used : Task(com.liferay.ide.kaleo.core.model.Task) TaskActionNotification(com.liferay.ide.kaleo.core.model.TaskActionNotification) ActionNotification(com.liferay.ide.kaleo.core.model.ActionNotification) TaskActionNotification(com.liferay.ide.kaleo.core.model.TaskActionNotification)

Example 2 with TaskActionNotification

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");
}
Also used : ActionTimer(com.liferay.ide.kaleo.core.model.ActionTimer) NotificationTransport(com.liferay.ide.kaleo.core.model.NotificationTransport) Task(com.liferay.ide.kaleo.core.model.Task) Node(com.liferay.ide.kaleo.core.model.Node) TaskActionNotification(com.liferay.ide.kaleo.core.model.TaskActionNotification) ActionNotification(com.liferay.ide.kaleo.core.model.ActionNotification) TaskActionNotification(com.liferay.ide.kaleo.core.model.TaskActionNotification)

Aggregations

ActionNotification (com.liferay.ide.kaleo.core.model.ActionNotification)2 Task (com.liferay.ide.kaleo.core.model.Task)2 TaskActionNotification (com.liferay.ide.kaleo.core.model.TaskActionNotification)2 ActionTimer (com.liferay.ide.kaleo.core.model.ActionTimer)1 Node (com.liferay.ide.kaleo.core.model.Node)1 NotificationTransport (com.liferay.ide.kaleo.core.model.NotificationTransport)1