X-Git-Url: https://dev.e-taxonomy.eu/gitweb/cdmlib.git/blobdiff_plain/41b23b4eae7c4261ee4baaddb686bd8b3fc8db1f..9677085d08567ca5a55d2db7bf9660ab86cc3ee9:/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NomenclaturalCode.java diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NomenclaturalCode.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NomenclaturalCode.java index 172ca1855e..d022870c0a 100644 --- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NomenclaturalCode.java +++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NomenclaturalCode.java @@ -12,6 +12,10 @@ package eu.etaxonomy.cdm.model.name; import java.util.UUID; import javax.persistence.Entity; +import javax.persistence.Transient; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; import org.apache.log4j.Logger; import eu.etaxonomy.cdm.model.common.DefinedTermBase; @@ -22,6 +26,7 @@ import eu.etaxonomy.cdm.model.common.DefinedTermBase; * @created 19.05.2008 * @version 1.0 */ +@XmlAccessorType(XmlAccessType.FIELD) @Entity public class NomenclaturalCode extends DefinedTermBase { private static final Logger logger = Logger.getLogger(NomenclaturalCode.class); @@ -92,4 +97,25 @@ public class NomenclaturalCode extends DefinedTermBase { return getByUuid(uuidViral); } + @Transient + public TaxonNameBase getNewTaxonNameInstance(Rank rank){ + TaxonNameBase result; + if (this.equals(NomenclaturalCode.ICBN())){ + result = BotanicalName.NewInstance(rank); + }else if (this.equals(NomenclaturalCode.ICZN())){ + result = ZoologicalName.NewInstance(rank); + }else if (this.equals(NomenclaturalCode.ICNCP())){ + result = CultivarPlantName.NewInstance(rank); + }else if (this.equals(NomenclaturalCode.BACTERIOLOGICAL())){ + result = BacterialName.NewInstance(rank); + }else if (this.equals(NomenclaturalCode.VIRAL())){ + result = ViralName.NewInstance(rank); + }else { + logger.warn("Unknown nomenclatural code: " + this.getUuid()); + result = null; + } + return result; + } + + }