Class CommonSystemPropertyBasedSortDefinition
- java.lang.Object
-
- org.ametys.web.frontoffice.search.metamodel.impl.CommonSystemPropertyBasedSortDefinition
-
- All Implemented Interfaces:
SortDefinition
public class CommonSystemPropertyBasedSortDefinition extends Object implements SortDefinition
This class has the purpose to functionaly have a commonSortDefinition
(for allReturnable
s) on fields such as last validation date, first validation date, last modification date, last major validation date, etc.
And to technically rely onSystemProperty
.
This means that with theSystemProperty
mechanism, the sort field is already indexed forContent
s.
BUT for every other kind of document (such asPage
forPageReturnable
,Resource
forResourceReturnable
, etc.), the corresponding sort fields must be manually indexed.
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
__PREFIX_ID
The prefix id of the sort definitionprivate I18nizableText
_label
private Sort.Order[]
_orders
private SystemProperty
_systemProperty
-
Constructor Summary
Constructors Constructor Description CommonSystemPropertyBasedSortDefinition(SystemProperty systemProperty, Sort.Order[] orders)
Default constructor with the label of the givenSystemProperty
CommonSystemPropertyBasedSortDefinition(SystemProperty systemProperty, I18nizableText label, Sort.Order[] orders)
Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getField()
Gets the sort fieldString
getId()
Gets the id of the sort.I18nizableText
getLabel()
Gets the label of the sort.Sort.Order[]
orders()
Gets the orders this sort supports.
-
-
-
Field Detail
-
__PREFIX_ID
protected static final String __PREFIX_ID
The prefix id of the sort definition- See Also:
- Constant Field Values
-
_systemProperty
private SystemProperty _systemProperty
-
_label
private I18nizableText _label
-
_orders
private Sort.Order[] _orders
-
-
Constructor Detail
-
CommonSystemPropertyBasedSortDefinition
public CommonSystemPropertyBasedSortDefinition(SystemProperty systemProperty, Sort.Order[] orders)
Default constructor with the label of the givenSystemProperty
- Parameters:
systemProperty
- TheSystemProperty
thisSortDefinition
is based on.orders
- The orders allowed for thisSortDefinition
-
CommonSystemPropertyBasedSortDefinition
public CommonSystemPropertyBasedSortDefinition(SystemProperty systemProperty, I18nizableText label, Sort.Order[] orders)
Default constructor- Parameters:
systemProperty
- TheSystemProperty
thisSortDefinition
is based on.label
- The labelorders
- The orders allowed for thisSortDefinition
-
-
Method Detail
-
getId
public String getId()
Description copied from interface:SortDefinition
Gets the id of the sort. It must be unique across all sort definitions- Specified by:
getId
in interfaceSortDefinition
- Returns:
- the unique id of the sort
-
getLabel
public I18nizableText getLabel()
Description copied from interface:SortDefinition
Gets the label of the sort.- Specified by:
getLabel
in interfaceSortDefinition
- Returns:
- the label of the sort.
-
orders
public Sort.Order[] orders()
Description copied from interface:SortDefinition
Gets the orders this sort supports.
By default toSort.Order.ASC
andSort.Order.DESC
.
Override this method to restrict to only one of them, if the other is irrelevant for instance.- Specified by:
orders
in interfaceSortDefinition
- Returns:
- the orders this sort supports
-
getField
public String getField()
Description copied from interface:SortDefinition
Gets the sort field- Specified by:
getField
in interfaceSortDefinition
- Returns:
- the sort field
-
-