Revision 6dc12241
Added by Andreas Müller almost 8 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/taxon/TaxonBaseDefaultCacheStrategy.java | ||
---|---|---|
106 | 106 |
if (StringUtils.isNotBlank(taxonBase.getAppendedPhrase())){ |
107 | 107 |
tags.add(new TaggedText(TagEnum.appendedPhrase, taxonBase.getAppendedPhrase().trim())); |
108 | 108 |
} |
109 |
}else{ |
|
110 |
tags.add(new TaggedText(TagEnum.name, "???")); |
|
109 | 111 |
} |
110 | 112 |
return tags; |
111 | 113 |
} |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/taxon/TaxonBaseShortSecCacheStrategy.java | ||
---|---|---|
44 | 44 |
return uuid; |
45 | 45 |
} |
46 | 46 |
|
47 |
// @Override |
|
48 |
// public String getTitleCache(T taxonBase) { |
|
49 |
// return getTitleCache(taxonBase, null); |
|
50 |
// } |
|
51 | 47 |
|
52 | 48 |
@Override |
53 | 49 |
public String getTitleCache(T taxonBase) { |
54 | 50 |
String title; |
55 | 51 |
if (taxonBase.getName() != null && taxonBase.getName().getTitleCache() != null){ |
56 |
String namePart = getNamePart(taxonBase); |
|
57 |
|
|
58 |
title = namePart + " sec. "; //TODO check if separator is required before, e.g. for nom. status. see TaxonBaseDefaultCacheStrategy |
|
59 |
title += getSecundumPart(taxonBase); |
|
52 |
title = getNamePart(taxonBase); |
|
60 | 53 |
}else{ |
61 |
title = taxonBase.toString();
|
|
54 |
title = "???";
|
|
62 | 55 |
} |
56 |
title += " sec. "; //TODO check if separator is required before, e.g. for nom. status. see TaxonBaseDefaultCacheStrategy |
|
57 |
title += getSecundumPart(taxonBase); |
|
63 | 58 |
if (taxonBase.isDoubtful()){ |
64 | 59 |
title = "?" + title; |
65 | 60 |
} |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/taxon/TaxonBaseDefaultCacheStrategyTest.java | ||
---|---|---|
122 | 122 |
assertEquals("Taxon titlecache is wrong", expectedNameTitleCache + ", nom. illeg., sec. Sp.Pl.", taxonBase.getTitleCache()); |
123 | 123 |
} |
124 | 124 |
|
125 |
@Test |
|
126 |
public void testGetTitleCacheWithoutName() { |
|
127 |
TaxonBase<?> taxonBase = Taxon.NewInstance(null, sec); |
|
128 |
assertEquals("Taxon titlecache is wrong", "??? sec. Sp.Pl.", taxonBase.getTitleCache()); |
|
129 |
} |
|
130 |
|
|
125 | 131 |
//test missing "&" in title cache #3822 |
126 | 132 |
@Test |
127 | 133 |
public void testAndInTitleCache() { |
... | ... | |
154 | 160 |
taxonBase.setSecMicroReference(secMicroRef); |
155 | 161 |
assertEquals("Taxon titlecache is wrong", expectedNameTitleCache + " sec. Sp.Pl.: " + secMicroRef, |
156 | 162 |
taxonBase.getTitleCache()); |
157 |
|
|
158 |
|
|
159 | 163 |
} |
160 | 164 |
} |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/taxon/TaxonShortSecCacheStrategyTest.java | ||
---|---|---|
94 | 94 |
assertEquals("Taxon titlecache is wrong", expectedNameTitleCache + " aff. 'schippii' sec. Sp.Pl.", taxonBase.getTitleCache()); |
95 | 95 |
taxonBase.setUseNameCache(true); |
96 | 96 |
assertEquals("Taxon titlecache is wrong", expectedNameCache + " aff. 'schippii' sec. Sp.Pl.", taxonBase.getTitleCache()); |
97 |
|
|
98 |
|
|
99 | 97 |
} |
100 | 98 |
|
99 |
@Test |
|
100 |
public void testGetTitleCacheWithoutName() { |
|
101 |
TaxonBase taxonBase = Taxon.NewInstance(null, sec); |
|
102 |
taxonBase.setCacheStrategy(shortStrategy); |
|
103 |
assertEquals("Taxon titlecache is wrong", "??? sec. Sp.Pl.", taxonBase.getTitleCache()); |
|
104 |
} |
|
105 |
|
|
101 | 106 |
//test missing "&" in title cache #3822 |
102 | 107 |
@Test |
103 | 108 |
public void testAndInTitleCache() { |
... | ... | |
113 | 118 |
NonViralNameParserImpl.NewInstance().parseFullName(name, "Cichorium glandulosum Boiss. \u0026 A. Huet", null, true); |
114 | 119 |
Taxon taxon = Taxon.NewInstance(name, sec); |
115 | 120 |
assertEquals("Cichorium glandulosum Boiss. \u0026 A. Huet sec. Sp.Pl.", taxon.getTitleCache()); |
116 |
|
|
117 | 121 |
} |
118 | 122 |
|
119 | 123 |
@Test |
Also available in: Unified diff
Reflect missing name taxon cache strategies #5838