Package org.ametys.web.filter
Class DefaultWebContentFilter.ContentComparator
- java.lang.Object
-
- org.ametys.web.filter.DefaultWebContentFilter.ContentComparator
-
- All Implemented Interfaces:
Comparator<Content>
- Enclosing class:
- DefaultWebContentFilter
protected class DefaultWebContentFilter.ContentComparator extends Object implements Comparator<Content>
Compares two contents based on a given list of sort criteria. In jackrabbit, in ascending order, if the first content does not have the wanted value set, it's considered to be ordered *before* ("less than") the second content (the JCR spec specifies this behavior as "implementation-defined").
-
-
Field Summary
Fields Modifier and Type Field Description protected SortCriteria
_sort
The sort criteria.
-
Constructor Summary
Constructors Constructor Description ContentComparator(SortCriteria sortCriteria)
Build a content comparator from sort criteria.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(Content c1, Content c2)
private int
compareJcrPropertyAscending(Content c1, Content c2, String jcrProperty, boolean normalize)
private int
compareMetadataAscending(Content content1, Content content2, String dataPath, boolean normalize)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Field Detail
-
_sort
protected SortCriteria _sort
The sort criteria.
-
-
Constructor Detail
-
ContentComparator
public ContentComparator(SortCriteria sortCriteria)
Build a content comparator from sort criteria.- Parameters:
sortCriteria
- The sort criteria
-
-
Method Detail
-
compare
public int compare(Content c1, Content c2)
- Specified by:
compare
in interfaceComparator<Content>
-
compareMetadataAscending
private int compareMetadataAscending(Content content1, Content content2, String dataPath, boolean normalize)
-
compareJcrPropertyAscending
private int compareJcrPropertyAscending(Content c1, Content c2, String jcrProperty, boolean normalize) throws RepositoryException
- Throws:
RepositoryException
-
-