1
|
/**
|
2
|
* Copyright (C) 2016 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.persistence.query;
|
10
|
|
11
|
/**
|
12
|
* @author a.mueller
|
13
|
* @since 03.12.2016
|
14
|
*
|
15
|
*/
|
16
|
public enum TaxonTitleType {
|
17
|
TAXON, //Taxon title cache
|
18
|
NAME, //Name title cache
|
19
|
PURE_NAME; //Name name cache
|
20
|
|
21
|
/**
|
22
|
* @return
|
23
|
*/
|
24
|
public static TaxonTitleType DEFAULT() {
|
25
|
return TAXON;
|
26
|
}
|
27
|
|
28
|
public String hqlJoin(){
|
29
|
if (this == NAME || this == PURE_NAME){
|
30
|
return " LEFT JOIN c.name as n ";
|
31
|
}else{
|
32
|
return "";
|
33
|
}
|
34
|
}
|
35
|
|
36
|
public String hqlReplaceSelect(String select, String clazzPart){
|
37
|
if (this == NAME ){
|
38
|
return select.replace(clazzPart, "n.titleCache");
|
39
|
}else if (this == PURE_NAME){
|
40
|
return select.replace(clazzPart, "n.nameCache");
|
41
|
}else{
|
42
|
return select;
|
43
|
}
|
44
|
}
|
45
|
|
46
|
}
|