Class SortCriteria
- java.lang.Object
-
- org.ametys.plugins.repository.query.SortCriteria
-
public class SortCriteria extends Object
A sort criteria allows to sort query results.
Warning : methods of this class support a boolean "normalize" which suppose that the patch at https://issues.apache.org/jira/browse/JCR-3443 has been applied.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
SortCriteria.SortCriterion
A sort criterion.
-
Field Summary
Fields Modifier and Type Field Description private List<SortCriteria.SortCriterion>
_criteria
-
Constructor Summary
Constructors Constructor Description SortCriteria()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCriterion(String metadataPath, boolean ascending, boolean normalize)
Add a sort criteria to the criteria list, using a metadata name.void
addJCRPropertyCriterion(String jcrProperty, boolean ascending, boolean normalize)
Add a sort criteria to the criteria list, using a JCR property name.String
build()
Build the criteria.List<SortCriteria.SortCriterion>
getCriteria()
Get the criteria.
-
-
-
Field Detail
-
_criteria
private List<SortCriteria.SortCriterion> _criteria
-
-
Constructor Detail
-
SortCriteria
public SortCriteria()
-
-
Method Detail
-
addCriterion
public void addCriterion(String metadataPath, boolean ascending, boolean normalize)
Add a sort criteria to the criteria list, using a metadata name.
Order of adding is important. First added has more weight during sort.- Parameters:
metadataPath
- The name of the metadata to sort, or the path to the metadata if compositeascending
- The order for sorting resultsnormalize
-true
to normalize string properties (remove accents and lower case)
-
addJCRPropertyCriterion
public void addJCRPropertyCriterion(String jcrProperty, boolean ascending, boolean normalize)
Add a sort criteria to the criteria list, using a JCR property name.
Order of adding is important. First added has more weight during sort.- Parameters:
jcrProperty
- The name of the JCR property to sortascending
- The order for sorting resultsnormalize
-true
to normalize string properties (remove accents and lower case)
-
getCriteria
public List<SortCriteria.SortCriterion> getCriteria()
Get the criteria.- Returns:
- an unmodifiable view of the criteria list.
-
-