Package com.ponysdk.hibernate.query

Examples of com.ponysdk.hibernate.query.CriteriaContext


        boolean applyDefaultSorting = (defaultSortingProperty != null);

        final List<Criterion> fields = query.getCriteria();
        if (fields != null) {
            for (final Criterion criterion : fields) {
                final CriteriaContext context = new CriteriaContext();
                context.setCriterion(criterion);
                context.setOrderingCriteria(criteria);

                if (criterion.getValue() != null || criterion.getSortingType() != SortingType.NONE || criterion.getComparator() == ComparatorType.IS_NULL || criterion.getComparator() == ComparatorType.IS_NOT_NULL) {
                    CriteriaDecorator criteriaDecorator = criteriaDecoratorByPojoPropertyKey.get(criterion.getPojoProperty());
                    if (criteriaDecorator == null) {
                        criteriaDecorator = new DefaultCriteriaDecorator();
                    }
                    criteriaDecorator.render(context);
                }
                if (applyDefaultSorting && criterion.getSortingType() != SortingType.NONE && criterion.getPojoProperty().equals(defaultSortingProperty)) {
                    applyDefaultSorting = false;
                }
            }
        }

        // sort forced on the default property
        if (applyDefaultSorting) {
            final Criterion field = new Criterion(defaultSortingProperty);
            field.setSortingType(sortingType);
            final CriteriaContext context = new CriteriaContext();
            context.setCriterion(field);
            context.setOrderingCriteria(criteria);
            sortCriteriaDecorator.render(context);
        }

        // handle scrolling when too many data
        if (!QueryMode.FULL_RESULT.equals(query.getQueryMode())) {
View Full Code Here

TOP

Related Classes of com.ponysdk.hibernate.query.CriteriaContext

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.