From 740cb3b5f3fd59ddac290eb266592166dd3bac42 Mon Sep 17 00:00:00 2001 From: "m.geoffroy" Date: Tue, 1 Jul 2008 09:08:44 +0000 Subject: [PATCH] --- .../cdm/model/name/BacterialName.java | 7 +- .../cdm/model/name/BotanicalName.java | 164 +++++++++++++++--- .../cdm/model/name/NonViralName.java | 9 +- .../cdm/model/name/TaxonNameBase.java | 5 +- .../cdm/model/name/ZoologicalName.java | 17 +- 5 files changed, 163 insertions(+), 39 deletions(-) diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/BacterialName.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/BacterialName.java index 5bd302b78b..9c6c14af5c 100644 --- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/BacterialName.java +++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/BacterialName.java @@ -51,6 +51,8 @@ public class BacterialName extends NonViralName { * only containing its {@link common.Rank rank}, * its {@link common.HomotypicalGroup homotypical group} and * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}. + * The new bacterial taxon name instance will be also added to the set of + * bacterial taxon names belonging to this homotypical group. * * @param rank the rank to be assigned to this bacterial taxon name * @param homotypicalGroup the homotypical group to which this bacterial taxon name belongs @@ -83,12 +85,11 @@ public class BacterialName extends NonViralName { /** * Creates a new bacterial taxon name instance - * only containing its {@link common.Rank rank} and + * only containing its {@link common.Rank rank}, * its {@link common.HomotypicalGroup homotypical group} and * the {@link eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy default cache strategy}. * The new bacterial taxon name instance will be also added to the set of - * bacterial taxon names belonging to this homotypical group. If the homotypical - * group does not exist a new instance will be created for it. + * bacterial taxon names belonging to this homotypical group. * * @param rank the rank to be assigned to this bacterial taxon name * @param homotypicalGroup the homotypical group to which this bacterial taxon name belongs diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/BotanicalName.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/BotanicalName.java index 1fde127a10..633aa00fb3 100644 --- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/BotanicalName.java +++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/BotanicalName.java @@ -35,7 +35,8 @@ import eu.etaxonomy.cdm.strategy.parser.INonViralNameParser; import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl; /** - * Taxon name class for plants + * The taxon name class for plants. + * * @author m.doering * @version 1.0 * @created 08-Nov-2007 13:06:15 @@ -79,25 +80,140 @@ public class BotanicalName extends NonViralName { static private INonViralNameParser nameParser = new NonViralNameParserImpl(); + // ************* CONSTRUCTORS *************/ + //needed by hibernate + /** + * Class constructor: creates a new botanical taxon name instance + * only containing the {@link eu.etaxonomy.cdm.strategy.cache.BotanicNameDefaultCacheStrategy default cache strategy}. + * + * @see #BotanicalName(Rank, HomotypicalGroup) + * @see #BotanicalName(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup) + * @see eu.etaxonomy.cdm.strategy.cache.BotanicNameDefaultCacheStrategy + */ + protected BotanicalName(){ + super(); + this.cacheStrategy = BotanicNameDefaultCacheStrategy.NewInstance(); + } + /** + * Class constructor: creates a new botanical taxon name instance + * only containing its {@link common.Rank rank}, + * its {@link common.HomotypicalGroup homotypical group} and + * the {@link eu.etaxonomy.cdm.strategy.cache.BotanicNameDefaultCacheStrategy default cache strategy}. + * The new botanical taxon name instance will be also added to the set of + * botanical taxon names belonging to this homotypical group. + * + * @param rank the rank to be assigned to this botanical taxon name + * @param homotypicalGroup the homotypical group to which this botanical taxon name belongs + * @see #BotanicalName() + * @see #BotanicalName(Rank, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup) + * @see eu.etaxonomy.cdm.strategy.cache.BotanicNameDefaultCacheStrategy + */ + protected BotanicalName(Rank rank, HomotypicalGroup homotypicalGroup) { + super(rank, homotypicalGroup); + this.cacheStrategy = BotanicNameDefaultCacheStrategy.NewInstance(); + } + /** + * Class constructor: creates a new botanical taxon name instance + * containing its {@link common.Rank rank}, + * its {@link common.HomotypicalGroup homotypical group}, + * its scientific name components, its {@link agent.TeamOrPersonBase author(team)}, + * its {@link reference.INomenclaturalReference nomenclatural reference} and + * the {@link eu.etaxonomy.cdm.strategy.cache.BotanicNameDefaultCacheStrategy default cache strategy}. + * The new botanical taxon name instance will be also added to the set of + * botanical taxon names belonging to this homotypical group. + * + * @param rank the rank to be assigned to this botanical taxon name + * @param genusOrUninomial the string for this botanical taxon name + * if its rank is genus or higher or for the genus part + * if its rank is lower than genus + * @param infraGenericEpithet the string for the first epithet of + * this botanical taxon name if its rank is lower than genus + * and higher than species aggregate + * @param specificEpithet the string for the first epithet of + * this botanical taxon name if its rank is species aggregate or lower + * @param infraSpecificEpithet the string for the second epithet of + * this botanical taxon name if its rank is lower than species + * @param combinationAuthorTeam the author or the team who published this botanical taxon name + * @param nomenclaturalReference the nomenclatural reference where this botanical taxon name was published + * @param nomenclMicroRef the string with the details for precise location within the nomenclatural reference + * @param homotypicalGroup the homotypical group to which this botanical taxon name belongs + * @see #BotanicalName() + * @see #BotanicalName(Rank, HomotypicalGroup) + * @see #NewInstance(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup) + * @see eu.etaxonomy.cdm.strategy.cache.BotanicNameDefaultCacheStrategy + * @see eu.etaxonomy.cdm.strategy.cache.INonViralNameCacheStrategy + * @see eu.etaxonomy.cdm.strategy.cache.IIdentifiableEntityCacheStrategy + */ + protected BotanicalName(Rank rank, String genusOrUninomial, String infraGenericEpithet, String specificEpithet, String infraSpecificEpithet, TeamOrPersonBase combinationAuthorTeam, INomenclaturalReference nomenclaturalReference, String nomenclMicroRef, HomotypicalGroup homotypicalGroup) { + super(rank, genusOrUninomial, infraGenericEpithet, specificEpithet, infraSpecificEpithet, combinationAuthorTeam, nomenclaturalReference, nomenclMicroRef, homotypicalGroup); + this.cacheStrategy = BotanicNameDefaultCacheStrategy.NewInstance(); + } + - /** - * @param rank - * @return + //********* METHODS **************************************/ + + /** + * Creates a new botanical taxon name instance + * only containing its {@link common.Rank rank} and + * the {@link eu.etaxonomy.cdm.strategy.cache.BotanicNameDefaultCacheStrategy default cache strategy}. + * + * @param rank the rank to be assigned to this botanical taxon name + * @see #BotanicalName(Rank, HomotypicalGroup) + * @see #NewInstance(Rank, HomotypicalGroup) + * @see #NewInstance(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup) + * @see eu.etaxonomy.cdm.strategy.cache.BotanicNameDefaultCacheStrategy */ public static BotanicalName NewInstance(Rank rank){ return new BotanicalName(rank, null); } - - - /** - * @param rank - * @param homotypicalGroup - * @return + /** + * Creates a new botanical taxon name instance + * only containing its {@link common.Rank rank}, + * its {@link common.HomotypicalGroup homotypical group} and + * the {@link eu.etaxonomy.cdm.strategy.cache.BotanicNameDefaultCacheStrategy default cache strategy}. + * The new botanical taxon name instance will be also added to the set of + * botanical taxon names belonging to this homotypical group. + * + * @param rank the rank to be assigned to this botanical taxon name + * @param homotypicalGroup the homotypical group to which this botanical taxon name belongs + * @see #NewInstance(Rank) + * @see #NewInstance(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup) + * @see #BotanicalName(Rank, HomotypicalGroup) + * @see eu.etaxonomy.cdm.strategy.cache.BotanicNameDefaultCacheStrategy */ public static BotanicalName NewInstance(Rank rank, HomotypicalGroup homotypicalGroup){ return new BotanicalName(rank, homotypicalGroup); } - + /** + * Creates a new botanical taxon name instance + * containing its {@link common.Rank rank}, + * its {@link common.HomotypicalGroup homotypical group}, + * its scientific name components, its {@link agent.TeamOrPersonBase author(team)}, + * its {@link reference.INomenclaturalReference nomenclatural reference} and + * the {@link eu.etaxonomy.cdm.strategy.cache.BotanicNameDefaultCacheStrategy default cache strategy}. + * The new botanical taxon name instance will be also added to the set of + * botanical taxon names belonging to this homotypical group. + * + * @param rank the rank to be assigned to this botanical taxon name + * @param genusOrUninomial the string for this botanical taxon name + * if its rank is genus or higher or for the genus part + * if its rank is lower than genus + * @param infraGenericEpithet the string for the first epithet of + * this botanical taxon name if its rank is lower than genus + * and higher than species aggregate + * @param specificEpithet the string for the first epithet of + * this botanical taxon name if its rank is species aggregate or lower + * @param infraSpecificEpithet the string for the second epithet of + * this botanical taxon name if its rank is lower than species + * @param combinationAuthorTeam the author or the team who published this botanical taxon name + * @param nomenclaturalReference the nomenclatural reference where this botanical taxon name was published + * @param nomenclMicroRef the string with the details for precise location within the nomenclatural reference + * @param homotypicalGroup the homotypical group to which this botanical taxon name belongs + * @see #NewInstance(Rank) + * @see #NewInstance(Rank, HomotypicalGroup) + * @see #ZoologicalName(Rank, String, String, String, String, TeamOrPersonBase, INomenclaturalReference, String, HomotypicalGroup) + * @see eu.etaxonomy.cdm.strategy.cache.BotanicNameDefaultCacheStrategy + */ public static BotanicalName NewInstance(Rank rank, String genusOrUninomial, String infraGenericEpithet, String specificEpithet, String infraSpecificEpithet, TeamOrPersonBase combinationAuthorTeam, INomenclaturalReference nomenclaturalReference, String nomenclMicroRef, HomotypicalGroup homotypicalGroup) { return new BotanicalName(rank, genusOrUninomial, infraGenericEpithet, specificEpithet, infraSpecificEpithet, combinationAuthorTeam, nomenclaturalReference, nomenclMicroRef, homotypicalGroup); } @@ -144,20 +260,6 @@ public class BotanicalName extends NonViralName { return (BotanicalName)nameParser.parseFullReference(fullNameAndReferenceString, NomenclaturalCode.ICBN(), rank); } - //needed by hibernate - protected BotanicalName(){ - super(); - this.cacheStrategy = BotanicNameDefaultCacheStrategy.NewInstance(); - } - protected BotanicalName(Rank rank, HomotypicalGroup homotypicalGroup) { - super(rank, homotypicalGroup); - this.cacheStrategy = BotanicNameDefaultCacheStrategy.NewInstance(); - } - protected BotanicalName(Rank rank, String genusOrUninomial, String infraGenericEpithet, String specificEpithet, String infraSpecificEpithet, TeamOrPersonBase combinationAuthorTeam, INomenclaturalReference nomenclaturalReference, String nomenclMicroRef, HomotypicalGroup homotypicalGroup) { - super(rank, genusOrUninomial, infraGenericEpithet, specificEpithet, infraSpecificEpithet, combinationAuthorTeam, nomenclaturalReference, nomenclMicroRef, homotypicalGroup); - this.cacheStrategy = BotanicNameDefaultCacheStrategy.NewInstance(); - } - @OneToMany @Cascade({CascadeType.SAVE_UPDATE, CascadeType.DELETE_ORPHAN}) @@ -193,6 +295,8 @@ public class BotanicalName extends NonViralName { } } + //if set: this name is a hybrid formula (a hybrid that does not have an own name) and no other hybrid flags may be set. A + //hybrid name may not have either an authorteam nor other name components. public boolean isHybridFormula(){ return this.isHybridFormula; } @@ -254,6 +358,16 @@ public class BotanicalName extends NonViralName { } + /** + * Returns the {@link NomenclaturalCode nomenclatural code} that governs + * the construction of this botanical taxon name, that is the + * International Code of Botanical Nomenclature. This method overrides + * the getNomeclaturalCode method from {@link TaxonNameBase#getNomeclaturalCode() TaxonNameBase}. + * + * @return the nomenclatural code for plants + * @see NonViralName#isCodeCompliant() + * @see TaxonNameBase#getHasProblem() + */ @Transient @Override public NomenclaturalCode getNomenclaturalCode(){ diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NonViralName.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NonViralName.java index 00edb9d7a5..0851595df1 100644 --- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NonViralName.java +++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NonViralName.java @@ -133,6 +133,8 @@ public class NonViralName extends TaxonNameBase extends TaxonNameBase extends TaxonNameBase