Package org.rhq.core.domain.criteria

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


            newAlertDef.setNotifyFiltered(false);
            newAlertDef.setControlFiltered(false);
            singleAlertDefinitionView.setAlertDefinition(newAlertDef);
            singleAlertDefinitionView.makeEditable();
        } else {
            final AlertDefinitionCriteria criteria = getDetailCriteria();
            criteria.addFilterId(id);
            criteria.fetchGroupAlertDefinition(true);
            criteria.fetchConditions(true);
            criteria.fetchAlertNotifications(true);
            GWTServiceLookup.getAlertDefinitionService().findAlertDefinitionsByCriteria(criteria,
                new AsyncCallback<PageList<AlertDefinition>>() {
                    public void onFailure(Throwable caught) {
                        CoreGUI.getErrorHandler().handleError(
                            MSG.view_alert_definitions_loadFailed_single(String.valueOf(id)), caught);
View Full Code Here


        assertEquals(0, childDefIds.size());

        BatchIterator<Integer> childDefIdsBatchIterator = new BatchIterator<Integer>(childDefIds);
        for (List<Integer> childDefIdsBatch : childDefIdsBatchIterator) {

            AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
            criteria.addFilterIds(childDefIdsBatch.toArray(new Integer[childDefIdsBatch.size()]));
            List<AlertDefinition> remainingChildDefs = alertDefinitionManager.findAlertDefinitionsByCriteria(
                testData.getSubject(), criteria);

            assertEquals(0, remainingChildDefs.size());
View Full Code Here

        private static final String FIELD_PARENT = "parent";
        private static final String FIELD_RESOURCE = "resource";

        @Override
        protected AlertDefinitionCriteria getFetchCriteria(DSRequest request) {
            AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
            criteria.addFilterResourceOnly(true); // guarantees that all alert defs we get will have a non-null Resource object
            criteria.setPageControl(getPageControl(request));
            criteria.fetchResource(true);
            criteria.fetchGroupAlertDefinition(true);
            return criteria;
        }
View Full Code Here

            return super.getSortFieldForColumn(columnName);
        }

        @Override
        protected AlertDefinitionCriteria getSimpleCriteriaForAll() {
            AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
            criteria.addFilterResourceOnly(true);
            criteria.setPageControl(PageControl.getUnlimitedInstance());
            return criteria;
        }
View Full Code Here

        criteria.addCriteria(CRITERIA_GROUP_ID, composite.getResourceGroup().getId());
        return criteria;
    }

    protected AlertDefinitionCriteria getDetailCriteria() {
        AlertDefinitionCriteria criteria = super.getDetailCriteria();
        criteria.addFilterResourceGroupIds(group.getId());
        return criteria;
    }
View Full Code Here

            @ApiParam(value = "Page size") @DefaultValue("20") @QueryParam("ps") int pageSize,
            @ApiParam(value = "Resource id to filter by") @QueryParam("resourceId") Integer resourceId,
            @Context HttpHeaders headers,
            @Context UriInfo uriInfo) {

        AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
        criteria.addSortId(PageOrdering.ASC);
        if (page!=null) {
            criteria.setPaging(page,pageSize);
        }
        if (resourceId!=null) {
            criteria.addFilterResourceIds(resourceId);
        }

        PageList<AlertDefinition> defs = alertDefinitionManager.findAlertDefinitionsByCriteria(caller, criteria);
        List<AlertDefinitionRest> ret = new ArrayList<AlertDefinitionRest>(defs.size());
        for (AlertDefinition def : defs) {
View Full Code Here

        }

        assert 1 == resourceTypes.size() : "Found more than 1 resource type!";
        ResourceType resourceType = resourceTypes.get(0);

        AlertDefinitionCriteria adc = new AlertDefinitionCriteria();
        adc.addFilterName(injectedAlertDef.getName());
        adc.addFilterAlertTemplateResourceTypeId(resourceType.getId());
        List<AlertDefinition> alertDefs = alertDefManager.findAlertDefinitionsByCriteria(subjectManager.getOverlord(),
            adc);

        if (!alertDefs.isEmpty()) {
            assert 1 == alertDefs.size() : "Found more than 1 existing alert def!";

            if (!replaceIfExists) {
                return result;
            }

            int[] alertDefIdArray = new int[1];
            alertDefIdArray[0] = alertDefs.get(0).getId();
            alertDefManager.removeAlertDefinitions(subjectManager.getOverlord(), alertDefIdArray);
        }

        int newAlertDefId = 0;

        if (storageNodeHighHeapTemplate.equals(injectedAlertDef)) {
            newAlertDefId = injectStorageNodeHighHeapTemplate(resourceType);
        } else if (storageNodeHighDiskUsageTemplate.equals(injectedAlertDef)) {
            newAlertDefId = injectStorageNodeHighDiskUsageTemplate(resourceType);
        } else if (storageNodeSnapshotFailureTemplate.equals(injectedAlertDef)) {
            newAlertDefId = injectStorageNodeSnapshotFailureTemplate(resourceType);
        } else if (storageNodeMaintenanceOperationsFailureTemplate.equals(injectedAlertDef)) {
            newAlertDefId = injectStorageNodeMaintenanceOperationsFailureTemplate(resourceType);
        }

        adc.addFilterId(newAlertDefId);
        alertDefs = alertDefManager.findAlertDefinitionsByCriteria(subjectManager.getOverlord(), adc);
        assert 1 == alertDefs.size() : "Found more than 1 new alert def!";
        result = alertDefs.get(0);

        return result;
View Full Code Here

        assertEquals("No validation should occur on the copied notifications", 0,
            TestAlertSender.getValidateMethodCallCount());

        AlertDefinitionManagerLocal adm = LookupUtil.getAlertDefinitionManager();
        AlertDefinitionCriteria adCrit = new AlertDefinitionCriteria();
        adCrit.addFilterResourceIds(res.getId());
        adCrit.fetchAlertNotifications(true);

        List<AlertDefinition> foundAlertDefs = adm.findAlertDefinitionsByCriteria(subject, adCrit);
        junk.addAll(foundAlertDefs);

        assertEquals("The new resource should have an alert definition obtained from the template.", 1,
View Full Code Here

        assertEquals("No validation should occur on the copied notifications", 0,
            TestAlertSender.getValidateMethodCallCount());

        AlertDefinitionManagerLocal adm = LookupUtil.getAlertDefinitionManager();
        AlertDefinitionCriteria adCrit = new AlertDefinitionCriteria();
        adCrit.addFilterResourceIds(res.getId());
        adCrit.fetchAlertNotifications(true);

        List<AlertDefinition> foundAlertDefs = adm.findAlertDefinitionsByCriteria(subject, adCrit);
        junk.addAll(foundAlertDefs);

        //1 from the group, 1 from the template
View Full Code Here

        TestAlertSender.setExpectedSubject(subject);
        TestAlertSender.resetValidateMethodCallCount();

        AlertDefinitionManagerLocal adm = LookupUtil.getAlertDefinitionManager();

        AlertDefinitionCriteria crit = new AlertDefinitionCriteria();
        crit.addFilterId(resourceLevelAlertDefinitionId);
        crit.fetchAlertNotifications(true);
        crit.fetchConditions(true);

        List<AlertDefinition> foundDefs = adm.findAlertDefinitionsByCriteria(subject, crit);

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

TOP

Related Classes of org.rhq.core.domain.criteria.AlertDefinitionCriteria

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.