Package org.rhq.core.domain.alert.notification

Examples of org.rhq.core.domain.alert.notification.AlertNotification


        }

        // copy notifications
        List<AlertNotification> copiedNotifications = new ArrayList<AlertNotification>();
        for (AlertNotification oldNotification : alertDef.getAlertNotifications()) {
            AlertNotification newNotification = new AlertNotification(oldNotification);
            newNotification.setAlertDefinition(this);
            copiedNotifications.add(newNotification);
        }
        this.removeAllAlertNotifications();
        this.getAlertNotifications().addAll(copiedNotifications);
    }
View Full Code Here


        setFields(formItems.toArray(new FormItem[formItems.size()]));
    };

    private void saveNewNotification() {
        AlertNotification notif;

        if (notificationToEdit == null) {
            // we are adding a new notification - we just add it to the end of the list
            String selectedSender = notificationSenderSelectItem.getValue().toString();
            notif = new AlertNotification(selectedSender);
            notif.setAlertDefinition(alertDefinition);
            notifications.add(notif);
        } else {
            notif = notificationToEdit;
        }

        AbstractNotificationSenderForm senderForm = (AbstractNotificationSenderForm) senderCanvasItem.getCanvas();
        notif.setConfiguration(senderForm.getConfiguration());
        notif.setExtraConfiguration(senderForm.getExtraConfiguration());
    }
View Full Code Here

        AlertSenderPluginManager pluginmanager = alertManager.getAlertPluginManager();
        CustomAlertSenderBackingBean bean = pluginmanager.getBackingBeanForSender(shortName);

        if (alertNotificationId != null) {
            AlertNotification notification = entityManager.find(AlertNotification.class, alertNotificationId);
            if (notification != null && bean != null) {
                bean.setAlertParameters(notification.getConfiguration().deepCopy(true));
                if (notification.getExtraConfiguration() != null) {
                    bean.setExtraParameters(notification.getExtraConfiguration().deepCopy(true));
                }
            }
        }
        return bean;
    }
View Full Code Here

        return notifications;
    }

    public AlertNotification getAlertNotification(Subject user, int alertNotificationId) {
        AlertNotification notification = entityManager.find(AlertNotification.class, alertNotificationId);
        if (notification == null) {
            return null;
        }
        notification.getConfiguration().getProperties().size(); // eager load the alert properties
        if (notification.getExtraConfiguration() != null) {
            notification.getExtraConfiguration().getProperties().size(); // eager load the extra alert properties
        }
        return notification;
    }
View Full Code Here

                    .<AlertNotification> emptyList() : persistedAlertDefinition.getAlertNotifications();

                if (persistedNotifications.size() > 0) {
                    Iterator<AlertNotification> it = notifications.iterator();
                    while (it.hasNext()) {
                        AlertNotification newNotification = it.next();

                        if (newNotification.getId() == 0) {
                            //this is a fresh, not persisted notif. These guys have to be always finalized.
                            continue;
                        }

                        for (AlertNotification persistedNotification : persistedNotifications) {
                            //ignore the ids on the notifications as they may vary if we are comparing parent alert def with its children
                            //it's enough for us they they are semantically the same.
                            if (newNotification.getSenderName().equals(persistedNotification.getSenderName())
                                && newNotification.equalsData(persistedNotification)) {
                                it.remove();
                                break;
                            }
                        }
                    }
View Full Code Here

                newSenderConfig = configDefinition.getDefaultTemplate().createConfiguration();
            } else {
                newSenderConfig = new Configuration();
            }

            AlertNotification newNotification = new AlertNotification(this.selectedNewSender, newSenderConfig);

            AlertNotification newlyCreated = this.alertNotificationManager.addAlertNotification(getSubject(),
                this.contextId, newNotification);

            reloadAlertNotifications();
            this.activeNotification = newlyCreated;
            this.selectedNotifications.clear();
View Full Code Here

    public void init() {
        if (alertNotificationId == null) {
            return;
        }

        AlertNotification activeNotification = alertNotificationManager.getAlertNotification(getSubject(),
            alertNotificationId);
        if (activeNotification == null) {
            return; // this was just removed on the previous request
        }
        String senderName = activeNotification.getSenderName();

        AlertSenderInfo info = alertNotificationManager.getAlertInfoForSender(senderName);

        if (info != null && info.getUiSnippetUrl() != null) {
            this.contentUrl = info.getUiSnippetUrl().toString();
View Full Code Here

    public String saveConfiguration() {
        try {
            customBackingBean.saveView();

            int notificationId = customBackingBean.getAlertNotificationId();
            AlertNotification notification = alertNotificationManager
                .getAlertNotification(getSubject(), notificationId);

            if (customBackingBean.getExtraParameters() != null) {
                notification.setExtraConfiguration(customBackingBean.getExtraParameters());
            } else {
                notification.setExtraConfiguration(null);
            }
            int alertDefinitionId = Integer.parseInt(customBackingBean.getContextId());
            alertNotificationManager.updateAlertNotification(getSubject(), alertDefinitionId, notification);

            //            AlertNotificationsUIBean notificationsUIBean = (AlertNotificationsUIBean) Contexts
View Full Code Here

        assertEquals("Failed to find the previously created resource level alert definition.", 1, foundDefs.size());

        AlertDefinition foundDef = foundDefs.get(0);

        AlertNotification newNotif = createAlertNotificationForTest(foundDef, false);

        adm.updateAlertDefinition(subject, resourceLevelAlertDefinitionId, foundDef, false);

        assertEquals("Validation should have been called for a new notification during alert def update", 1,
            TestAlertSender.getValidateMethodCallCount());
View Full Code Here

        assertEquals("Failed to find the previously created group level alert definition.", 1, foundDefs.size());

        AlertDefinition foundDef = foundDefs.get(0);

        AlertNotification newNotif = createAlertNotificationForTest(foundDef, false);

        GroupAlertDefinitionManagerLocal gadm = LookupUtil.getGroupAlertDefinitionManager();
        gadm.updateGroupAlertDefinitions(subject, foundDef, true);

        //notice that the validation should be called just once, even though in effect we're creating 11 notifs
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.alert.notification.AlertNotification

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.