Examples of AlertDefinitionCriteria


Examples of org.rhq.core.domain.criteria.AlertDefinitionCriteria

    public int disableAlertDefinitions(Subject subject, int[] alertDefinitionIds) {
        if (null == alertDefinitionIds || alertDefinitionIds.length == 0) {
            return 0;
        }

        AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
        criteria.addFilterIds(ArrayUtils.wrapInArray(alertDefinitionIds));
        criteria.addFilterEnabled(true);
        criteria.addFilterDeleted(false);
        criteria.clearPaging();
        List<AlertDefinition> defs = alertDefinitionManager.findAlertDefinitionsByCriteria(subject, criteria);

        if (defs.isEmpty()) {
            return 0;
        }
View Full Code Here

Examples of org.rhq.core.domain.criteria.AlertDefinitionCriteria

        List<Integer> resourceIdsInError = new ArrayList<Integer>();
        Throwable firstThrowable = null;

        // We want to copy the group level AlertDefinitions, so fetch them with the relevant lazy fields, so we
        // have everything we need when calling the copy constructor, minimizing
        AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
        criteria.addFilterResourceGroupIds(resourceGroupId);
        criteria.fetchGroupAlertDefinition(false);
        criteria.fetchConditions(true);
        criteria.fetchAlertNotifications(true);
        // Apply paging when optionally fetching collections, to avoid duplicates. Hibernate seems to apply DISTINCT,
        // which is what we want.  Use a huge # because we want them all.
        criteria.setPaging(0, Integer.MAX_VALUE);

        List<AlertDefinition> groupAlertDefinitions = alertDefinitionManager.findAlertDefinitionsByCriteria(subject,
            criteria);

        for (AlertDefinition groupAlertDefinition : groupAlertDefinitions) {
View Full Code Here

Examples of org.rhq.core.domain.criteria.AlertDefinitionCriteria

        removeGroupAlertDefinitions(subject, groupAlertDefinitionIdsForResourceGroup);
    }

    @SuppressWarnings("unchecked")
    private Integer[] findGroupAlertDefinitionIds(int resourceGroupId) {
        AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
        criteria.addFilterResourceGroupIds(resourceGroupId);
        criteria.setPageControl(PageControl.getUnlimitedInstance());

        CriteriaQueryGenerator generator = new CriteriaQueryGenerator(criteria);
        generator.alterProjection("alertdefinition.id");
        Query query = generator.getQuery(entityManager);
        List<Integer> groupAlertDefinitionIds = query.getResultList();
View Full Code Here

Examples of org.rhq.core.domain.criteria.AlertDefinitionCriteria

        if (removedResourceIds == null || removedResourceIds.length == 0) {
            return;
        }

        // fetch the resource-level AlertDefs tied to the Group from which resources are being removed
        AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
        criteria.addFilterResourceIds(removedResourceIds);
        criteria.addFilterGroupAlertDefinitionGroupId(resourceGroupId);
        criteria.addFilterDeleted(false);
        criteria.clearPaging();

        CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
        CriteriaQueryRunner<AlertDefinition> queryRunner = new CriteriaQueryRunner<AlertDefinition>(criteria,
            generator, entityManager);
        List<AlertDefinition> alertDefinitions = queryRunner.execute();
View Full Code Here

Examples of org.rhq.core.domain.criteria.AlertDefinitionCriteria

        AlertCriteria alertCriteria = new AlertCriteria();
        alertCriteria.setRestriction(Criteria.Restriction.COUNT_ONLY);
        PageList<Alert> alertList = alertManager.findAlertsByCriteria(caller,alertCriteria);
        result.put("AlertCount",String.valueOf(alertList.getTotalSize()));

        AlertDefinitionCriteria alertDefinitionCriteria = new AlertDefinitionCriteria();
        alertDefinitionCriteria.setRestriction(Criteria.Restriction.COUNT_ONLY);
        PageList<AlertDefinition> defList = alertDefinitionManager.findAlertDefinitionsByCriteria(caller,alertDefinitionCriteria);
        result.put("AlertDefinitionCount",String.valueOf(defList.getTotalSize()));

        // status.setSchedules(-1); // TODO number of (active) schedules
View Full Code Here

Examples of org.rhq.core.domain.criteria.AlertDefinitionCriteria

    @Override
    public void deleteAlertTemplates(Subject subject, ResourceType resourceType) {
        log.debug("Deleting alert templates for " + resourceType);

        AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
        criteria.addFilterAlertTemplateResourceTypeId(resourceType.getId());
        criteria.clearPaging();//disable paging as the code assumes all the results will be returned.

        List<AlertDefinition> templates = alertDefinitionMgr.findAlertDefinitionsByCriteria(subject, criteria);

        Integer[] templateIds = new Integer[templates.size()];
        int i = 0;
View Full Code Here

Examples of org.rhq.core.domain.criteria.AlertDefinitionCriteria

        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.core.domain.criteria.AlertDefinitionCriteria

    /**
     * Override to add any criteria that must be present when fetching the alert definition detail.
     * @return
     */
    protected AlertDefinitionCriteria getDetailCriteria() {
        return new AlertDefinitionCriteria();
    }
View Full Code Here

Examples of org.rhq.core.domain.criteria.AlertDefinitionCriteria

        return null;
    }

    private void loadAllAlertDefinitionsAndRefreshRecoverAlertSelection() {
        if (allAlertDefinitions == null) {
            AlertDefinitionCriteria criteria = alertDataSource.getSimpleCriteriaForAll();
            GWTServiceLookup.getAlertDefinitionService().findAlertDefinitionsByCriteria(criteria,
                new AsyncCallback<PageList<AlertDefinition>>() {
                    public void onFailure(Throwable caught) {
                        CoreGUI.getErrorHandler().handleError(MSG.view_alert_definition_recovery_editor_loadFailed(),
                            caught);
View Full Code Here

Examples of org.rhq.core.domain.criteria.AlertDefinitionCriteria

            }
            return new StreamingOutput() {

                @Override
                public void write(OutputStream stream) throws IOException, WebApplicationException {
                    final AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
                    criteria.addFilterResourceOnly(true);
                    criteria.fetchGroupAlertDefinition(true);
                    criteria.fetchResource(true);
                    // TODO figure out why resourceType is not getting fetched
                    // The resource type id is needed for the parent url when we have a
                    // template alert definition. I previously tried accessing the resource
                    // type id via AlertDefinition.resourceType.id, but resourceType is null
                    // even though fetchResourceType is set to true in the critera.
                    //
                    // jsanda
                    criteria.fetchResourceType(true);

                    CriteriaQueryExecutor<AlertDefinition, AlertDefinitionCriteria> queryExecutor =
                            new CriteriaQueryExecutor<AlertDefinition, AlertDefinitionCriteria>() {
                                @Override
                                public PageList<AlertDefinition> execute(AlertDefinitionCriteria criteria) {
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.