Search in sources :

Example 1 with ActionNotification

use of com.liferay.ide.kaleo.core.model.ActionNotification in project liferay-ide by liferay.

the class TaskNodeAddActionHandler method postDiagramNodePartAdded.

@Override
public void postDiagramNodePartAdded(NewNodeOp op, CanTransition newNodeFromWizard, CanTransition newNode) {
    Task newTask = newNode.nearest(Task.class);
    NewTaskNode newTaskFromWizard = newNodeFromWizard.nearest(NewTaskNode.class);
    KaleoModelUtil.changeTaskAssignments(newTask, op.nearest(AssignableOp.class));
    for (Action taskAction : newTaskFromWizard.getTaskActions()) {
        ElementList<Action> action = newTask.getTaskActions();
        Action insertAction = action.insert();
        insertAction.copy(taskAction);
    }
    for (INewTaskNotification taskNotification : newTaskFromWizard.getNewTaskNotifications()) {
        ActionNotification newTaskNotification = newTask.getTaskNotifications().insert();
        newTaskNotification.setName(taskNotification.getName().content());
        newTaskNotification.setExecutionType(taskNotification.getExecutionType().content());
        newTaskNotification.setTemplateLanguage(taskNotification.getTemplateLanguage().content());
    }
}
Also used : AssignableOp(com.liferay.ide.kaleo.core.op.AssignableOp) Task(com.liferay.ide.kaleo.core.model.Task) Action(com.liferay.ide.kaleo.core.model.Action) INewTaskNotification(com.liferay.ide.kaleo.core.op.NewTaskNode.INewTaskNotification) NewTaskNode(com.liferay.ide.kaleo.core.op.NewTaskNode) ActionNotification(com.liferay.ide.kaleo.core.model.ActionNotification)

Example 2 with ActionNotification

use of com.liferay.ide.kaleo.core.model.ActionNotification in project liferay-ide by liferay.

the class NotificationsDiagramNodeEditHandlerFactory method getNotifications.

protected List<ActionNotification> getNotifications() {
    ElementList<ActionNotification> notifications = null;
    ActionTimer actionTimer = getModelElement().nearest(ActionTimer.class);
    if (actionTimer != null) {
        notifications = actionTimer.getNotifications();
    }
    return notifications;
}
Also used : ActionTimer(com.liferay.ide.kaleo.core.model.ActionTimer) ActionNotification(com.liferay.ide.kaleo.core.model.ActionNotification)

Example 3 with ActionNotification

use of com.liferay.ide.kaleo.core.model.ActionNotification 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 4 with ActionNotification

use of com.liferay.ide.kaleo.core.model.ActionNotification in project liferay-ide by liferay.

the class WorkflowNodeAddHandlerFactory method create.

@Override
public List<SapphireActionHandler> create() {
    List<SapphireActionHandler> handlers = new ArrayList<>();
    if (getModelElement() instanceof Task) {
        Task task = getModelElement().nearest(Task.class);
        handlers.add(new SapphireActionHandler() {

            @Override
            public void init(SapphireAction action, ActionHandlerDef def) {
                super.init(action, def);
                addImage(Action.TYPE.image());
                setLabel("Task Action");
            }

            @Override
            protected Object run(Presentation context) {
                Action newAction = task.getTaskActions().insert();
                ActionsListAddActionHandler.addActionDefaults(newAction);
                return newAction;
            }
        });
        handlers.add(new SapphireActionHandler() {

            @Override
            public void init(SapphireAction action, ActionHandlerDef def) {
                super.init(action, def);
                addImage(ActionNotification.TYPE.image());
                setLabel("Task Notification");
            }

            @Override
            protected Object run(Presentation context) {
                ActionNotification newTaskNotificaction = task.getTaskNotifications().insert();
                NotificationsListAddActionHandler.addNotificationDefaults(newTaskNotificaction);
                return newTaskNotificaction;
            }
        });
    } else {
        ActionTimer actionTimer = getModelElement().nearest(ActionTimer.class);
        handlers.add(new SapphireActionHandler() {

            @Override
            public void init(SapphireAction action, ActionHandlerDef def) {
                super.init(action, def);
                addImage(Action.TYPE.image());
                setLabel("Action");
            }

            @Override
            protected Object run(Presentation context) {
                Action newAction = actionTimer.getActions().insert();
                ActionsListAddActionHandler.addActionDefaults(newAction);
                return newAction;
            }
        });
        handlers.add(new SapphireActionHandler() {

            @Override
            public void init(SapphireAction action, ActionHandlerDef def) {
                super.init(action, def);
                addImage(Notification.TYPE.image());
                setLabel("Notification");
            }

            @Override
            protected Object run(Presentation context) {
                ActionNotification newNotificaction = actionTimer.getNotifications().insert();
                NotificationsListAddActionHandler.addNotificationDefaults(newNotificaction);
                return newNotificaction;
            }
        });
    }
    return handlers;
}
Also used : ActionHandlerDef(org.eclipse.sapphire.ui.def.ActionHandlerDef) ActionTimer(com.liferay.ide.kaleo.core.model.ActionTimer) Task(com.liferay.ide.kaleo.core.model.Task) Action(com.liferay.ide.kaleo.core.model.Action) SapphireAction(org.eclipse.sapphire.ui.SapphireAction) SapphireAction(org.eclipse.sapphire.ui.SapphireAction) ArrayList(java.util.ArrayList) Presentation(org.eclipse.sapphire.ui.Presentation) SapphireActionHandler(org.eclipse.sapphire.ui.SapphireActionHandler) ActionNotification(com.liferay.ide.kaleo.core.model.ActionNotification)

Example 5 with ActionNotification

use of com.liferay.ide.kaleo.core.model.ActionNotification in project liferay-ide by liferay.

the class NotificationsListAddActionHandler method run.

@Override
protected Object run(Presentation context) {
    Element newElement = (Element) super.run(context);
    ActionNotification newNotification = newElement.nearest(ActionNotification.class);
    addNotificationDefaults(newNotification);
    return newNotification;
}
Also used : Element(org.eclipse.sapphire.Element) 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)7 Task (com.liferay.ide.kaleo.core.model.Task)4 ActionTimer (com.liferay.ide.kaleo.core.model.ActionTimer)3 TaskActionNotification (com.liferay.ide.kaleo.core.model.TaskActionNotification)3 Action (com.liferay.ide.kaleo.core.model.Action)2 Element (org.eclipse.sapphire.Element)2 Presentation (org.eclipse.sapphire.ui.Presentation)2 SapphireAction (org.eclipse.sapphire.ui.SapphireAction)2 SapphireActionHandler (org.eclipse.sapphire.ui.SapphireActionHandler)2 ActionHandlerDef (org.eclipse.sapphire.ui.def.ActionHandlerDef)2 Node (com.liferay.ide.kaleo.core.model.Node)1 Notification (com.liferay.ide.kaleo.core.model.Notification)1 NotificationTransport (com.liferay.ide.kaleo.core.model.NotificationTransport)1 AssignableOp (com.liferay.ide.kaleo.core.op.AssignableOp)1 NewTaskNode (com.liferay.ide.kaleo.core.op.NewTaskNode)1 INewTaskNotification (com.liferay.ide.kaleo.core.op.NewTaskNode.INewTaskNotification)1 ArrayList (java.util.ArrayList)1 Event (org.eclipse.sapphire.Event)1 PropertyEvent (org.eclipse.sapphire.PropertyEvent)1