Examples of AlertDefinitionManagerLocal


Examples of org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal

        alertDefinition.setAlertDampening(new AlertDampening(AlertDampening.Category.NONE));
        alertDefinition.setConditions(Collections.singleton(cond));
        alertDefinition.setEnabled(true);
        alertDefinition.setConditionExpression(BooleanExpression.ALL);

        AlertDefinitionManagerLocal alertDefinitionManager = LookupUtil.getAlertDefinitionManager();
        //needs to be done outside of the above transaction, so that the createAlert... method can "see" the resource.
        alertDefinitionManager.createAlertDefinitionInNewTransaction(getOverlord(), alertDefinition, resource.getId(), true);

        //obvious, right? This needs to be done for the alert subsystem to become aware of the new def
        LookupUtil.getAlertConditionCacheManager().reloadAllCaches();
    }
View Full Code Here

Examples of org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal

            System.out.println("Deleted [" + i + "] schedules with id [" + ms.getId() + "]");
        }
    }

    private void deleteAlertDefinitions(Collection<AlertDefinition> defs) {
        AlertDefinitionManagerLocal alertDefinitionManager = LookupUtil.getAlertDefinitionManager();

        int[] ids = new int[defs.size()];
        int i = 0;
        for(AlertDefinition def : defs) {
            ids[i++] = def.getId();

            LookupUtil.getAlertManager()
                .deleteAlertsByContext(getOverlord(), EntityContext.forResource(def.getResource().getId()));
        }

        alertDefinitionManager.removeAlertDefinitions(getOverlord(), ids);

        alertDefinitionManager.purgeUnusedAlertDefinitions();
        for(i = 0; i < ids.length; ++i) {
            alertDefinitionManager.purgeInternals(ids[i]);
        }
    }
View Full Code Here

Examples of org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal

        return ret;
    }

    private List<AlertDefinition> getAlertDefinitionsWithCliNotifications(Collection<Integer> alertDefIds) {
        SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
        AlertDefinitionManagerLocal manager = LookupUtil.getAlertDefinitionManager();

        Subject overlord = subjectManager.getOverlord();

        AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
        criteria.addFilterNotificationNames(pluginName);
        criteria.setPageControl(PageControl.getUnlimitedInstance());
        criteria.fetchAlertNotifications(true);
        if (alertDefIds != null) {
            criteria.addFilterIds(alertDefIds.toArray(new Integer[alertDefIds.size()]));
        }

        return manager.findAlertDefinitionsByCriteria(overlord, criteria);
    }
View Full Code Here

