import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.name.HybridRelationship;
import eu.etaxonomy.cdm.model.name.INonViralName;
+import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
import eu.etaxonomy.cdm.model.name.Rank;
import eu.etaxonomy.cdm.model.name.TaxonName;
import eu.etaxonomy.cdm.strategy.cache.TagEnum;
private String basionymStart = "(";
private String basionymEnd = ")";
private String exAuthorSeperator = " ex ";
+ private String inAuthorSeperator = " in ";
private CharSequence basionymAuthorCombinationAuthorSeperator = " ";
private String zooAuthorYearSeperator = ", ";
TeamOrPersonBase<?> exCombinationAuthor = nonViralName.getExCombinationAuthorship();
TeamOrPersonBase<?> basionymAuthor = nonViralName.getBasionymAuthorship();
TeamOrPersonBase<?> exBasionymAuthor = nonViralName.getExBasionymAuthorship();
+ TeamOrPersonBase<?> inCombinationAuthor = null;
+ TeamOrPersonBase<?> inBasionymAuthor = null;
+ if (nonViralName.getNameType() == NomenclaturalCode.Fungi) {
+ //for now we format only fungi (and zoonames, but not here) with in-authors
+ inCombinationAuthor = nonViralName.getInCombinationAuthorship();
+ inBasionymAuthor = nonViralName.getInBasionymAuthorship();
+ }
if (isCultivar(nonViralName) ){
exCombinationAuthor = null;
basionymAuthor = null;
String basionymPart = "";
String authorPart = "";
//basionym
- if (basionymAuthor != null || exBasionymAuthor != null){
- basionymPart = basionymStart + getAuthorAndExAuthor(basionymAuthor, exBasionymAuthor) + basionymEnd;
+ if (basionymAuthor != null || exBasionymAuthor != null || inBasionymAuthor != null){
+ basionymPart = basionymStart + getAuthorAndExAndInAuthor(basionymAuthor, exBasionymAuthor, inBasionymAuthor) + basionymEnd;
}
- if (combinationAuthor != null || exCombinationAuthor != null){
- authorPart = getAuthorAndExAuthor(combinationAuthor, exCombinationAuthor);
+ if (combinationAuthor != null || exCombinationAuthor != null || inCombinationAuthor != null){
+ authorPart = getAuthorAndExAndInAuthor(combinationAuthor, exCombinationAuthor, inCombinationAuthor);
}
result = CdmUtils.concat(basionymAuthorCombinationAuthorSeperator, basionymPart, authorPart);
// if ("".equals(result)){
TeamOrPersonBase<?> exCombinationAuthor = nonViralName.getExCombinationAuthorship();
TeamOrPersonBase<?> basionymAuthor = nonViralName.getBasionymAuthorship();
TeamOrPersonBase<?> exBasionymAuthor = nonViralName.getExBasionymAuthorship();
+ TeamOrPersonBase<?> inCombinationAuthor = nonViralName.getInCombinationAuthorship();
+ TeamOrPersonBase<?> inBasionymAuthor = nonViralName.getInBasionymAuthorship();
Integer publicationYear = nonViralName.getPublicationYear();
Integer originalPublicationYear = nonViralName.getOriginalPublicationYear();
String authorPart = "";
//basionym
if (basionymAuthor != null || exBasionymAuthor != null || originalPublicationYear != null ){
- String authorAndEx = getAuthorAndExAuthor(basionymAuthor, exBasionymAuthor);
+ String authorAndEx = getAuthorAndExAndInAuthor(basionymAuthor, exBasionymAuthor, inBasionymAuthor);
String originalPublicationYearString = originalPublicationYear == null ? null : String.valueOf(originalPublicationYear);
String authorAndExAndYear = CdmUtils.concat(zooAuthorYearSeperator, authorAndEx, originalPublicationYearString );
basionymPart = basionymStart + authorAndExAndYear + basionymEnd;
}
if (combinationAuthor != null || exCombinationAuthor != null){
- String authorAndEx = getAuthorAndExAuthor(combinationAuthor, exCombinationAuthor);
+ String authorAndEx = getAuthorAndExAndInAuthor(combinationAuthor, exCombinationAuthor, inCombinationAuthor);
String publicationYearString = publicationYear == null ? null : String.valueOf(publicationYear);
authorPart = CdmUtils.concat(zooAuthorYearSeperator, authorAndEx, publicationYearString);
}
* combination authors as well as on basionym/orginal combination authors.
* The correct order is exAuthor ex author though some botanist do not know about and do it the
* other way round. (see 46.4-46.6 ICBN (Vienna Code, 2006))
+ * @param inAuthor
*/
- protected String getAuthorAndExAuthor(TeamOrPersonBase<?> author, TeamOrPersonBase<?> exAuthor){
+ protected String getAuthorAndExAndInAuthor(TeamOrPersonBase<?> author, TeamOrPersonBase<?> exAuthor, TeamOrPersonBase<?> inAuthor){
String authorString = "";
String exAuthorString = "";
+ String inAuthorString = "";
if (author != null){
authorString = getNomAuthorTitle(author);
}
if (exAuthor != null){
exAuthorString = getNomAuthorTitle(exAuthor);
- exAuthorString += exAuthorSeperator;
}
- String result = exAuthorString + authorString;
+ if (inAuthor != null){
+ inAuthorString = getNomAuthorTitle(inAuthor);
+ }
+ String result = CdmUtils.concat(inAuthorSeperator,
+ CdmUtils.concat(exAuthorSeperator, exAuthorString, authorString), inAuthorString);
return result;
}
import eu.etaxonomy.cdm.model.name.IBotanicalName;
import eu.etaxonomy.cdm.model.name.INonViralName;
import eu.etaxonomy.cdm.model.name.IZoologicalName;
+import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
import eu.etaxonomy.cdm.model.name.Rank;
private static final String authorString = "L.";
private static final String exAuthorString = "Exaut.";
+ private static final String inAuthorString = "Inaut. B.";
private static final String basAuthorString = "Basio, A.";
private static final String exBasAuthorString = "ExBas. N.";
+ private static final String inBasAuthorString = "Inbas., C.";
private static final String referenceTitle = "My Reference";
private TaxonName subSpeciesName;
private TeamOrPersonBase<?> author;
private TeamOrPersonBase<?> exAuthor;
+ private TeamOrPersonBase<?> inAuthor;
private TeamOrPersonBase<?> basAuthor;
private TeamOrPersonBase<?> exBasAuthor;
+ private TeamOrPersonBase<?> inBasAuthor;
private Reference citationRef;
@Before
author = Person.NewInstance();
author.setNomenclaturalTitleCache(authorString, true);
exAuthor = Person.NewInstance();
- exAuthor.setNomenclaturalTitleCache(exAuthorString, true);
+ exAuthor.setNomenclaturalTitleCache(inAuthorString, true);
+ inAuthor = Person.NewInstance();
+ inAuthor.setNomenclaturalTitleCache(inAuthorString, true);
basAuthor = Person.NewInstance();
basAuthor.setNomenclaturalTitleCache(basAuthorString, true);
exBasAuthor = Person.NewInstance();
exBasAuthor.setNomenclaturalTitleCache(exBasAuthorString, true);
+ inBasAuthor = Person.NewInstance();
+ inBasAuthor.setNomenclaturalTitleCache(inBasAuthorString, true);
citationRef = ReferenceFactory.newGeneric();
citationRef.setTitle(referenceTitle);
Assert.assertEquals("", "Ophrys kastelli (Mill. & al.) Mill. & al.", formatter.getTitleCache(name));
}
+
+ @Test //#7443
+ public void testInAuthors() {
+ //base configuration
+ speciesName.setCombinationAuthorship(author);
+ speciesName.setBasionymAuthorship(basAuthor);
+ String expectedWithoutInAuthor = speciesNameString + " (" + basAuthorString + ") " + authorString;
+ Assert.assertEquals(expectedWithoutInAuthor, speciesName.getTitleCache());
+
+ //with in-authors
+ speciesName.setNameType(NomenclaturalCode.Fungi);
+ speciesName.setInBasionymAuthorship(inBasAuthor);
+ speciesName.setInCombinationAuthorship(inAuthor);
+ String expectedWithInAuthor = speciesNameString + " (" + basAuthorString + " in "+inBasAuthorString+") " + authorString + " in "+inAuthorString;
+ speciesName.setTitleCache(null, false);
+ Assert.assertEquals(expectedWithInAuthor, speciesName.getTitleCache());
+
+ //... for zoo-names
+ speciesName.setNameType(NomenclaturalCode.ICZN);
+ speciesName.setTitleCache(null, false);
+ Assert.assertEquals(expectedWithInAuthor, speciesName.getTitleCache());
+
+ //... for botanical names
+ speciesName.setNameType(NomenclaturalCode.ICNAFP);
+ speciesName.setTitleCache(null, false);
+ Assert.assertEquals("For now we do not allow in-authors for botanical names (except for fungi)",
+ expectedWithoutInAuthor, speciesName.getTitleCache());
+ }
}
\ No newline at end of file