Package org.rhq.core.domain.util

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


            return new PageList(pageControl);
        }

        String filter = "";
        if (pageControl.getPrimarySortColumn() != null) {
            PageOrdering order = (pageControl.getPrimarySortOrder() == null) ? PageOrdering.ASC : pageControl
                .getPrimarySortOrder();
            filter = getOrderByFragment(new OrderingField(pageControl.getPrimarySortColumn(), order));
        }

        org.hibernate.Query query = getHibernateSession(entityManager).createFilter(collection, filter);
View Full Code Here


                field = expressionString;
            } else {
                field = expressionString.replaceAll("[#|$]\\{", "").replaceAll("\\}", "");
            }
            Ordering ordering = sortField.getOrdering();
            PageOrdering pageOrdering = (ordering == Ordering.ASCENDING) ? PageOrdering.ASC : PageOrdering.DESC;
            OrderingField orderingField = new OrderingField(field, pageOrdering);
            orderingFields.add(orderingField);
        }
        return orderingFields;
    }
View Full Code Here

    private void initializeSorting(PageControl pageControl, DSRequest request) {
        SortSpecifier[] sortSpecifiers = request.getSortBy();
        if (sortSpecifiers != null) {
            for (SortSpecifier sortSpecifier : sortSpecifiers) {
                PageOrdering ordering = (sortSpecifier.getSortDirection() == SortDirection.ASCENDING) ? PageOrdering.ASC
                    : PageOrdering.DESC;
                String columnName = sortSpecifier.getField();
                String sortField = getSortFieldForColumn(columnName);
                if (sortField != null) {
                    pageControl.addDefaultOrderingField(sortField, ordering);
View Full Code Here

        // Make sure the user doesn't go around us and create huge pages
        pageSize = Math.min(pageSize, PageControl.SIZE_MAX);

        String sortOrderString = request.getParameter(ParamConstants.SORTORDER_PARAM + postfix);
        PageOrdering sortOrder = PageOrdering.ASC;
        if ((sortOrderString != null) && (sortOrderString.length() > 0)) {
            try {
                sortOrder = PageOrdering.valueOf(sortOrderString.toUpperCase());
            } catch (RuntimeException e) {
                throw new RuntimeException("Request parameter '" + ParamConstants.SORTORDER_PARAM + postfix
View Full Code Here

        // figure out the 'LEFT JOIN's needed for 'ORDER BY' tokens
        List<String> orderingFieldRequiredJoins = new ArrayList<String>();
        List<String> orderingFieldTokens = new ArrayList<String>();

        for (OrderingField orderingField : pc.getOrderingFields()) {
            PageOrdering ordering = orderingField.getOrdering();
            String fieldName = orderingField.getField();
            String override = criteria.getJPQLSortOverride(fieldName);
            String suffix = (override == null) ? fieldName : override;

            /*
 
View Full Code Here

                        sortFieldValue = sortField.get(criteria);
                    } catch (IllegalAccessException iae) {
                        throw new RuntimeException(iae);
                    }
                    if (sortFieldValue != null) {
                        PageOrdering pageOrdering = (PageOrdering) sortFieldValue;
                        pc.addDefaultOrderingField(getCleansedFieldName(sortField, 4), pageOrdering);
                    }
                }
            }
        }
View Full Code Here

        // Initialize sorting.
        String sortBy = request.getAttribute("sortBy");
        if (sortBy != null) {
            String[] sorts = sortBy.split(",");
            for (String sort : sorts) {
                PageOrdering ordering = (sort.startsWith("-")) ? PageOrdering.DESC : PageOrdering.ASC;
                String columnName = (ordering == PageOrdering.DESC) ? sort.substring(1) : sort;
                pageControl.addDefaultOrderingField(columnName, ordering);
            }
        }
View Full Code Here

        PageControl pageControl = WebUtility.getPageControl(request);
        form.setPn(pageControl.getPageNumber());
        form.setPs(pageControl.getPageSize());
        form.setSc(pageControl.getPrimarySortColumn());
        PageOrdering ordering = pageControl.getPrimarySortOrder();
        form.setSo((ordering != null) ? ordering.name() : null);

        form.setSchedules(schedules.toArray(new MeasurementSchedule[schedules.size()]));
        form.setMetricCount(schedules.size());
        if (schedules.size() == 1) {
            // If there's only a single schedule, auto-select it.
View Full Code Here

        //determine count to return up to 15|30|45 and page index
        int returnAmount = pc.getPageSize();
        int returnIndex = pc.getPageNumber();

        //determine sort order
        PageOrdering sortOrder = pc.getPrimarySortOrder();
        if (sortOrder == null) {
            sortOrder = PageOrdering.ASC;
            pc.setPrimarySortOrder(sortOrder);//reset on pc
        }
View Full Code Here

        // Initialize sorting.
        String sortBy = request.getAttribute("sortBy");
        if (sortBy != null) {
            String[] sorts = sortBy.split(",");
            for (String sort : sorts) {
                PageOrdering ordering = (sort.startsWith("-")) ? PageOrdering.DESC : PageOrdering.ASC;
                String columnName = (ordering == PageOrdering.DESC) ? sort.substring(1) : sort;
                pageControl.addDefaultOrderingField(columnName, ordering);
            }
        }
View Full Code Here

TOP

Related Classes of org.rhq.core.domain.util.PageOrdering

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.