Package org.rhq.core.domain.criteria

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


    }

    public static void showWizard(final int snapshpotDriftDefId, final int snapshotVersion) {

        // get the relevant DriftDefinition
        DriftDefinitionCriteria ddc = new DriftDefinitionCriteria();
        ddc.addFilterId(snapshpotDriftDefId);
        ddc.fetchResource(true);
        ddc.fetchConfiguration(true);

        GWTServiceLookup.getDriftService().findDriftDefinitionsByCriteria(ddc,
            new AsyncCallback<PageList<DriftDefinition>>() {

                public void onFailure(Throwable caught) {
View Full Code Here


        assertEquals("The updated definition should be set to in compliance", DriftComplianceStatus.IN_COMPLIANCE,
            updatedDef.getComplianceStatus());
    }

    private DriftDefinition loadDefinition(String name) {
        DriftDefinitionCriteria criteria = new DriftDefinitionCriteria();
        criteria.addFilterResourceIds(resource.getId());
        criteria.addFilterName(name);
        criteria.fetchConfiguration(true);
        criteria.fetchResource(true);
        criteria.fetchTemplate(true);

        PageList<DriftDefinition> driftDefs = driftMgr.findDriftDefinitionsByCriteria(getOverlord(), criteria);
        assertEquals("Expected to find one drift definition", 1, driftDefs.size());

        return driftDefs.get(0);
View Full Code Here

            }

            @Override
            protected DriftDefinitionCriteria getFetchCriteria(DSRequest request) {

                DriftDefinitionCriteria criteria = new DriftDefinitionCriteria();
                criteria.addFilterTemplateId(templateId);
                criteria.fetchResource(true);

                return criteria;
            }
View Full Code Here

    @Override
    protected void onDraw() {

        // Drift def snapshot view or template pinned snapshot?
        if (null != this.driftDefId) {
            DriftDefinitionCriteria defCriteria = new DriftDefinitionCriteria();
            defCriteria.addFilterId(driftDefId);
            defCriteria.fetchConfiguration(true);
            defCriteria.fetchTemplate(true);

            DriftGWTServiceAsync driftService = GWTServiceLookup.getDriftService();
            driftService.findDriftDefinitionsByCriteria(defCriteria, new AsyncCallback<PageList<DriftDefinition>>() {
                public void onFailure(Throwable caught) {
                    CoreGUI.getErrorHandler().handleError(MSG.view_drift_failure_load(), caught);
View Full Code Here

        driftDefPojo.setInterval(60L);
        driftDefPojo.setBasedir(new BaseDirectory(BaseDirValueContext.fileSystem, "foo/bar"));

        driftManager.updateDriftDefinition(overlord, EntityContext.forResource(newResource.getId()), driftDefPojo);

        DriftDefinitionCriteria c = new DriftDefinitionCriteria();
        c.addFilterResourceIds(newResource.getId());
        c.fetchConfiguration(true);
        List<DriftDefinition> driftDefs = driftManager.findDriftDefinitionsByCriteria(overlord, c);
        assertNotNull(driftDefs);
        assertEquals(3, driftDefs.size());
        DriftDefinition driftDef = null;
        for (Iterator<DriftDefinition> i = driftDefs.iterator(); i.hasNext();) {
View Full Code Here

    }

    @Override
    protected DriftDefinitionCriteria getFetchCriteria(DSRequest request) {

        DriftDefinitionCriteria criteria = new DriftDefinitionCriteria();
        switch (entityContext.getType()) {
        case Resource:
            criteria.addFilterResourceIds(entityContext.getResourceId());
            break;

        case ResourceGroup:
            //TODO

        default:
            // no filter
        }

        criteria.fetchConfiguration(true);
        criteria.fetchTemplate(true);

        // filter out unsortable fields (i.e. fields sorted client-side only)
        PageControl pageControl = getPageControl(request);
        pageControl.removeOrderingField(ATTR_BASE_DIR_STRING);
        pageControl.removeOrderingField(ATTR_CHANGE_SET_CTIME);
        pageControl.removeOrderingField(ATTR_CHANGE_SET_VERSION);
        pageControl.removeOrderingField(ATTR_TEMPLATE);
        criteria.setPageControl(pageControl);

        return criteria;
    }
View Full Code Here

        }
        return templates.get(0);
    }

    private DriftDefinition loadDefinition(int definitionId) {
        DriftDefinitionCriteria criteria = new DriftDefinitionCriteria();
        criteria.addFilterId(definitionId);
        criteria.fetchConfiguration(true);
        criteria.fetchTemplate(true);
        PageList<DriftDefinition> definitions = driftMgr.findDriftDefinitionsByCriteria(getOverlord(), criteria);

        if (definitions.isEmpty()) {
            return null;
        }
View Full Code Here

    }

    @Override
    protected void onDraw() {

        DriftDefinitionCriteria defCriteria = new DriftDefinitionCriteria();
        defCriteria.addFilterId(driftDefId);
        defCriteria.fetchConfiguration(true);

        driftService.findDriftDefinitionsByCriteria(defCriteria, new AsyncCallback<PageList<DriftDefinition>>() {
            public void onFailure(Throwable caught) {
                CoreGUI.getErrorHandler().handleError(MSG.view_drift_failure_load(), caught);
            }
View Full Code Here

        }
        return result;
    }

    private void getDriftDefinitions0(Map<Integer, List<DriftDefinition>> result, List<Integer> resourceIds) {
        DriftDefinitionCriteria criteria = new DriftDefinitionCriteria();
        criteria.addFilterResourceIds(resourceIds.toArray(new Integer[resourceIds.size()]));
        criteria.fetchConfiguration(true);

        final Subject overlord = getSubjectManager().getOverlord();

        //Use CriteriaQuery to automatically chunk/page through criteria query results
        CriteriaQueryExecutor<DriftDefinition, DriftDefinitionCriteria> queryExecutor = new CriteriaQueryExecutor<DriftDefinition, DriftDefinitionCriteria>() {
View Full Code Here

            new DriftSnapshotRequest(driftDefinitionId, startVersion, endVersion));
    }

    @Override
    public void updateCompliance(int resourceId, String driftDefName, DriftComplianceStatus complianceStatus) {
        DriftDefinitionCriteria criteria = new DriftDefinitionCriteria();
        criteria.setStrict(true);
        criteria.addFilterResourceIds(resourceId);
        criteria.addFilterName(driftDefName);

        DriftManagerLocal driftMgr = getDriftManager();
        SubjectManagerLocal subjectMgr = getSubjectManager();
        Subject overlord = subjectMgr.getOverlord();
View Full Code Here

TOP

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

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.