import java.util.Set;\r
\r
import javax.persistence.Entity;\r
+import javax.persistence.FetchType;\r
import javax.persistence.Inheritance;\r
import javax.persistence.InheritanceType;\r
import javax.persistence.ManyToMany;\r
import javax.persistence.ManyToOne;\r
-import javax.persistence.OneToMany;\r
import javax.xml.bind.annotation.XmlElement;\r
import javax.xml.bind.annotation.XmlElementWrapper;\r
import javax.xml.bind.annotation.XmlIDREF;\r
import javax.xml.bind.annotation.XmlRootElement;\r
import javax.xml.bind.annotation.XmlSchemaType;\r
+import javax.xml.bind.annotation.XmlSeeAlso;\r
+import javax.xml.bind.annotation.XmlType;\r
\r
import org.apache.log4j.Logger;\r
import org.hibernate.annotations.Cascade;\r
import org.hibernate.annotations.CascadeType;\r
+import org.hibernate.envers.Audited;\r
\r
import eu.etaxonomy.cdm.model.common.ReferencedEntityBase;\r
import eu.etaxonomy.cdm.model.reference.ReferenceBase;\r
\r
/**\r
- * @author a.mueller\r
+ * The (abstract) class representing a typification of one or several {@link TaxonNameBase taxon names}.<BR>\r
+ * All taxon names which have a {@link Rank rank} "species aggregate" or lower\r
+ * can only be typified by specimens (a {@link SpecimenTypeDesignation specimen type designation}), but taxon\r
+ * names with a higher rank might be typified by an other taxon name with\r
+ * rank "species" or "genus" (a {@link NameTypeDesignation name type designation}).\r
+ * \r
+ * @see TaxonNameBase\r
+ * @see NameTypeDesignation\r
+ * @see SpecimenTypeDesignation\r
+ * @author a.mueller\r
* @created 07.08.2008\r
* @version 1.0\r
*/\r
@XmlRootElement(name = "TypeDesignationBase")\r
+@XmlType(name = "TypeDesignationBase", propOrder = {\r
+ "typifiedNames",\r
+ "homotypicalGroup",\r
+ "notDesignated",\r
+ "typeStatus"\r
+})\r
+@XmlSeeAlso({\r
+ NameTypeDesignation.class,\r
+ SpecimenTypeDesignation.class\r
+})\r
@Entity\r
+@Audited\r
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)\r
-public abstract class TypeDesignationBase extends ReferencedEntityBase implements ITypeDesignation {\r
+public abstract class TypeDesignationBase<T extends TypeDesignationStatusBase> extends ReferencedEntityBase implements ITypeDesignation {\r
+\r
+ private static final long serialVersionUID = 1L;\r
+\r
+ @SuppressWarnings("unused")\r
private static final Logger logger = Logger.getLogger(TypeDesignationBase.class);\r
\r
- private ReferenceBase lectoTypeReference;\r
- private String lectoTypeMicroReference;\r
+ @XmlElement(name = "IsNotDesignated")\r
+ private boolean notDesignated;\r
\r
@XmlElementWrapper(name = "TypifiedNames")\r
@XmlElement(name = "TypifiedName")\r
@XmlIDREF\r
@XmlSchemaType(name = "IDREF")\r
+ // Need these references (bidirectional) to fill table TypeDesignationBase_TaxonNameBase\r
+ @ManyToMany(fetch = FetchType.LAZY)\r
private Set<TaxonNameBase> typifiedNames = new HashSet<TaxonNameBase>();\r
\r
@XmlElement(name = "HomotypicalGroup")\r
@XmlIDREF\r
@XmlSchemaType(name = "IDREF")\r
+ @ManyToOne(fetch = FetchType.LAZY)\r
+ @Cascade(CascadeType.SAVE_UPDATE)\r
private HomotypicalGroup homotypicalGroup;\r
\r
+ @XmlElement(name = "TypeStatus")\r
+ @XmlIDREF\r
+ @XmlSchemaType(name = "IDREF")\r
+ @ManyToOne(fetch = FetchType.LAZY, targetEntity = TypeDesignationStatusBase.class)\r
+ private T typeStatus;\r
+\r
// **************** CONSTRUCTOR *************************************/\r
- \r
+\r
+ /** \r
+ * Class constructor: creates a new empty type designation.\r
+ * \r
+ * @see #TypeDesignationBase(ReferenceBase, String, String, Boolean)\r
+ */\r
protected TypeDesignationBase(){\r
super();\r
}\r
\r
- protected TypeDesignationBase(ReferenceBase citation, String citationMicroReference,ReferenceBase lectoTypeReference, String lectoTypeMicroReference, String originalNameString){\r
+ /**\r
+ * Class constructor: creates a new type designation\r
+ * (including its {@link ReferenceBase reference source} and eventually\r
+ * the taxon name string originally used by this reference when establishing\r
+ * the former designation).\r
+ * \r
+ * @param citation the reference source for the new designation\r
+ * @param citationMicroReference the string with the details describing the exact localisation within the reference\r
+ * @param originalNameString the taxon name string used originally in the reference source for the new designation\r
+ * @see #TypeDesignationBase()\r
+ * @see #isNotDesignated()\r
+ * @see TaxonNameBase#getTypeDesignations()\r
+ */\r
+ protected TypeDesignationBase(ReferenceBase citation, String citationMicroReference, String originalNameString) {\r
+ this(citation, citationMicroReference, originalNameString, false);\r
+ }\r
+\r
+ /**\r
+ * Class constructor: creates a new type designation\r
+ * (including its {@link ReferenceBase reference source} and eventually\r
+ * the taxon name string originally used by this reference when establishing\r
+ * the former designation).\r
+ * \r
+ * @param citation the reference source for the new designation\r
+ * @param citationMicroReference the string with the details describing the exact localisation within the reference\r
+ * @param originalNameString the taxon name string used originally in the reference source for the new designation\r
+ * @param isNotDesignated the boolean flag indicating whether there is no type at all for \r
+ * <i>this</i> type designation\r
+ * @see #TypeDesignationBase()\r
+ * @see #isNotDesignated()\r
+ * @see TaxonNameBase#getTypeDesignations()\r
+ */\r
+ protected TypeDesignationBase(ReferenceBase citation, String citationMicroReference, String originalNameString, boolean notDesignated){\r
super(citation, citationMicroReference, originalNameString);\r
- this.lectoTypeReference = lectoTypeReference;\r
- this.lectoTypeMicroReference = lectoTypeMicroReference;\r
+ this.notDesignated = notDesignated;\r
}\r
\r
\r
// **************** METHODS *************************************/\r
\r
\r
+ /** \r
+ * Returns the {@link TypeDesignationStatusBase type designation status} for <i>this</i> specimen type\r
+ * designation. This status describes which of the possible categories of\r
+ * types like "holotype", "neotype", "syntype" or "isotype" applies to <i>this</i>\r
+ * specimen type designation.\r
+ */\r
+ public T getTypeStatus(){\r
+ return this.typeStatus;\r
+ }\r
+ /**\r
+ * @see #getTypeStatus()\r
+ */\r
+ public void setTypeStatus(T typeStatus){\r
+ this.typeStatus = typeStatus;\r
+ }\r
+\r
/* (non-Javadoc)\r
* @see eu.etaxonomy.cdm.model.name.ITypeDesignation#getHomotypicalGroup()\r
*/\r
- @ManyToOne\r
- @Cascade({CascadeType.SAVE_UPDATE})\r
+ /** \r
+ * Returns the {@link HomotypicalGroup homotypical group} to which all (in <i>this</i>\r
+ * type designation) typified {@link TaxonNameBase taxon names} belong.\r
+ * \r
+ * @see #getTypifiedNames()\r
+ */\r
public HomotypicalGroup getHomotypicalGroup() {\r
return homotypicalGroup;\r
}\r
\r
- @Deprecated //for hibernate use only\r
- private void setHomotypicalGroup(HomotypicalGroup homotypicalGroup) {\r
- this.homotypicalGroup = homotypicalGroup; \r
- }\r
-\r
/* (non-Javadoc)\r
* @see eu.etaxonomy.cdm.model.name.ITypeDesignation#getTypifiedNames()\r
*/\r
- @ManyToMany\r
- @Cascade({CascadeType.SAVE_UPDATE})\r
+ /** \r
+ * Returns the set of {@link TaxonNameBase taxon names} typified in <i>this</i>\r
+ * type designation. This is a subset of the taxon names belonging to the\r
+ * corresponding {@link #getHomotypicalGroup() homotypical group}.\r
+ */\r
public Set<TaxonNameBase> getTypifiedNames() {\r
return typifiedNames;\r
}\r
\r
-\r
- @Deprecated //for hibernate use only\r
- private void setTypifiedNames(Set<TaxonNameBase> typifiedNames) {\r
- this.typifiedNames = typifiedNames;\r
- }\r
- \r
- @Deprecated //for bidirectional use only\r
- protected void addTypifiedName(TaxonNameBase taxonName){\r
- this.typifiedNames.add(taxonName);\r
- }\r
- \r
- \r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.model.name.ITypeDesignation#getLectoTypeReference()\r
+ /**\r
+ * Returns the boolean value "true" if it is known that a type does not\r
+ * exist and therefore the {@link TaxonNameBase taxon name} to which <i>this</i>\r
+ * type designation is assigned must still be typified. Two\r
+ * cases must be differentiated: <BR><ul> \r
+ * <li> a) it is unknown whether a type exists and \r
+ * <li> b) it is known that no type exists\r
+ * </ul>\r
+ * If a) is true there should be no TypeDesignation instance at all\r
+ * assigned to the "typified" taxon name.<BR>\r
+ * If b) is true there should be a TypeDesignation instance with the\r
+ * flag isNotDesignated set. The typeName attribute, in case of a\r
+ * {@link NameTypeDesignation name type designation}, or the typeSpecimen attribute,\r
+ * in case of a {@link SpecimenTypeDesignation specimen type designation}, should then be "null".\r
*/\r
- @ManyToOne\r
- @Cascade({CascadeType.SAVE_UPDATE})\r
- public ReferenceBase getLectoTypeReference() {\r
- return lectoTypeReference;\r
+ public boolean isNotDesignated() {\r
+ return notDesignated;\r
}\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.model.name.ITypeDesignation#setLectoTypeReference(eu.etaxonomy.cdm.model.reference.ReferenceBase)\r
+ /**\r
+ * @see #isNotDesignated()\r
*/\r
- public void setLectoTypeReference(ReferenceBase lectoTypeReference) {\r
- this.lectoTypeReference = lectoTypeReference;\r
- }\r
-\r
-\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.model.name.ITypeDesignation#getLectoTypeMicroReference()\r
- */\r
- public String getLectoTypeMicroReference() {\r
- return lectoTypeMicroReference;\r
+ public void setNotDesignated(boolean notDesignated) {\r
+ this.notDesignated = notDesignated;\r
}\r
\r
- /* (non-Javadoc)\r
- * @see eu.etaxonomy.cdm.model.name.ITypeDesignation#setLectoTypeMicroReference(java.lang.String)\r
- */\r
- public void setLectoTypeMicroReference(String lectoTypeMicroReference) {\r
- this.lectoTypeMicroReference = lectoTypeMicroReference;\r
+ @Deprecated //for bidirectional use only\r
+ protected void addTypifiedName(TaxonNameBase taxonName){\r
+ this.typifiedNames.add(taxonName);\r
}\r
}\r