Search in sources :

Example 1 with PagingBehavior

use of io.crnk.core.queryspec.pagingspec.PagingBehavior in project crnk-framework by crnk-project.

the class CrnkBoot method setupPagingBehavior.

private void setupPagingBehavior() {
    if (moduleRegistry.getPagingBehaviors().isEmpty()) {
        setupServiceDiscovery();
        moduleRegistry.addAllPagingBehaviors(serviceDiscovery.getInstancesByType(PagingBehavior.class));
        if (moduleRegistry.getPagingBehaviors().isEmpty()) {
            moduleRegistry.addPagingBehavior(new OffsetLimitPagingBehavior());
        }
    }
    for (PagingBehavior pagingBehavior : moduleRegistry.getPagingBehaviors()) {
        if (pagingBehavior instanceof OffsetLimitPagingBehavior) {
            if (defaultPageLimit != null) {
                ((OffsetLimitPagingBehavior) pagingBehavior).setDefaultLimit(defaultPageLimit);
            }
            if (maxPageLimit != null) {
                ((OffsetLimitPagingBehavior) pagingBehavior).setMaxPageLimit(maxPageLimit);
            }
        }
    }
}
Also used : OffsetLimitPagingBehavior(io.crnk.core.queryspec.pagingspec.OffsetLimitPagingBehavior) OffsetLimitPagingBehavior(io.crnk.core.queryspec.pagingspec.OffsetLimitPagingBehavior) PagingBehavior(io.crnk.core.queryspec.pagingspec.PagingBehavior)

Aggregations

OffsetLimitPagingBehavior (io.crnk.core.queryspec.pagingspec.OffsetLimitPagingBehavior)1 PagingBehavior (io.crnk.core.queryspec.pagingspec.PagingBehavior)1