Example usage for org.springframework.beans.support MutableSortDefinition MutableSortDefinition

List of usage examples for org.springframework.beans.support MutableSortDefinition MutableSortDefinition

Introduction

In this page you can find the example usage for org.springframework.beans.support MutableSortDefinition MutableSortDefinition.

Prototype

public MutableSortDefinition(String property, boolean ignoreCase, boolean ascending) 

Source Link

Document

Create a MutableSortDefinition for the given settings.

Usage

From source file:com.jklas.sample.petclinic.Owner.java

public List getPets() {
    List sortedPets = new ArrayList(getPetsInternal());
    PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedPets);
}

From source file:com.jklas.sample.petclinic.Vet.java

public List getSpecialties() {
    List sortedSpecs = new ArrayList(getSpecialtiesInternal());
    PropertyComparator.sort(sortedSpecs, new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedSpecs);
}

From source file:com.petclinic.entity.postgres.Vet.java

@XmlElement
public List<Specialty> getSpecialties() {
    List<Specialty> sortedSpecs = new ArrayList<>(getSpecialtiesInternal());
    PropertyComparator.sort(sortedSpecs, new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedSpecs);
}

From source file:com.branded.holdings.qpc.model.Vet.java

@XmlElement
public List<Specialty> getSpecialties() {
    List<Specialty> sortedSpecs = new ArrayList<Specialty>(getSpecialtiesInternal());
    PropertyComparator.sort(sortedSpecs, new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedSpecs);
}

From source file:com.jklas.sample.petclinic.Pet.java

public List getVisits() {
    List sortedVisits = new ArrayList(getVisitsInternal());
    PropertyComparator.sort(sortedVisits, new MutableSortDefinition("date", false, false));
    return Collections.unmodifiableList(sortedVisits);
}

From source file:com.branded.holdings.qpc.model.Owner.java

public List<Pet> getPets() {
    List<Pet> sortedPets = new ArrayList<Pet>(getPetsInternal());
    PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedPets);
}

From source file:com.branded.holdings.qpc.model.Pet.java

public List<Visit> getVisits() {
    List<Visit> sortedVisits = new ArrayList<Visit>(getVisitsInternal());
    PropertyComparator.sort(sortedVisits, new MutableSortDefinition("date", false, false));
    return Collections.unmodifiableList(sortedVisits);
}

From source file:org.springframework.samples.petclinic.model.Owner.java

public List<Pet> getMutableSortPets() {
    List<Pet> sortedPets = new ArrayList<Pet>(getPetsInternal());
    PropertyComparator.sort(sortedPets, new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedPets);
}

From source file:org.shept.beans.support.PropertyComparator.java

/**
 * Create a PropertyComparator for the given settings.
 * @param property the property to compare
 * @param ignoreCase whether upper and lower case in String values should be ignored
 * @param ascending whether to sort ascending (true) or descending (false)
 *///from w ww. j  av a 2s.  c om
public PropertyComparator(String property, boolean ignoreCase, boolean ascending) {
    this.sortDefinition = new MutableSortDefinition(property, ignoreCase, ascending);
}

From source file:org.openmrs.module.conceptsearch.web.controller.AbstractSearchFormController.java

public void sortResultsView(ModelMap model, WebRequest request, HttpSession session) {
    String sortFor = request.getParameter("sort");
    boolean asc = true;

    if (request.getParameter("order") != null && request.getParameter("order").equals("desc"))
        asc = false;/* w w  w  .java  2 s . co  m*/

    PagedListHolder resListHolder = (PagedListHolder) session.getAttribute("sortResults");
    ConceptSearch cs = (ConceptSearch) session.getAttribute("conceptSearch");
    if (cs != null)
        model.addAttribute("conceptSearch", cs);

    if (resListHolder != null) {
        //          List temp = resListHolder.getSource();
        //          Collections.sort((List<ConceptSearchResult>) temp, new ConceptComparator(sortFor, asc));
        resListHolder.setSort(new MutableSortDefinition(sortFor, true, asc));
        resListHolder.resort();
        model.addAttribute("searchResult", resListHolder);
    } else {
        log.warn("Results are gone");
    }
}