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());
}
}
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;
}
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();
}
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;
}
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;
}
Aggregations