Examples of org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal

        StringBuffer textValue = new StringBuffer();

        // first format the LHS of the operator
        if (category == AlertConditionCategory.CONTROL) {
            try {
                AlertDefinitionManagerLocal alertDefinitionManager = LookupUtil.getAlertDefinitionManager();
                Integer alertDefinitionId = cond.getAlertDefinition().getId();
                Integer resourceTypeId = null;
                if (alertDefinitionManager.isTemplate(alertDefinitionId)) {
                    resourceTypeId = cond.getAlertDefinition().getResourceType().getId();
                } else if (alertDefinitionManager.isGroupAlertDefinition(alertDefinitionId)) {
                    resourceTypeId = cond.getAlertDefinition().getGroup().getResourceType().getId();
                } else {
                    resourceTypeId = cond.getAlertDefinition().getResource().getResourceType().getId();
                }
View Full Code Here

Examples of org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal

    public static String getAlertRecoveryInfo(Alert alert, int resourceId) {
        Subject subject = EnterpriseFacesContextUtility.getSubject();

        if (alert.getRecoveryId() != 0) {
            Integer recoveryAlertId = alert.getRecoveryId();
            AlertDefinitionManagerLocal alertDefinitionManagerLocal = LookupUtil.getAlertDefinitionManager();
            AlertDefinition recoveryAlertDefinition = alertDefinitionManagerLocal.getAlertDefinitionById(subject,
                recoveryAlertId);
            //return recoveryAlertDefinition.getName();
            return "Triggered '<a href=\"/alerts/Config.do?mode=viewRoles&id=" + resourceId + "&ad" + recoveryAlertId
                + "\">" + recoveryAlertDefinition.getName() + "</a>' to be re-enabled";
        }
View Full Code Here

Examples of org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal

    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {

        Subject subject = RequestUtils.getSubject(request);
        AlertDefinitionManagerLocal alertDefinitionManager = LookupUtil.getAlertDefinitionManager();

        Map<String, Object> params = new HashMap<String, Object>(4);
        // pass-through the alertId and resource id
        Integer alertId = new Integer(request.getParameter("a"));
        request.setAttribute("a", alertId);
        params.put("a", alertId);

        Integer alertDefId = new Integer(request.getParameter("ad"));
        request.setAttribute("ad", alertDefId);
        params.put("ad", alertDefId);

        Integer resourceId = new Integer(request.getParameter("id"));
        request.setAttribute("id", resourceId);
        params.put("id", resourceId);

        String mode = request.getParameter("mode");
        request.setAttribute("mode", mode);
        params.put("mode", mode);

        alertDefinitionManager.enableAlertDefinitions(subject, new int[] { alertDefId });

        log.debug("Reenabled Alert definition with id " + alertId + " and user " + subject.getName());

        return returnSuccess(request, mapping, params);
    }
View Full Code Here

Examples of org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal

        try {
            if (context == FormContext.Type) {
                AlertTemplateManagerLocal alertTemplateManager = LookupUtil.getAlertTemplateManager();
                alertDefinitionId = alertTemplateManager.createAlertTemplate(subject, alertDef, defForm.getType());
            } else if (context == FormContext.Resource) {
                AlertDefinitionManagerLocal alertDefinitionManager = LookupUtil.getAlertDefinitionManager();
                AlertDefinition alertDefinition = alertDefinitionManager.createAlertDefinitionInNewTransaction(subject,
                    alertDef, defForm.getId(), true);
                alertDefinitionId = alertDefinition.getId();
            } else if (context == FormContext.Group) {
                GroupAlertDefinitionManagerLocal groupAlertDefinitionManager = LookupUtil
                    .getGroupAlertDefinitionManager();
View Full Code Here

Examples of org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal

        try {
            if (context == FormContext.Type) {
                AlertTemplateManagerLocal alertTemplateManager = LookupUtil.getAlertTemplateManager();
                alertTemplateManager.updateAlertTemplate(subject, alertDef, false);
            } else if (context == FormContext.Resource) {
                AlertDefinitionManagerLocal alertDefinitionManager = LookupUtil.getAlertDefinitionManager();
                // this will disallow updates if the alert definition has been deleted
                alertDef.setReadOnly(defForm.isReadOnly());
                alertDefinitionManager.updateAlertDefinition(subject, alertDef.getId(), alertDef, false);
            } else if (context == FormContext.Group) {
                GroupAlertDefinitionManagerLocal groupAlertDefinitionManager = LookupUtil
                    .getGroupAlertDefinitionManager();
                groupAlertDefinitionManager.updateGroupAlertDefinitions(subject, alertDef, false);
            } else {
View Full Code Here

Examples of org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal

        String selectedOperation = operationsForm.getControlAction();

        OperationManagerLocal operationManager = LookupUtil.getOperationManager();
        AlertTemplateManagerLocal alertTemplateManager = LookupUtil.getAlertTemplateManager();
        AlertDefinitionManagerLocal alertDefinitionManager = LookupUtil.getAlertDefinitionManager();
        GroupAlertDefinitionManagerLocal groupAlertDefinitionManager = LookupUtil.getGroupAlertDefinitionManager();

        Subject subject = RequestUtils.getSubject(request);
        AlertDefinition alertDefinition = AlertDefUtil.getAlertDefinition(request);

        OperationDefinition operationDefinition = null;

        if (selectedOperation.equals(EventConstants.CONTROL_ACTION_NONE) == false) {
            Integer operationId = Integer.parseInt(selectedOperation);

            operationDefinition = operationManager.getOperationDefinition(subject, operationId);
        }

        try {
            if (context == FormContext.Type) {
                alertTemplateManager.updateAlertTemplate(subject, alertDefinition, false);
            } else if (context == FormContext.Group) {
                groupAlertDefinitionManager.updateGroupAlertDefinitions(subject, alertDefinition, false);
            } else if (context == FormContext.Resource) {
                alertDefinitionManager.updateAlertDefinition(subject, alertDefinition.getId(), alertDefinition, false);
            } else {
                throw new IllegalArgumentException("Unsupported form context: " + context);
            }
        } catch (AlertDefinitionException iade) {
            log.debug("alert definition update failed:", iade);
View Full Code Here

Examples of org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal

        HttpServletRequest request, HttpServletResponse response) throws Exception {
        log.trace("in ListDefinitionAction");
        Subject subject = RequestUtils.getSubject(request);
        PageControl pc = WebUtility.getPageControl(request);

        AlertDefinitionManagerLocal alertManager = LookupUtil.getAlertDefinitionManager();
        ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();

        int resourceId = RequestUtils.getResourceId(request);

        PageList<AlertDefinition> alertDefinitions = alertManager.findAlertDefinitions(subject, resourceId, pc);

        // TODO GH: Deal with when its by type... i guess for the template setup

        /*PageList uiBeans = new PageList();
         * for (Object alertDefObj : alertDefs) { AlertDefinition alertDef = (AlertDefinition) alertDefObj;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.