package eu.etaxonomy.cdm.model.name;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.persistence.Entity;
+import javax.persistence.OneToMany;
+import javax.persistence.Transient;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
import org.apache.log4j.Logger;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
+import eu.etaxonomy.cdm.model.common.RelationshipBase;
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
-import eu.etaxonomy.cdm.strategy.cache.BotanicNameDefaultCacheStrategy;
-import eu.etaxonomy.cdm.strategy.parser.ITaxonNameParser;
+import eu.etaxonomy.cdm.strategy.cache.name.BotanicNameDefaultCacheStrategy;
+import eu.etaxonomy.cdm.strategy.parser.INonViralNameParser;
import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl;
-import java.util.*;
-import javax.persistence.*;
-
/**
* Taxon name class for plants
* @author m.doering
* @version 1.0
* @created 08-Nov-2007 13:06:15
*/
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "isHybridFormula",
+ "isMonomHybrid",
+ "isBinomHybrid",
+ "isTrinomHybrid",
+ "isAnamorphic",
+ "hybridRelationships"
+})
+@XmlRootElement(name = "BotanicalName")
@Entity
public class BotanicalName extends NonViralName {
+
private static final Logger logger = Logger.getLogger(BotanicalName.class);
+
//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.
+ @XmlElement(name ="IsHybridFormula")
private boolean isHybridFormula = false;
+
+ @XmlElement(name ="IsMonomHybrid")
private boolean isMonomHybrid = false;
+
+ @XmlElement(name ="IsBinomHybrid")
private boolean isBinomHybrid = false;
+
+ @XmlElement(name ="IsTrinomHybrid")
private boolean isTrinomHybrid = false;
+
//Only for fungi: to indicate that the type of the name is asexual or not
+ @XmlElement(name ="IsAnamorphic")
private boolean isAnamorphic;
+
+ @XmlElementWrapper(name = "HybridRelationships")
+ @XmlElement(name = "HybridRelationship")
private Set<HybridRelationship> hybridRelationships = new HashSet();
- static private ITaxonNameParser nameParser = new NonViralNameParserImpl();
+ static private INonViralNameParser nameParser = new NonViralNameParserImpl();
/**
return new BotanicalName(rank, homotypicalGroup);
}
- public static BotanicalName NewInstance(Rank rank, String genusOrUninomial, String specificEpithet, String infraSpecificEpithet, TeamOrPersonBase combinationAuthorTeam, INomenclaturalReference nomenclaturalReference, String nomenclMicroRef, HomotypicalGroup homotypicalGroup) {
- return new BotanicalName(rank, genusOrUninomial, specificEpithet, infraSpecificEpithet, combinationAuthorTeam, nomenclaturalReference, nomenclMicroRef, homotypicalGroup);
+ 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);
}
/**
super(rank, homotypicalGroup);
this.cacheStrategy = BotanicNameDefaultCacheStrategy.NewInstance();
}
- protected BotanicalName(Rank rank, String genusOrUninomial, String specificEpithet, String infraSpecificEpithet, TeamOrPersonBase combinationAuthorTeam, INomenclaturalReference nomenclaturalReference, String nomenclMicroRef, HomotypicalGroup homotypicalGroup) {
- super(rank, genusOrUninomial, specificEpithet, infraSpecificEpithet, combinationAuthorTeam, nomenclaturalReference, nomenclMicroRef, homotypicalGroup);
+ 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();
}
return hybridRelationships;
}
-
+ public void addRelationship(RelationshipBase relation) {
+ if (relation instanceof HybridRelationship){
+ addHybridRelationship((HybridRelationship)relation);
+ }else {
+ super.addRelationship(relation);
+ }
+ }
public boolean isHybridFormula(){
return this.isHybridFormula;
}
+ @Transient
@Override
- public NomenclaturalCode getNomeclaturalCode(){
+ public NomenclaturalCode getNomenclaturalCode(){
return NomenclaturalCode.ICBN();
}