Package org.rhq.core.domain.criteria

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


        }

        return new StreamingOutput() {
            @Override
            public void write(OutputStream stream) throws IOException, WebApplicationException {
                GenericDriftCriteria criteria  = new GenericDriftCriteria();
                // Need to fetch the change set so that we can the definition id which is
                // needed to build the details url.
                criteria.fetchChangeSet(true);
                criteria.addFilterChangeSetStartVersion(1);// always start at 1 for this report

                if(startTime != null){
                    criteria.addFilterStartTime(startTime);
                }
                if(endTime != null){
                    criteria.addFilterEndTime(endTime);
                }
                // lets default the end time for them to now if they didnt enter it
                if(startTime != null && endTime == null){
                    Date today = new Date();
                    criteria.addFilterEndTime(today.getTime());
                }


                if(snapshot != null) {
                    log.info("Drift Snapshot version Filter set for: " + snapshot);
                    criteria.addFilterChangeSetEndVersion(snapshot);
                }
                if(path != null) {
                    log.info("Drift Path Filter set for: " + path);
                    criteria.addFilterPath(path);
                }
                if(definitionName != null) {
                    log.info("Drift Definition Filter set for: " + definitionName);
                    //@todo: drift sorting is done in the resultset after no criteria for definition
                }

                criteria.addFilterCategories(getCategories());

                CriteriaQueryExecutor<DriftComposite, DriftCriteria> queryExecutor =
                        new CriteriaQueryExecutor<DriftComposite, DriftCriteria>() {
                            @Override
                            public PageList<DriftComposite> execute(DriftCriteria criteria) {
View Full Code Here


        @Override
        protected GenericDriftCriteria getFetchCriteria(DSRequest request) {

            // Call super to get standard drift criteria that has been set
            GenericDriftCriteria criteria = super.getFetchCriteria(request);

            if (null == criteria) {
                criteria = new GenericDriftCriteria();
            }

            // Always restrict to the relevant change set
            criteria.addFilterChangeSetId(changeSetId);
            return criteria;
        }
View Full Code Here

    @SuppressWarnings("unchecked")
    @Override
    public FileDiffReport generateUnifiedDiffByIds(Subject subject, String driftId1, String driftId2) {
        DriftServerPluginFacet driftServerPlugin = getServerPlugin();

        GenericDriftCriteria criteria = new GenericDriftCriteria();
        criteria.addFilterId(driftId1);
        criteria.setPageControl(PageControl.getSingleRowInstance());

        List<? extends Drift<?, ?>> result = driftServerPlugin.findDriftsByCriteria(subject, criteria);
        if (result.size() != 1) {
            throw new IllegalArgumentException("Drift record not found: " + driftId1);
        }
        Drift drift1 = result.get(0);

        criteria.addFilterId(driftId2);
        criteria.setPageControl(PageControl.getSingleRowInstance());

        result = driftServerPlugin.findDriftsByCriteria(subject, criteria);
        if (result.size() != 1) {
            throw new IllegalArgumentException("Drift record not found: " + driftId2);
        }
View Full Code Here

    @Override
    @TransactionAttribute(NOT_SUPPORTED)
    public DriftDetails getDriftDetails(Subject subject, String driftId) {
        log.debug("Loading drift details for drift id: " + driftId);

        GenericDriftCriteria criteria = new GenericDriftCriteria();
        criteria.addFilterId(driftId);
        criteria.fetchChangeSet(true);
        criteria.setPageControl(PageControl.getSingleRowInstance());

        DriftDetails driftDetails = new DriftDetails();
        DriftServerPluginFacet driftServerPlugin = getServerPlugin();

        DriftFile newFile = null;
View Full Code Here

        MongoDBChangeSetEntry entry4 = new MongoDBChangeSetEntry("./3.bin", FILE_ADDED);
        entry4.setNewFileHash(sha256("./3.bin"));
        changeSet3.add(entry4);
        changeSetDAO.save(changeSet3);

        GenericDriftCriteria criteria = new GenericDriftCriteria();
        criteria.addFilterResourceIds(resourceId1);
        criteria.addFilterDriftDefinitionId(driftDefId);
        criteria.addFilterCategories(FILE_CHANGED);
        criteria.addFilterChangeSetStartVersion(1);

        PageList<? extends Drift<?, ?>> actualDrifts = driftServer.findDriftsByCriteria(null, criteria);
        assertEquals(actualDrifts.size(), 1, "Expected to get back one drift");
        DriftDTO actual = (DriftDTO) actualDrifts.get(0);
       
View Full Code Here

        MongoDBChangeSetEntry entry4 = new MongoDBChangeSetEntry("./3.bin", FILE_ADDED);
        entry4.setNewFileHash(sha256("./3.bin"));
        changeSet3.add(entry4);
        changeSetDAO.save(changeSet3);

        GenericDriftCriteria criteria = new GenericDriftCriteria();
        criteria.addFilterResourceIds(resourceId1);
        criteria.addFilterDriftDefinitionId(driftDefId);
        criteria.addFilterCategories(FILE_CHANGED);
        criteria.addFilterChangeSetStartVersion(1);
        criteria.fetchChangeSet(true);

        PageList<? extends Drift<?, ?>> actualDrifts = driftServer.findDriftsByCriteria(null, criteria);
        assertEquals(actualDrifts.size(), 1, "Expected to get back one drift");
        DriftDTO actual = (DriftDTO) actualDrifts.get(0);
View Full Code Here

        c2.setVersion(1);
        c2.setResourceId(2);
        c2.setDriftDefinitionId(2);
        dao.save(c2);

        GenericDriftCriteria criteria = new GenericDriftCriteria();
        criteria.addFilterResourceIds(1);

        List<MongoDBChangeSet> actual = dao.findByDriftCriteria(criteria);
        List<MongoDBChangeSet> expected = asList(c1);

        String ignore = "drifts";
View Full Code Here

        dao.save(c2);

        MongoDBChangeSet c3 = createChangeSet(COVERAGE, 1, 3, 3);
        dao.save(c3);

        GenericDriftCriteria criteria = new GenericDriftCriteria();
        criteria.addFilterResourceIds(1, 2);

        List<MongoDBChangeSet> actual = dao.findByDriftCriteria(criteria);
        List<MongoDBChangeSet> expected = asList(c1, c2);

        String ignore = "drifts";
View Full Code Here

        dao.save(c2);

        MongoDBChangeSet c3 = createChangeSet(DRIFT, 3, 1, 1).add(new MongoDBChangeSetEntry("c1-1.txt", FILE_REMOVED));
        dao.save(c3);

        GenericDriftCriteria criteria = new GenericDriftCriteria();
        criteria.addFilterCategories(FILE_ADDED);

        List<MongoDBChangeSet> actual = dao.findByDriftCriteria(criteria);
        List<MongoDBChangeSet> expected = asList(c1, c2);

        String ignore = "drifts";
View Full Code Here

        dao.save(c2);

        MongoDBChangeSet c3 = createChangeSet(DRIFT, 3, 1, 1).add(new MongoDBChangeSetEntry("c1-1.txt", FILE_REMOVED));
        dao.save(c3);

        GenericDriftCriteria criteria = new GenericDriftCriteria();
        criteria.addFilterCategories(FILE_CHANGED, FILE_REMOVED);

        List<MongoDBChangeSet> actual = dao.findByDriftCriteria(criteria);
        List<MongoDBChangeSet> expected = asList(c2, c3);

        String ignore = "drifts";
View Full Code Here

TOP

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

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.