Examples of PageControl


Examples of org.rhq.core.domain.util.PageControl

    }

    public PageList<ResourceOperationScheduleComposite> findCurrentlyScheduledResourceOperations(int pageSize)
        throws RuntimeException {
        try {
            PageControl pageControl = new PageControl(0, pageSize);
            pageControl.initDefaultOrderingField("ro.nextFireTime", PageOrdering.ASC);
            PageList<ResourceOperationScheduleComposite> scheduledResourceOps = operationManager
                .findCurrentlyScheduledResourceOperations(getSessionSubject(), pageControl);
            return SerialUtility.prepare(scheduledResourceOps,
                "OperationService.findCurrentlyScheduledResourceOperations");
        } catch (Throwable t) {
View Full Code Here

Examples of org.rhq.core.domain.util.PageControl

    }

    public PageList<GroupOperationScheduleComposite> findCurrentlyScheduledGroupOperations(int pageSize)
        throws RuntimeException {
        try {
            PageControl pageControl = new PageControl(0, pageSize);
            pageControl.initDefaultOrderingField("go.nextFireTime", PageOrdering.ASC);
            PageList<GroupOperationScheduleComposite> scheduledGroupOps = operationManager
                .findCurrentlyScheduledGroupOperations(getSessionSubject(), pageControl);
            return SerialUtility.prepare(scheduledGroupOps, "OperationService.findCurrentlyScheduledGroupOperations");
        } catch (Throwable t) {
            throw getExceptionToThrowToClient(t);
View Full Code Here

Examples of org.rhq.core.domain.util.PageControl

     */
    protected void createPagingHeader(final Response.ResponseBuilder builder, final UriInfo uriInfo, final PageList<?> resultList) {

        UriBuilder uriBuilder;

        PageControl pc = resultList.getPageControl();
        int page = pc.getPageNumber();

        if (resultList.getTotalSize()> (pc.getPageNumber() +1 ) * pc.getPageSize()) {
            int nextPage = page+1;
            uriBuilder = uriInfo.getRequestUriBuilder(); // adds ?q, ?ps and ?category if needed
            uriBuilder.replaceQueryParam("page",nextPage);

            builder.header("Link",new Link("next",uriBuilder.build().toString()).rfc5988String());
        }

        if (page>0) {
            int prevPage = page -1;
            uriBuilder = uriInfo.getRequestUriBuilder(); // adds ?q, ?ps and ?category if needed
            uriBuilder.replaceQueryParam("page",prevPage);
            builder.header("Link", new Link("prev",uriBuilder.build().toString()).rfc5988String());
        }

        // A link to the last page
        if (!pc.isUnlimited()) {
            int lastPage = (resultList.getTotalSize() / pc.getPageSize() ) -1;
            uriBuilder = uriInfo.getRequestUriBuilder(); // adds ?q, ?ps and ?category if needed
            uriBuilder.replaceQueryParam("page",lastPage);
            builder.header("Link", new Link("last",uriBuilder.build().toString()).rfc5988String());
        }

View Full Code Here

Examples of org.rhq.core.domain.util.PageControl

     */
    protected <T> void wrapForPaging(Response.ResponseBuilder builder, UriInfo uriInfo, final PageList<?> originalList, final Collection<T> resultList) {

        PagingCollection<T> pColl = new PagingCollection<T>(resultList);
        pColl.setTotalSize(originalList.getTotalSize());
        PageControl pageControl = originalList.getPageControl();
        pColl.setPageSize(pageControl.getPageSize());
        int page = pageControl.getPageNumber();
        pColl.setCurrentPage(page);
        int lastPage = (originalList.getTotalSize() / pageControl.getPageSize()) -1 ; // -1 as page # is 0 based
        pColl.setLastPage(lastPage);

        UriBuilder uriBuilder;
        if (originalList.getTotalSize() > (page +1 ) * pageControl.getPageSize()) {
            int nextPage = page +1;
            uriBuilder = uriInfo.getRequestUriBuilder(); // adds ?q, ?ps and ?category if needed
            uriBuilder.replaceQueryParam("page",nextPage);
            pColl.addLink(new Link("next",uriBuilder.build().toString()));
        }
        if (page > 0) {
            int prevPage = page -1;
            uriBuilder = uriInfo.getRequestUriBuilder(); // adds ?q, ?ps and ?category if needed
            uriBuilder.replaceQueryParam("page",prevPage);
            pColl.addLink(new Link("prev",uriBuilder.build().toString()));
        }

        // A link to the last page
        if (!pageControl.isUnlimited()) {
            uriBuilder = uriInfo.getRequestUriBuilder(); // adds ?q, ?ps and ?category if needed
            uriBuilder.replaceQueryParam("page",lastPage);
            pColl.addLink( new Link("last",uriBuilder.build().toString()));
        }

View Full Code Here

Examples of org.rhq.core.domain.util.PageControl

    public List<DisambiguationReport<ResourceComposite>> autocomplete(Object suggest) {
        String pref = (String) suggest;
        ArrayList<ResourceComposite> result;

        PageControl pc = new PageControl();
        pc.setPageSize(50);

        result = resourceManager.findResourceComposites(EnterpriseFacesContextUtility.getSubject(), null, null, null,
            null, pref, true, pc);

        return resourceManager.disambiguate(result, RESOURCE_ID_EXTRACTOR, DefaultDisambiguationUpdateStrategies.getDefault());
View Full Code Here

Examples of org.rhq.core.domain.util.PageControl

    public List<ResourceGroupComposite> autocomplete(Object suggest) {
        String pref = (String) suggest;
        ArrayList<ResourceGroupComposite> result;

        PageControl pc = new PageControl();
        pc.setPageSize(50);

        result = resourceGroupManager.findResourceGroupComposites(EnterpriseFacesContextUtility.getSubject(), null,
            null, null, null, pref, null, null, pc);

        return result;
View Full Code Here

Examples of org.rhq.core.domain.util.PageControl

        // Load existing distributions to send to source
        // --------------------------------------------
        long start = System.currentTimeMillis();

        PageControl pc = PageControl.getUnlimitedInstance();
        Subject overlord = subjectManager.getOverlord();
        List<Distribution> dists = repoManager.findAssociatedDistributions(overlord, repo.getId(), pc);
        log.debug("Found " + dists.size() + " distributions for repo " + repo.getId());

        DistributionSyncReport distReport = new DistributionSyncReport(repo.getId());
View Full Code Here

Examples of org.rhq.core.domain.util.PageControl

        if (!authMangager.canViewResource(subject, resourceId)) {
            return new PageList<MeasurementOOBComposite>();
        }

        PageControl pc = new PageControl(0, n);
        pc.addDefaultOrderingField("sched.id");
        pc.addDefaultOrderingField("o.oobFactor", PageOrdering.DESC);

        String queryName = MeasurementOOB.GET_HIGHEST_FACTORS_FOR_RESOURCE;
        Query query = PersistenceUtility.createQueryWithOrderBy(entityManager, queryName, pc);
        Query countQuery = PersistenceUtility.createCountQuery(entityManager, queryName);
        query.setParameter("resourceId", resourceId);
View Full Code Here

Examples of org.rhq.core.domain.util.PageControl

        if (!authMangager.canViewResource(subject, groupId)) {
            return new PageList<MeasurementOOBComposite>();
        }

        PageControl pc = new PageControl(0, n);
        pc.addDefaultOrderingField("sched.id");
        pc.addDefaultOrderingField("o.oobFactor", PageOrdering.DESC);

        String queryName = MeasurementOOB.GET_HIGHEST_FACTORS_FOR_GROUP;
        Query query = PersistenceUtility.createQueryWithOrderBy(entityManager, queryName, pc);
        Query countQuery = PersistenceUtility.createCountQuery(entityManager, queryName);
        query.setParameter("groupId", groupId);
View Full Code Here

Examples of org.rhq.core.domain.util.PageControl

        try {
            long childPluginConfigurationUpdateCount = getConfigurationUpdateCount(groupConfigurationUpdateId,
                configurationManager);

            int rowsProcessed = 0;
            PageControl pc = new PageControl(0, 1000, new OrderingField("cu.id", PageOrdering.ASC));
            while (true) {
                List<Integer> pagedChildUpdateIds = getConfigurationUpdateIds(groupConfigurationUpdateId,
                    configurationManager, pc);
                if (pagedChildUpdateIds.size() <= 0) {
                    break;
                }

                for (Integer childUpdateId : pagedChildUpdateIds) {
                    // failing one update request is not reason to fail all of the remaining updates
                    // so, wrap in a try catch and gather up the errors to subsequently fail the group update. This
                    // will especially benefit group plugin config, which currently executes synchronously. 
                    try {
                        executeConfigurationUpdate(configurationManager, childUpdateId, subject);
                    } catch (Exception e) {
                        errorMessages = appendErrorMessages(errorMessages, "Failed Member Update Id=" + childUpdateId,
                            e.toString());
                    }
                }

                rowsProcessed += pagedChildUpdateIds.size();
                if (rowsProcessed >= childPluginConfigurationUpdateCount) {
                    break;
                }

                pc.setPageNumber(pc.getPageNumber() + 1);
            }
        } catch (Exception e) {
            errorMessages = appendErrorMessages(errorMessages, "Failed Group Update Id=" + groupConfigurationUpdateId,
                ThrowableUtil.getAllMessages(e));
        } finally {
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.