Example usage for org.springframework.data.domain Sort DEFAULT_DIRECTION

List of usage examples for org.springframework.data.domain Sort DEFAULT_DIRECTION

Introduction

In this page you can find the example usage for org.springframework.data.domain Sort DEFAULT_DIRECTION.

Prototype

Direction DEFAULT_DIRECTION

To view the source code for org.springframework.data.domain Sort DEFAULT_DIRECTION.

Click Source Link

Usage

From source file:it.f2informatica.pagination.services.PageableFactoryImpl.java

@Override
public Sort.Direction getDirection(String sortDirection) {
    Optional<Sort.Direction> direction = Optional.fromNullable(Sort.Direction.fromStringOrNull(sortDirection));
    return direction.isPresent() ? direction.get() : Sort.DEFAULT_DIRECTION;
}

From source file:org.centralperf.controller.RunController.java

/**
 * Display all runs//from   www. ja  v a2 s  .  c  o m
 * @param model   Model prepared for "all runs" view
 * @return The "all runs" view name
 */
@RequestMapping("/run")
public String showRuns(Model model) {
    log.debug("Displaying runs");
    Sort runSort = new Sort(Sort.Direction.DESC, "startDate");
    model.addAttribute("runs", runRepository.findAll(runSort));
    Sort scriptSort = new Sort(Sort.DEFAULT_DIRECTION, "label");
    model.addAttribute("scripts", scriptRepository.findAll(scriptSort));
    model.addAttribute("newRun", new Run());
    return "runs";
}

From source file:br.com.mv.modulo.web.GenericCrudController.java

protected Pageable getPageable(Integer page, Integer size) {
    Pageable pageable;//w  w  w  .  j av a 2s  .co m
    if (StringUtils.isNotEmpty(getFieldToSortList())) {
        pageable = new PageRequest(page, size, Sort.DEFAULT_DIRECTION, getFieldToSortList());
    } else {
        pageable = new PageRequest(page, size);
    }
    return pageable;
}