Revision e109fb7a
Added by Andreas Müller almost 7 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/taxon/TaxonBaseDefaultCacheStrategy.java | ||
---|---|---|
20 | 20 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
21 | 21 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
22 | 22 |
import eu.etaxonomy.cdm.model.reference.Reference; |
23 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
|
23 | 24 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
24 | 25 |
import eu.etaxonomy.cdm.strategy.StrategyBase; |
25 | 26 |
import eu.etaxonomy.cdm.strategy.cache.HTMLTagRules; |
... | ... | |
66 | 67 |
if (nameTags.size() > 0){ |
67 | 68 |
tags.addAll(nameTags); |
68 | 69 |
|
69 |
String secSeparator = " sec. "; |
|
70 |
boolean isSynonym = taxonBase.isInstanceOf(Synonym.class); |
|
71 |
String secSeparator = (isSynonym? " syn." : "") + " sec. "; |
|
70 | 72 |
//not used: we currently use a post-separator in the name tags |
71 | 73 |
// if (nameTags.get(nameTags.size() - 1).getType().equals(TagEnum.nomStatus)){ |
72 | 74 |
// secSeparator = "," + secSeparator; |
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/taxon/TaxonBaseShortSecCacheStrategy.java | ||
---|---|---|
24 | 24 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
25 | 25 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
26 | 26 |
import eu.etaxonomy.cdm.model.reference.Reference; |
27 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
|
27 | 28 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
28 | 29 |
import eu.etaxonomy.cdm.strategy.StrategyBase; |
29 | 30 |
import eu.etaxonomy.cdm.strategy.cache.HTMLTagRules; |
... | ... | |
53 | 54 |
}else{ |
54 | 55 |
title = "???"; |
55 | 56 |
} |
56 |
title += " sec. "; //TODO check if separator is required before, e.g. for nom. status. see TaxonBaseDefaultCacheStrategy |
|
57 |
boolean isSynonym = taxonBase.isInstanceOf(Synonym.class); |
|
58 |
String secSeparator = (isSynonym? " syn." : "") + " sec. "; |
|
59 |
title += secSeparator; //TODO check if separator is required before, e.g. for nom. status. see TaxonBaseDefaultCacheStrategy |
|
57 | 60 |
title += getSecundumPart(taxonBase); |
58 | 61 |
if (taxonBase.isDoubtful()){ |
59 | 62 |
title = "?" + title; |
... | ... | |
181 | 184 |
} |
182 | 185 |
if(! secTags.isEmpty()){ |
183 | 186 |
//sec. |
184 |
tags.add(new TaggedText(TagEnum.separator, "sec.")); |
|
187 |
boolean isSynonym = taxonBase.isInstanceOf(Synonym.class); |
|
188 |
String secSeparator = (isSynonym? " syn." : "") + " sec. "; |
|
189 |
tags.add(new TaggedText(TagEnum.separator, secSeparator)); |
|
185 | 190 |
tags.addAll(secTags); |
186 | 191 |
} |
187 | 192 |
} |
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/taxon/TaxonBaseDefaultCacheStrategyTest.java | ||
---|---|---|
29 | 29 |
//import eu.etaxonomy.cdm.model.reference.Book; |
30 | 30 |
import eu.etaxonomy.cdm.model.reference.Reference; |
31 | 31 |
import eu.etaxonomy.cdm.model.reference.ReferenceFactory; |
32 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
|
32 | 33 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
33 | 34 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
34 | 35 |
import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl; |
... | ... | |
122 | 123 |
assertEquals("Taxon titlecache is wrong", expectedNameTitleCache + ", nom. illeg., sec. Sp.Pl.", taxonBase.getTitleCache()); |
123 | 124 |
} |
124 | 125 |
|
126 |
//same as for accepted taxa but with syn. sec. instead of sec. |
|
127 |
@Test |
|
128 |
public void testSynSec() { |
|
129 |
Synonym taxonBase = Synonym.NewInstance(name, sec); |
|
130 |
assertEquals("Taxon titlecache is wrong", expectedNameTitleCache + " syn. sec. Sp.Pl.", taxonBase.getTitleCache()); |
|
131 |
//without sec. |
|
132 |
taxonBase.setSec(null); |
|
133 |
assertEquals("Taxon titlecache is wrong", expectedNameTitleCache + " syn. sec. ???", taxonBase.getTitleCache()); |
|
134 |
//appended phrase without sec. |
|
135 |
String appendedPhrase = "aff. 'schippii'"; |
|
136 |
taxonBase.setAppendedPhrase(appendedPhrase); |
|
137 |
assertEquals("Taxon titlecache is wrong", expectedNameTitleCache + " aff. 'schippii'", taxonBase.getTitleCache()); |
|
138 |
//appended phrase with sec. |
|
139 |
taxonBase.setSec(sec); |
|
140 |
assertEquals("Taxon titlecache is wrong", expectedNameTitleCache + " aff. 'schippii' syn. sec. Sp.Pl.", taxonBase.getTitleCache()); |
|
141 |
//use name cache |
|
142 |
taxonBase.setUseNameCache(true); |
|
143 |
assertEquals("Taxon titlecache is wrong", expectedNameCache + " aff. 'schippii' syn. sec. Sp.Pl.", taxonBase.getTitleCache()); |
|
144 |
taxonBase.setDoubtful(true); |
|
145 |
assertEquals("Taxon titlecache is wrong", "?" + expectedNameCache + " aff. 'schippii' syn. sec. Sp.Pl.", taxonBase.getTitleCache()); |
|
146 |
//with nom status |
|
147 |
taxonBase.setAppendedPhrase(null); |
|
148 |
taxonBase.setUseNameCache(false); |
|
149 |
taxonBase.setDoubtful(false); |
|
150 |
name.addStatus(NomenclaturalStatusType.ILLEGITIMATE(), null, null); |
|
151 |
assertEquals("Taxon titlecache is wrong", expectedNameTitleCache + ", nom. illeg., syn. sec. Sp.Pl.", taxonBase.getTitleCache()); |
|
152 |
} |
|
153 |
|
|
125 | 154 |
@Test |
126 | 155 |
public void testGetTitleCacheWithoutName() { |
127 | 156 |
TaxonBase<?> taxonBase = Taxon.NewInstance(null, sec); |
Also available in: Unified diff
Use syn. sec. instead of sec. for synonym sec references #5902