X-Git-Url: https://dev.e-taxonomy.eu/gitweb/cdmlib.git/blobdiff_plain/57606ee3dcf9db7efd1b7a5220ad8d53f4200d97..b714e9868589a27627e3e0349a078273ff47eec8:/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NonViralName.java 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 31b7b6046f..272448f1e4 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 @@ -1,8 +1,8 @@ /** * Copyright (C) 2007 EDIT -* European Distributed Institute of Taxonomy +* European Distributed Institute of Taxonomy * http://www.e-taxonomy.eu -* +* * The contents of this file are subject to the Mozilla Public License Version 1.1 * See LICENSE.TXT at the top of this package for the full license terms. */ @@ -10,7 +10,13 @@ package eu.etaxonomy.cdm.model.name; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.ArrayList; +import java.util.Collections; import java.util.HashSet; +import java.util.List; +import java.util.Map; import java.util.Set; import javax.persistence.Entity; @@ -18,6 +24,9 @@ import javax.persistence.FetchType; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Transient; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; @@ -32,30 +41,41 @@ import org.hibernate.annotations.Cascade; import org.hibernate.annotations.CascadeType; import org.hibernate.annotations.Target; import org.hibernate.envers.Audited; +import org.hibernate.search.annotations.Analyze; import org.hibernate.search.annotations.Field; import org.hibernate.search.annotations.Fields; -import org.hibernate.search.annotations.Index; import org.hibernate.search.annotations.Indexed; +import org.hibernate.search.annotations.IndexedEmbedded; +import org.hibernate.validator.constraints.NotEmpty; import org.springframework.beans.factory.annotation.Configurable; +import eu.etaxonomy.cdm.common.CdmUtils; import eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor; import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; +import eu.etaxonomy.cdm.model.common.CdmBase; import eu.etaxonomy.cdm.model.common.RelationshipBase; import eu.etaxonomy.cdm.model.reference.INomenclaturalReference; -import eu.etaxonomy.cdm.model.reference.ReferenceBase; +import eu.etaxonomy.cdm.model.reference.Reference; +import eu.etaxonomy.cdm.strategy.cache.name.CacheUpdate; import eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy; import eu.etaxonomy.cdm.strategy.cache.name.NonViralNameDefaultCacheStrategy; import eu.etaxonomy.cdm.strategy.match.Match; -import eu.etaxonomy.cdm.strategy.match.MatchMode; import eu.etaxonomy.cdm.strategy.match.Match.ReplaceMode; +import eu.etaxonomy.cdm.strategy.match.MatchMode; import eu.etaxonomy.cdm.strategy.merge.Merge; import eu.etaxonomy.cdm.strategy.merge.MergeMode; +import eu.etaxonomy.cdm.validation.Level2; +import eu.etaxonomy.cdm.validation.Level3; +import eu.etaxonomy.cdm.validation.annotation.CorrectEpithetsForRank; +import eu.etaxonomy.cdm.validation.annotation.MustHaveAuthority; +import eu.etaxonomy.cdm.validation.annotation.NoDuplicateNames; +import eu.etaxonomy.cdm.validation.annotation.NullOrNotEmpty; /** * The taxon name class for all non viral taxa. Parenthetical authorship is derived * from basionym relationship. The scientific name including author strings and * maybe year can be stored as a string in the inherited {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity#getTitleCache() titleCache} attribute. - * The year itself is an information obtained from the {@link eu.etaxonomy.cdm.model.reference.ReferenceBase#getYear() nomenclatural reference}. + * The year itself is an information obtained from the {@link eu.etaxonomy.cdm.model.reference.Reference#getYear() nomenclatural reference}. * The scientific name string without author strings and year can be stored in the {@link #getNameCache() nameCache} attribute. *
* This class corresponds partially to:
- * The presence of an author (team) of this non viral taxon name is a
- * condition for the existence of an ex author (team) for this same name.
- *
- * @return the nomenclatural ex author (team) of this non viral taxon name
- * @see #getCombinationAuthorTeam()
- * @see eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor
- * @see eu.etaxonomy.cdm.model.agent.TeamOrPersonBase#getNomenclaturalTitle()
- */
- public INomenclaturalAuthor getExCombinationAuthorTeam(){
- return this.exCombinationAuthorTeam;
- }
-
- /**
- * @see #getExCombinationAuthorTeam()
- */
- public void setExCombinationAuthorTeam(INomenclaturalAuthor exCombinationAuthorTeam){
- this.exCombinationAuthorTeam = exCombinationAuthorTeam;
- }
-
- /**
- * Returns the {@link eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor author (team)} that published the original combination
- * on which this non viral taxon name is nomenclaturally based. Such an
- * author (team) can only exist if this non viral taxon name is a new
- * combination due to a taxonomical revision.
- *
- * @return the nomenclatural basionym author (team) of this non viral taxon name
- * @see #getCombinationAuthorTeam()
- * @see eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor
- * @see eu.etaxonomy.cdm.model.agent.TeamOrPersonBase#getNomenclaturalTitle()
- */
- public INomenclaturalAuthor getBasionymAuthorTeam(){
- return basionymAuthorTeam;
- }
-
- /**
- * @see #getBasionymAuthorTeam()
- */
- public void setBasionymAuthorTeam(INomenclaturalAuthor basionymAuthorTeam) {
- this.basionymAuthorTeam = basionymAuthorTeam;
- }
-
- /**
- * Returns the {@link eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor author (team)} that contributed to
- * the publication of the original combination this non viral taxon name is
- * based on. This should have been generally stated by
- * the {@link #getBasionymAuthorTeam() basionym author (team)} itself.
- * The presence of a basionym author (team) of this non viral taxon name is a
- * condition for the existence of an ex basionym author (team)
- * for this same name.
- *
- * @return the nomenclatural ex basionym author (team) of this non viral taxon name
- * @see #getBasionymAuthorTeam()
- * @see #getExCombinationAuthorTeam()
- * @see #getCombinationAuthorTeam()
- * @see eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor
- * @see eu.etaxonomy.cdm.model.agent.TeamOrPersonBase#getNomenclaturalTitle()
- */
- public INomenclaturalAuthor getExBasionymAuthorTeam(){
- return exBasionymAuthorTeam;
- }
-
- /**
- * @see #getExBasionymAuthorTeam()
- */
- public void setExBasionymAuthorTeam(INomenclaturalAuthor exBasionymAuthorTeam) {
- this.exBasionymAuthorTeam = exBasionymAuthorTeam;
- }
- /**
- * Returns either the scientific name string (without authorship) for this
- * non viral taxon name if its rank is genus or higher (monomial) or the string for
- * the genus part of it if its {@link Rank rank} is lower than genus (bi- or trinomial).
- * Genus or uninomial strings begin with an upper case letter.
- *
- * @return the string containing the suprageneric name, the genus name or the genus part of this non viral taxon name
- * @see #getNameCache()
- */
- public String getGenusOrUninomial() {
- return genusOrUninomial;
- }
-
- /**
- * @see #getGenusOrUninomial()
- */
- public void setGenusOrUninomial(String genusOrUninomial) {
- this.genusOrUninomial = genusOrUninomial;
- }
-
- /**
- * Returns the genus subdivision epithet string (infrageneric part) for
- * this non viral taxon name if its {@link Rank rank} is infrageneric (lower than genus and
- * higher than species aggregate: binomial). Genus subdivision epithet
- * strings begin with an upper case letter.
- *
- * @return the string containing the infrageneric part of this non viral taxon name
- * @see #getNameCache()
- */
- public String getInfraGenericEpithet(){
- return this.infraGenericEpithet;
- }
-
- /**
- * @see #getInfraGenericEpithet()
- */
- public void setInfraGenericEpithet(String infraGenericEpithet){
- this.infraGenericEpithet = infraGenericEpithet;
- }
-
- /**
- * Returns the species epithet string for this non viral taxon name if its {@link Rank rank} is
- * species aggregate or lower (bi- or trinomial). Species epithet strings
- * begin with a lower case letter.
- *
- * @return the string containing the species epithet of this non viral taxon name
- * @see #getNameCache()
- */
- public String getSpecificEpithet(){
- return this.specificEpithet;
- }
-
- /**
- * @see #getSpecificEpithet()
- */
- public void setSpecificEpithet(String specificEpithet){
- this.specificEpithet = specificEpithet;
- }
-
- /**
- * Returns the species subdivision epithet string (infraspecific part) for
- * this non viral taxon name if its {@link Rank rank} is infraspecific
- * (lower than species: trinomial). Species subdivision epithet strings
- * begin with a lower case letter.
- *
- * @return the string containing the infraspecific part of this non viral taxon name
- * @see #getNameCache()
- */
- public String getInfraSpecificEpithet(){
- return this.infraSpecificEpithet;
- }
-
- /**
- * @see #getInfraSpecificEpithet()
- */
- public void setInfraSpecificEpithet(String infraSpecificEpithet){
- this.infraSpecificEpithet = infraSpecificEpithet;
- }
-
- /**
- * Generates and returns the string with the scientific name of this
- * non viral taxon name including author strings and maybe year according to
- * the strategy defined in
- * {@link eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy INonViralNameCacheStrategy}.
- * This string may be stored in the inherited
- * {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity#getTitleCache() titleCache} attribute.
- * This method overrides the generic and inherited
- * TaxonNameBase#generateTitle() method.
- *
- * @return the string with the composed name of this non viral taxon name with authorship (and maybe year)
- * @see eu.etaxonomy.cdm.model.common.IdentifiableEntity#generateTitle()
- * @see eu.etaxonomy.cdm.model.common.IdentifiableEntity#getTitleCache()
- * @see TaxonNameBase#generateTitle()
- */
+ //nameCache
+ if (fieldHasCacheUpdateProperty(e.getPropertyName(), "nameCache")){
+ if (protectedNameCache){
+ protectedByLowerCache = true;
+ }else{
+ nameCache = null;
+ }
+ }
+ //title cache
+ if (! fieldHasNoUpdateProperty(e.getPropertyName(), "titleCache")){
+ if (isProtectedTitleCache()|| protectedByLowerCache == true ){
+ protectedByLowerCache = true;
+ }else{
+ titleCache = null;
+ }
+ }
+ //full title cache
+ if (! fieldHasNoUpdateProperty(e.getPropertyName(), "fullTitleCache")){
+ if (isProtectedFullTitleCache()|| protectedByLowerCache == true ){
+ protectedByLowerCache = true;
+ }else{
+ fullTitleCache = null;
+ }
+ }
+ }
+ };
+ addPropertyChangeListener(listener); //didn't use this.addXXX to make lsid.AssemblerTest run in cdmlib-remote
+ }
+
+ private static Map
+ * The presence of an author (team) of this non viral taxon name is a
+ * condition for the existence of an ex author (team) for this same name.
+ *
+ * @return the nomenclatural ex author (team) of this non viral taxon name
+ * @see #getCombinationAuthorTeam()
+ * @see eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor
+ * @see eu.etaxonomy.cdm.model.agent.TeamOrPersonBase#getNomenclaturalTitle()
+ */
+ public INomenclaturalAuthor getExCombinationAuthorTeam(){
+ return this.exCombinationAuthorTeam;
+ }
+
+ /**
+ * @see #getExCombinationAuthorTeam()
+ */
+ public void setExCombinationAuthorTeam(INomenclaturalAuthor exCombinationAuthorTeam){
+ this.exCombinationAuthorTeam = exCombinationAuthorTeam;
+ }
+
+ /**
+ * Returns the {@link eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor author (team)} that published the original combination
+ * on which this non viral taxon name is nomenclaturally based. Such an
+ * author (team) can only exist if this non viral taxon name is a new
+ * combination due to a taxonomical revision.
+ *
+ * @return the nomenclatural basionym author (team) of this non viral taxon name
+ * @see #getCombinationAuthorTeam()
+ * @see eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor
+ * @see eu.etaxonomy.cdm.model.agent.TeamOrPersonBase#getNomenclaturalTitle()
+ */
+ public INomenclaturalAuthor getBasionymAuthorTeam(){
+ return basionymAuthorTeam;
+ }
+
+ /**
+ * @see #getBasionymAuthorTeam()
+ */
+ public void setBasionymAuthorTeam(INomenclaturalAuthor basionymAuthorTeam) {
+ this.basionymAuthorTeam = basionymAuthorTeam;
+ }
+
+ /**
+ * Returns the {@link eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor author (team)} that contributed to
+ * the publication of the original combination this non viral taxon name is
+ * based on. This should have been generally stated by
+ * the {@link #getBasionymAuthorTeam() basionym author (team)} itself.
+ * The presence of a basionym author (team) of this non viral taxon name is a
+ * condition for the existence of an ex basionym author (team)
+ * for this same name.
+ *
+ * @return the nomenclatural ex basionym author (team) of this non viral taxon name
+ * @see #getBasionymAuthorTeam()
+ * @see #getExCombinationAuthorTeam()
+ * @see #getCombinationAuthorTeam()
+ * @see eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor
+ * @see eu.etaxonomy.cdm.model.agent.TeamOrPersonBase#getNomenclaturalTitle()
+ */
+ public INomenclaturalAuthor getExBasionymAuthorTeam(){
+ return exBasionymAuthorTeam;
+ }
+
+ /**
+ * @see #getExBasionymAuthorTeam()
+ */
+ public void setExBasionymAuthorTeam(INomenclaturalAuthor exBasionymAuthorTeam) {
+ this.exBasionymAuthorTeam = exBasionymAuthorTeam;
+ }
+ /**
+ * Returns either the scientific name string (without authorship) for this
+ * non viral taxon name if its rank is genus or higher (monomial) or the string for
+ * the genus part of it if its {@link Rank rank} is lower than genus (bi- or trinomial).
+ * Genus or uninomial strings begin with an upper case letter.
+ *
+ * @return the string containing the suprageneric name, the genus name or the genus part of this non viral taxon name
+ * @see #getNameCache()
+ */
+ public String getGenusOrUninomial() {
+ return genusOrUninomial;
+ }
+
+ /**
+ * @see #getGenusOrUninomial()
+ */
+ public void setGenusOrUninomial(String genusOrUninomial) {
+ this.genusOrUninomial = genusOrUninomial;
+ }
+
+ /**
+ * Returns the genus subdivision epithet string (infrageneric part) for
+ * this non viral taxon name if its {@link Rank rank} is infrageneric (lower than genus and
+ * higher than species aggregate: binomial). Genus subdivision epithet
+ * strings begin with an upper case letter.
+ *
+ * @return the string containing the infrageneric part of this non viral taxon name
+ * @see #getNameCache()
+ */
+ public String getInfraGenericEpithet(){
+ return this.infraGenericEpithet;
+ }
+
+ /**
+ * @see #getInfraGenericEpithet()
+ */
+ public void setInfraGenericEpithet(String infraGenericEpithet){
+ this.infraGenericEpithet = infraGenericEpithet;
+ }
+
+ /**
+ * Returns the species epithet string for this non viral taxon name if its {@link Rank rank} is
+ * species aggregate or lower (bi- or trinomial). Species epithet strings
+ * begin with a lower case letter.
+ *
+ * @return the string containing the species epithet of this non viral taxon name
+ * @see #getNameCache()
+ */
+ public String getSpecificEpithet(){
+ return this.specificEpithet;
+ }
+
+ /**
+ * @see #getSpecificEpithet()
+ */
+ public void setSpecificEpithet(String specificEpithet){
+ this.specificEpithet = specificEpithet;
+ }
+
+ /**
+ * Returns the species subdivision epithet string (infraspecific part) for
+ * this non viral taxon name if its {@link Rank rank} is infraspecific
+ * (lower than species: trinomial). Species subdivision epithet strings
+ * begin with a lower case letter.
+ *
+ * @return the string containing the infraspecific part of this non viral taxon name
+ * @see #getNameCache()
+ */
+ public String getInfraSpecificEpithet(){
+ return this.infraSpecificEpithet;
+ }
+
+ /**
+ * @see #getInfraSpecificEpithet()
+ */
+ public void setInfraSpecificEpithet(String infraSpecificEpithet){
+ this.infraSpecificEpithet = infraSpecificEpithet;
+ }
+
+ /**
+ * Generates and returns the string with the scientific name of this
+ * non viral taxon name including author strings and maybe year according to
+ * the strategy defined in
+ * {@link eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy INonViralNameCacheStrategy}.
+ * This string may be stored in the inherited
+ * {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity#getTitleCache() titleCache} attribute.
+ * This method overrides the generic and inherited
+ * TaxonNameBase#generateTitle() method.
+ *
+ * @return the string with the composed name of this non viral taxon name with authorship (and maybe year)
+ * @see eu.etaxonomy.cdm.model.common.IdentifiableEntity#generateTitle()
+ * @see eu.etaxonomy.cdm.model.common.IdentifiableEntity#getTitleCache()
+ * @see TaxonNameBase#generateTitle()
+ */
// @Override
// public String generateTitle(){
// if (cacheStrategy == null){
@@ -559,522 +706,739 @@ public class NonViralName
+ * An ex-author(-team) is an author(-team) to whom a taxon name was ascribed
+ * although it is not the author(-team) of a valid publication (for instance
+ * without the validating description or diagnosis in case of a name for a
+ * new taxon). The name of this ascribed authorship, followed by "ex", may
+ * be inserted before the name(s) of the publishing author(s) of the validly
+ * published name:
+ * Lilium tianschanicum was described by Grubov (1977) as a new species and
+ * its name was ascribed to Ivanova; since there is no indication that
+ * Ivanova provided the validating description, the name may be cited as
+ * Lilium tianschanicum N. A. Ivanova ex Grubov or Lilium tianschanicum Grubov.
+ * true
.
- *
- * @param nameCache the string which identifies this non viral taxon name (without authors or year)
- * @see #getNameCache()
- */
- public void setNameCache(String nameCache){
- setNameCache(nameCache, true);
- }
-
- /**
- * Assigns a nameCache string to this non viral taxon name and protects it from being overwritten.
- * Sets the protectedNameCache flag to true
.
- *
- * @param nameCache the string which identifies this non viral taxon name (without authors or year)
- * @param protectedNameCache if true teh protectedNameCache is set to true
or otherwise set to
- * false
- * @see #getNameCache()
- */
- public void setNameCache(String nameCache, boolean protectedNameCache){
- this.nameCache = nameCache;
- //this.setProtectedTitleCache(false); //now handled by propertyChangeListener
- this.setProtectedNameCache(protectedNameCache);
- }
-
- /**
- * Returns the boolean value of the flag intended to protect (true)
- * or not (false) the {@link #getNameCache() nameCache} (scientific name without author strings and year)
- * string of this non viral taxon name.
- *
- * @return the boolean value of the protectedNameCache flag
- * @see #getNameCache()
- */
- public boolean isProtectedNameCache() {
- return protectedNameCache;
- }
-
- /**
- * @see #isProtectedNameCache()
- */
- public void setProtectedNameCache(boolean protectedNameCache) {
- this.protectedNameCache = protectedNameCache;
- }
-
-
- /**
- * Generates and returns a concatenated and formated authorteams string
- * including basionym and combination authors of this non viral taxon name
- * according to the strategy defined in
- * {@link eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy#getAuthorshipCache(NonViralName) INonViralNameCacheStrategy}.
- *
- * @return the string with the concatenated and formated authorteams for this non viral taxon name
- * @see eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy#getAuthorshipCache(NonViralName)
- */
- public String generateAuthorship(){
- if (cacheStrategy == null){
- logger.warn("No CacheStrategy defined for nonViralName: " + this.getUuid());
- return null;
- }else{
- return ((INonViralNameCacheStrategytrue
.
- *
- * @param authorshipCache the string which identifies the complete authorship of this non viral taxon name
- * @see #getAuthorshipCache()
- */
- public void setAuthorshipCache(String authorshipCache) {
- setAuthorshipCache(authorshipCache, true);
- }
-
- /**
- * Assigns an authorshipCache string to this non viral taxon name.
- *
- * @param authorshipCache the string which identifies the complete authorship of this non viral taxon name
- * @param protectedAuthorshipCache if true the isProtectedAuthorshipCache flag is set to true
, otherwise
- * the flag is set to false
.
- * @see #getAuthorshipCache()
- */
- public void setAuthorshipCache(String authorshipCache, boolean protectedAuthorshipCache) {
- this.authorshipCache = authorshipCache;
- //TODO hibernate safe?
- if (! this.isProtectedTitleCache()){
- this.setTitleCache(null, false);
- }
- this.setProtectedAuthorshipCache(protectedAuthorshipCache);
- }
-
- public void setTitleCache(String titleCache, boolean protectCache){
- super.setTitleCache(titleCache, protectCache);
- if (! this.isProtectedFullTitleCache()){
- this.fullTitleCache = null;
- }
- }
-
- /**
- * Returns the boolean value "false" since the components of this taxon name
- * cannot follow the rules of a corresponding {@link NomenclaturalCode nomenclatural code}
- * which is not defined for this class. The nomenclature code depends on
- * the concrete name subclass ({@link BacterialName BacterialName},
- * {@link BotanicalName BotanicalName}, {@link CultivarPlantName CultivarPlantName} or
- * {@link ZoologicalName ZoologicalName} to which this non viral taxon name belongs.
- * This method overrides the isCodeCompliant method from the abstract
- * {@link TaxonNameBase#isCodeCompliant() TaxonNameBase} class.
- *
- * @return false
- * @see TaxonNameBase#isCodeCompliant()
- */
- @Override
- @Transient
- public boolean isCodeCompliant() {
- //FIXME
- logger.warn("is CodeCompliant not yet implemented");
- return false;
- }
-
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.model.name.TaxonNameBase#getNomeclaturalCode()
- */
- /**
- * Returns null as {@link NomenclaturalCode nomenclatural code} that governs
- * the construction of this non viral taxon name since there is no specific
- * nomenclatural code defined. The real implementention takes place in the
- * subclasses {@link BacterialName BacterialName},
- * {@link BotanicalName BotanicalName}, {@link CultivarPlantName CultivarPlantName} and
- * {@link ZoologicalName ZoologicalName}.
- * This method overrides the getNomeclaturalCode method from {@link TaxonNameBase TaxonNameBase}.
- *
- * @return null
- * @see #isCodeCompliant()
- * @see TaxonNameBase#getHasProblem()
- */
- @Override
- @Transient
- public NomenclaturalCode getNomenclaturalCode() {
- logger.warn("Non Viral Name has no specific Code defined. Use subclasses");
- return null;
- }
-
- /**
- * Returns the boolean value of the flag intended to protect (true)
- * or not (false) the {@link #getAuthorshipCache() authorshipCache} (complete authorship string)
- * of this non viral taxon name.
- *
- * @return the boolean value of the protectedAuthorshipCache flag
- * @see #getAuthorshipCache()
- */
- public boolean isProtectedAuthorshipCache() {
- return protectedAuthorshipCache;
- }
-
- /**
- * @see #isProtectedAuthorshipCache()
- * @see #getAuthorshipCache()
- */
- public void setProtectedAuthorshipCache(boolean protectedAuthorshipCache) {
- this.protectedAuthorshipCache = protectedAuthorshipCache;
- if (protectedAuthorshipCache == false){
- if (! this.isProtectedFullTitleCache()){
- this.setFullTitleCache(null, false);
- }
- }
- }
-
-
- /**
- * Returns the boolean value of the flag indicating whether the name of this
- * botanical taxon name is a hybrid formula (true) or not (false). A hybrid
- * named by a hybrid formula (composed with its parent names by placing the
- * multiplication sign between them) does not have an own published name
- * and therefore has neither an {@link NonViralName#getAuthorshipCache() autorship}
- * nor other name components. If this flag is set no other hybrid flags may
- * be set.
- *
- * @return the boolean value of the isHybridFormula flag
- * @see #isMonomHybrid()
- * @see #isBinomHybrid()
- * @see #isTrinomHybrid()
- */
- public boolean isHybridFormula(){
- return this.hybridFormula;
- }
-
- /**
- * @see #isHybridFormula()
- */
- public void setHybridFormula(boolean hybridFormula){
- this.hybridFormula = hybridFormula;
- }
-
- /**
- * Returns the boolean value of the flag indicating whether this botanical
- * taxon name is the name of an intergeneric hybrid (true) or not (false).
- * In this case the multiplication sign is placed before the scientific
- * name. If this flag is set no other hybrid flags may be set.
- *
- * @return the boolean value of the isMonomHybrid flag
- * @see #isHybridFormula()
- * @see #isBinomHybrid()
- * @see #isTrinomHybrid()
- */
- public boolean isMonomHybrid(){
- return this.monomHybrid;
- }
-
- /**
- * @see #isMonomHybrid()
- * @see #isBinomHybrid()
- * @see #isTrinomHybrid()
- */
- public void setMonomHybrid(boolean monomHybrid){
- this.monomHybrid = monomHybrid;
- }
-
- /**
- * Returns the boolean value of the flag indicating whether this botanical
- * taxon name is the name of an interspecific hybrid (true) or not (false).
- * In this case the multiplication sign is placed before the species
- * epithet. If this flag is set no other hybrid flags may be set.
- *
- * @return the boolean value of the isBinomHybrid flag
- * @see #isHybridFormula()
- * @see #isMonomHybrid()
- * @see #isTrinomHybrid()
- */
- public boolean isBinomHybrid(){
- return this.binomHybrid;
- }
-
- /**
- * @see #isBinomHybrid()
- * @see #isMonomHybrid()
- * @see #isTrinomHybrid()
- */
- public void setBinomHybrid(boolean binomHybrid){
- this.binomHybrid = binomHybrid;
- }
-
- /**
- * Returns the boolean value of the flag indicating whether this botanical
- * taxon name is the name of an infraspecific hybrid (true) or not (false).
- * In this case the term "notho-" (optionally abbreviated "n-") is used as
- * a prefix to the term denoting the infraspecific rank of this botanical
- * taxon name. If this flag is set no other hybrid flags may be set.
- *
- * @return the boolean value of the isTrinomHybrid flag
- * @see #isHybridFormula()
- * @see #isMonomHybrid()
- * @see #isBinomHybrid()
- */
- public boolean isTrinomHybrid(){
- return this.trinomHybrid;
- }
-
- /**
- * @see #isTrinomHybrid()
- * @see #isBinomHybrid()
- * @see #isMonomHybrid()
- */
- public void setTrinomHybrid(boolean trinomHybrid){
- this.trinomHybrid = trinomHybrid;
- }
-
- /**
- * Returns the set of all {@link HybridRelationship hybrid relationships}
- * in which this taxon name is involved as a {@link common.RelationshipBase#getRelatedFrom() parent}.
- *
- * @see #getHybridRelationships()
- * @see #getChildRelationships()
- * @see HybridRelationshipType
- */
- public Settrue
.
+ *
+ * @param nameCache the string which identifies this non viral taxon name (without authors or year)
+ * @see #getNameCache()
+ */
+ public void setNameCache(String nameCache){
+ setNameCache(nameCache, true);
+ }
+
+ /**
+ * Assigns a nameCache string to this non viral taxon name and protects it from being overwritten.
+ * Sets the protectedNameCache flag to true
.
+ *
+ * @param nameCache the string which identifies this non viral taxon name (without authors or year)
+ * @param protectedNameCache if true teh protectedNameCache is set to true
or otherwise set to
+ * false
+ * @see #getNameCache()
+ */
+ public void setNameCache(String nameCache, boolean protectedNameCache){
+ this.nameCache = nameCache;
+ this.setProtectedNameCache(protectedNameCache);
+ }
+
+ /**
+ * Returns the boolean value of the flag intended to protect (true)
+ * or not (false) the {@link #getNameCache() nameCache} (scientific name without author strings and year)
+ * string of this non viral taxon name.
+ *
+ * @return the boolean value of the protectedNameCache flag
+ * @see #getNameCache()
+ */
+ public boolean isProtectedNameCache() {
+ return protectedNameCache;
+ }
+
+ /**
+ * @see #isProtectedNameCache()
+ */
+ public void setProtectedNameCache(boolean protectedNameCache) {
+ this.protectedNameCache = protectedNameCache;
+ }
+
+
+ /**
+ * Generates and returns a concatenated and formated authorteams string
+ * including basionym and combination authors of this non viral taxon name
+ * according to the strategy defined in
+ * {@link eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy#getAuthorshipCache(NonViralName) INonViralNameCacheStrategy}.
+ *
+ * @return the string with the concatenated and formated authorteams for this non viral taxon name
+ * @see eu.etaxonomy.cdm.strategy.cache.name.INonViralNameCacheStrategy#getAuthorshipCache(NonViralName)
+ */
+ public String generateAuthorship(){
+ if (cacheStrategy == null){
+ logger.warn("No CacheStrategy defined for nonViralName: " + this.getUuid());
+ return null;
+ }else{
+ return ((INonViralNameCacheStrategytrue
.
+ *
+ * @param authorshipCache the string which identifies the complete authorship of this non viral taxon name
+ * @see #getAuthorshipCache()
+ */
+ public void setAuthorshipCache(String authorshipCache) {
+ setAuthorshipCache(authorshipCache, true);
+ }
+
+ @Override
+ @Transient
+ public String getFullTitleCache(){
+ updateAuthorshipCache();
+ return super.getFullTitleCache();
+ }
+
+ @Override
+ public String getTitleCache(){
+ if(!protectedTitleCache) {
+ updateAuthorshipCache();
+ }
+
+ return super.getTitleCache();
+ }
+
+
+ /**
+ * Assigns an authorshipCache string to this non viral taxon name.
+ *
+ * @param authorshipCache the string which identifies the complete authorship of this non viral taxon name
+ * @param protectedAuthorshipCache if true the isProtectedAuthorshipCache flag is set to true
, otherwise
+ * the flag is set to false
.
+ * @see #getAuthorshipCache()
+ */
+ public void setAuthorshipCache(String authorshipCache, boolean protectedAuthorshipCache) {
+ this.authorshipCache = authorshipCache;
+ this.setProtectedAuthorshipCache(protectedAuthorshipCache);
+ }
+
+ @Override
+ public void setTitleCache(String titleCache, boolean protectCache){
+ super.setTitleCache(titleCache, protectCache);
+ }
+
+ /**
+ * Returns the boolean value "false" since the components of this taxon name
+ * cannot follow the rules of a corresponding {@link NomenclaturalCode nomenclatural code}
+ * which is not defined for this class. The nomenclature code depends on
+ * the concrete name subclass ({@link BacterialName BacterialName},
+ * {@link BotanicalName BotanicalName}, {@link CultivarPlantName CultivarPlantName} or
+ * {@link ZoologicalName ZoologicalName} to which this non viral taxon name belongs.
+ * This method overrides the isCodeCompliant method from the abstract
+ * {@link TaxonNameBase#isCodeCompliant() TaxonNameBase} class.
+ *
+ * @return false
+ * @see TaxonNameBase#isCodeCompliant()
+ */
+ @Override
+ @Transient
+ public boolean isCodeCompliant() {
+ //FIXME
+ logger.warn("is CodeCompliant not yet implemented");
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.cdm.model.name.TaxonNameBase#getNomeclaturalCode()
+ */
+ /**
+ * Returns null as {@link NomenclaturalCode nomenclatural code} that governs
+ * the construction of this non viral taxon name since there is no specific
+ * nomenclatural code defined. The real implementention takes place in the
+ * subclasses {@link BacterialName BacterialName},
+ * {@link BotanicalName BotanicalName}, {@link CultivarPlantName CultivarPlantName} and
+ * {@link ZoologicalName ZoologicalName}.
+ * This method overrides the getNomeclaturalCode method from {@link TaxonNameBase TaxonNameBase}.
+ *
+ * @return null
+ * @see #isCodeCompliant()
+ * @see TaxonNameBase#getHasProblem()
+ */
+ @Override
+ @Transient
+ public NomenclaturalCode getNomenclaturalCode() {
+ logger.warn("Non Viral Name has no specific Code defined. Use subclasses");
+ return null;
+ }
+
+ /**
+ * Returns the boolean value of the flag intended to protect (true)
+ * or not (false) the {@link #getAuthorshipCache() authorshipCache} (complete authorship string)
+ * of this non viral taxon name.
+ *
+ * @return the boolean value of the protectedAuthorshipCache flag
+ * @see #getAuthorshipCache()
+ */
+ public boolean isProtectedAuthorshipCache() {
+ return protectedAuthorshipCache;
+ }
+
+ /**
+ * @see #isProtectedAuthorshipCache()
+ * @see #getAuthorshipCache()
+ */
+ public void setProtectedAuthorshipCache(boolean protectedAuthorshipCache) {
+ this.protectedAuthorshipCache = protectedAuthorshipCache;
+ }
+
+
+ /**
+ * Returns the boolean value of the flag indicating whether the name of this
+ * botanical taxon name is a hybrid formula (true) or not (false). A hybrid
+ * named by a hybrid formula (composed with its parent names by placing the
+ * multiplication sign between them) does not have an own published name
+ * and therefore has neither an {@link NonViralName#getAuthorshipCache() autorship}
+ * nor other name components. If this flag is set no other hybrid flags may
+ * be set.
+ *
+ * @return the boolean value of the isHybridFormula flag
+ * @see #isMonomHybrid()
+ * @see #isBinomHybrid()
+ * @see #isTrinomHybrid()
+ */
+ public boolean isHybridFormula(){
+ return this.hybridFormula;
+ }
+
+ /**
+ * @see #isHybridFormula()
+ */
+ public void setHybridFormula(boolean hybridFormula){
+ this.hybridFormula = hybridFormula;
+ }
+
+ /**
+ * Returns the boolean value of the flag indicating whether this botanical
+ * taxon name is the name of an intergeneric hybrid (true) or not (false).
+ * In this case the multiplication sign is placed before the scientific
+ * name. If this flag is set no other hybrid flags may be set.
+ *
+ * @return the boolean value of the isMonomHybrid flag
+ * @see #isHybridFormula()
+ * @see #isBinomHybrid()
+ * @see #isTrinomHybrid()
+ */
+ public boolean isMonomHybrid(){
+ return this.monomHybrid;
+ }
+
+ /**
+ * @see #isMonomHybrid()
+ * @see #isBinomHybrid()
+ * @see #isTrinomHybrid()
+ */
+ public void setMonomHybrid(boolean monomHybrid){
+ this.monomHybrid = monomHybrid;
+ }
+
+ /**
+ * Returns the boolean value of the flag indicating whether this botanical
+ * taxon name is the name of an interspecific hybrid (true) or not (false).
+ * In this case the multiplication sign is placed before the species
+ * epithet. If this flag is set no other hybrid flags may be set.
+ *
+ * @return the boolean value of the isBinomHybrid flag
+ * @see #isHybridFormula()
+ * @see #isMonomHybrid()
+ * @see #isTrinomHybrid()
+ */
+ public boolean isBinomHybrid(){
+ return this.binomHybrid;
+ }
+
+ /**
+ * @see #isBinomHybrid()
+ * @see #isMonomHybrid()
+ * @see #isTrinomHybrid()
+ */
+ public void setBinomHybrid(boolean binomHybrid){
+ this.binomHybrid = binomHybrid;
+ }
+
+ /**
+ * Returns the boolean value of the flag indicating whether this botanical
+ * taxon name is the name of an infraspecific hybrid (true) or not (false).
+ * In this case the term "notho-" (optionally abbreviated "n-") is used as
+ * a prefix to the term denoting the infraspecific rank of this botanical
+ * taxon name. If this flag is set no other hybrid flags may be set.
+ *
+ * @return the boolean value of the isTrinomHybrid flag
+ * @see #isHybridFormula()
+ * @see #isMonomHybrid()
+ * @see #isBinomHybrid()
+ */
+ public boolean isTrinomHybrid(){
+ return this.trinomHybrid;
+ }
+
+ /**
+ * @see #isTrinomHybrid()
+ * @see #isBinomHybrid()
+ * @see #isMonomHybrid()
+ */
+ public void setTrinomHybrid(boolean trinomHybrid){
+ this.trinomHybrid = trinomHybrid;
+ }
+
+
+ /**
+ * Returns the set of all {@link HybridRelationship hybrid relationships}
+ * in which this taxon name is involved as a {@link common.RelationshipBase#getRelatedFrom() parent}.
+ *
+ * @see #getHybridRelationships()
+ * @see #getChildRelationships()
+ * @see HybridRelationshipType
+ */
+ public Set