20 |
20 |
|
21 |
21 |
enum OrderHintPreset {
|
22 |
22 |
|
23 |
|
ORDER_BY_ID_ASC(OrderHint.ORDER_BY_ID),
|
24 |
|
ORDER_BY_ID_DESC(OrderHint.ORDER_BY_ID_DESC),
|
|
23 |
BY_ID_ASC(OrderHint.ORDER_BY_ID),
|
|
24 |
BY_ID_DESC(OrderHint.ORDER_BY_ID_DESC),
|
25 |
25 |
BY_ORDER_INDEX_DESC(OrderHint.BY_ORDER_INDEX_DESC),
|
26 |
26 |
BY_ORDER_INDEX_ASC(OrderHint.BY_ORDER_INDEX),
|
27 |
|
ORDER_BY_TITLE_CACHE_ASC(OrderHint.ORDER_BY_TITLE_CACHE),
|
28 |
|
ORDER_BY_TITLE_CACHE_DESC(OrderHint.ORDER_BY_TITLE_CACHE_DESC),
|
29 |
|
NOMENCLATURAL_SORT_ORDER_ASC(OrderHint.NOMENCLATURAL_SORT_ORDER),
|
30 |
|
NOMENCLATURAL_SORT_ORDER_DESC(OrderHint.NOMENCLATURAL_SORT_ORDER_DESC);
|
|
27 |
BY_TITLE_CACHE_ASC(OrderHint.ORDER_BY_TITLE_CACHE),
|
|
28 |
BY_TITLE_CACHE_DESC(OrderHint.ORDER_BY_TITLE_CACHE_DESC),
|
|
29 |
BY_NOMENCLATURAL_ORDER_ASC(OrderHint.NOMENCLATURAL_SORT_ORDER),
|
|
30 |
BY_NOMENCLATURAL_ORDER_DESC(OrderHint.NOMENCLATURAL_SORT_ORDER_DESC);
|
31 |
31 |
|
32 |
32 |
public static final Logger logger = Logger.getLogger(OrderHintPreset.class);
|
33 |
33 |
|
... | ... | |
43 |
43 |
|
44 |
44 |
/**
|
45 |
45 |
* Checks if the OrderHintPreset is suitable for the given <code>type</code>.
|
46 |
|
* In case this check fails the <code>ORDER_BY_TITLE_CACHE_ASC</code> or
|
47 |
|
* <code>ORDER_BY_TITLE_CACHE_DESC</code> is returned as fallback, depending on
|
|
46 |
* In case this check fails the <code>BY_TITLE_CACHE_ASC</code> or
|
|
47 |
* <code>BY_TITLE_CACHE_DESC</code> is returned as fallback, depending on
|
48 |
48 |
* the sort order of the original sort order.
|
49 |
49 |
*
|
50 |
50 |
* @param type
|
... | ... | |
56 |
56 |
switch(this) {
|
57 |
57 |
case BY_ORDER_INDEX_ASC:
|
58 |
58 |
if(!OrderedTermVocabulary.class.isAssignableFrom(type)) {
|
59 |
|
logger.warn("BY_ORDER_INDEX_ASC not possible with " + type.getSimpleName() +" , falling back to ORDER_BY_TITLE_CACHE_ASC");
|
60 |
|
return OrderHintPreset.ORDER_BY_TITLE_CACHE_ASC;
|
|
59 |
logger.warn("BY_ORDER_INDEX_ASC not possible with " + type.getSimpleName() +" , falling back to BY_TITLE_CACHE_ASC");
|
|
60 |
return OrderHintPreset.BY_TITLE_CACHE_ASC;
|
61 |
61 |
}
|
62 |
62 |
break;
|
63 |
63 |
case BY_ORDER_INDEX_DESC:
|
64 |
64 |
if(!OrderedTermVocabulary.class.isAssignableFrom(type)) {
|
65 |
|
logger.warn( "BY_ORDER_INDEX_DESC not possible with " + type.getSimpleName() +" , falling back to ORDER_BY_TITLE_CACHE_DESC");
|
66 |
|
return OrderHintPreset.ORDER_BY_TITLE_CACHE_DESC;
|
|
65 |
logger.warn( "BY_ORDER_INDEX_DESC not possible with " + type.getSimpleName() +" , falling back to BY_TITLE_CACHE_DESC");
|
|
66 |
return OrderHintPreset.BY_TITLE_CACHE_DESC;
|
67 |
67 |
}
|
68 |
68 |
break;
|
69 |
69 |
default:
|
harmonizing OrderHintPresets