Package org.candlepin.model

Examples of org.candlepin.model.PoolFilterBuilder


            // we do want everything else
            criteriaFilters.add(Subqueries.notExists(requiresHost));
        }
        else if (!"true".equalsIgnoreCase(consumer.getFact("virt.is_guest"))) {
            PoolFilterBuilder filterBuilder = new PoolFilterBuilder();
            filterBuilder.addAttributeFilter("virt_only", "true");
            criteriaFilters.add(Restrictions.not(filterBuilder.getCriteria()));
        }
        else {
            // we are a virt guest
            // add criteria for filtering out pools that are not for this guest
            if (consumer.hasFact("virt.uuid")) {
View Full Code Here


        Date activePoolDate = entitleDate;
        if (entitleDate == null) {
            activePoolDate = new Date();
        }
        PoolFilterBuilder poolFilter = new PoolFilterBuilder();
        poolFilter.addIdFilters(fromPools);
        List<Pool> allOwnerPools = this.listAvailableEntitlementPools(
            host, null, owner, (String) null, activePoolDate, true, false,
            poolFilter, null).getPageData();
        List<Pool> allOwnerPoolsForGuest = this.listAvailableEntitlementPools(
            guest, null, owner, (String) null, activePoolDate,
View Full Code Here

        Date activePoolDate = entitleDate;
        if (entitleDate == null) {
            activePoolDate = new Date();
        }

        PoolFilterBuilder poolFilter = new PoolFilterBuilder();
        poolFilter.addIdFilters(fromPools);
        List<Pool> allOwnerPools = this.listAvailableEntitlementPools(
            consumer, null, owner, (String) null, activePoolDate, true, false,
            poolFilter, null).getPageData();
        List<Pool> filteredPools = new LinkedList<Pool>();
View Full Code Here

    @Override
    @Transactional
    public void regenerateCertificatesOf(String productId, boolean lazy) {
        List<Pool> poolsForProduct = this.listAvailableEntitlementPools(null, null, null,
            productId, new Date(), false, false, new PoolFilterBuilder(), null)
            .getPageData();
        for (Pool pool : poolsForProduct) {
            regenerateCertificatesOf(pool.getEntitlements(), lazy);
        }
    }
View Full Code Here

    @Test
    public void testListAllForConsumerIncludesWarnings() {
        Page<List<Pool>> results =
            poolManager.listAvailableEntitlementPools(parentSystem, null,
                parentSystem.getOwner(), null, null, true, true,
                new PoolFilterBuilder(), new PageRequest());
        assertEquals(4, results.getPageData().size());

        Pool pool = createPoolAndSub(o, socketLimitedProduct, 100L,
            TestUtil.createDate(2000, 3, 2), TestUtil.createDate(2050, 3, 2));
        poolCurator.create(pool);

        parentSystem.setFact("cpu.sockets", "4");
        results = poolManager.listAvailableEntitlementPools(parentSystem, null,
            parentSystem.getOwner(), null, null, true, true, new PoolFilterBuilder(),
            new PageRequest());
        // Expect the warnings to be included. Should have one more pool available.
        assertEquals(5, results.getPageData().size());
    }
View Full Code Here

        productCurator.create(p);

        Page<List<Pool>> results =
            poolManager.listAvailableEntitlementPools(parentSystem, null,
                parentSystem.getOwner(), null, null, true, true,
                new PoolFilterBuilder(), new PageRequest());
        assertEquals(4, results.getPageData().size());

        // Creating a pool with no entitlements available, which will trigger
        // a rules error:
        Pool pool = createPoolAndSub(o, p, 0L,
            TestUtil.createDate(2000, 3, 2), TestUtil.createDate(2050, 3, 2));
        poolCurator.create(pool);

        results = poolManager.listAvailableEntitlementPools(parentSystem, null,
            parentSystem.getOwner(), null, null, true, true, new PoolFilterBuilder(),
            new PageRequest());
        // Pool in error should not be included. Should have the same number of
        // initial pools.
        assertEquals(4, results.getPageData().size());
    }
View Full Code Here

        akpool.setAttribute("physical_only", "true");
        ak.addPool(akpool, 1L);
        Page<List<Pool>> results =
            poolManager.listAvailableEntitlementPools(null, ak,
                parentSystem.getOwner(), null, null, true, true,
                new PoolFilterBuilder(), new PageRequest());
        assertEquals(4, results.getPageData().size());

        // Creating a pool with no entitlements available, which will trigger
        // a rules error:
        Pool pool = createPoolAndSub(o, p, 0L,
            TestUtil.createDate(2000, 3, 2), TestUtil.createDate(2050, 3, 2));
        poolCurator.create(pool);

        results = poolManager.listAvailableEntitlementPools(null, ak,
            parentSystem.getOwner(), null, null, true, true, new PoolFilterBuilder(),
            new PageRequest());
        // Pool in error should not be included. Should have the same number of
        // initial pools.
        assertEquals(4, results.getPageData().size());
    }
View Full Code Here

    @Test
    public void testListForConsumerExcludesWarnings() {
        Page<List<Pool>> results =
            poolManager.listAvailableEntitlementPools(parentSystem, null,
                parentSystem.getOwner(), (String) null, null, true, false,
                new PoolFilterBuilder(), new PageRequest());
        assertEquals(4, results.getPageData().size());

        Pool pool = createPoolAndSub(o, socketLimitedProduct, 100L,
            TestUtil.createDate(2000, 3, 2), TestUtil.createDate(2050, 3, 2));
        poolCurator.create(pool);

        parentSystem.setFact("cpu.cpu_socket(s)", "4");

        results = poolManager.listAvailableEntitlementPools(parentSystem, null,
            parentSystem.getOwner(), (String) null, null, true, false,
            new PoolFilterBuilder(), new PageRequest());
        // Pool in error should not be included. Should have the same number of
        // initial pools.
        assertEquals(4, results.getPageData().size());
    }
View Full Code Here

        return searchPool;
    }

    private void searchTest(String searchFor, int expectedResults, String ... expectedIds) {
        PoolFilterBuilder filters = new PoolFilterBuilder();
        filters.addMatchesFilter(searchFor);
        Page<List<Pool>> page = poolCurator.listAvailableEntitlementPools(
                null, owner, null, null, false, filters,
                req, false);
        List<Pool> results = page.getPageData();
        assertEquals(expectedResults, results.size());
View Full Code Here

        req.setPage(1);
        req.setPerPage(10);
        req.setOrder(PageRequest.Order.ASCENDING);
        req.setSortBy("id");

        PoolFilterBuilder filters = new PoolFilterBuilder();
        filters.addAttributeFilter("cores", "8");

        Page<List<Pool>> page = poolCurator.listAvailableEntitlementPools(
            null, owner, null, activeDate, false, filters,
            req, false);
        List<Pool> results = page.getPageData();
View Full Code Here

TOP

Related Classes of org.candlepin.model.PoolFilterBuilder

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.