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.XmlTransient;\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
@XmlType(name = "TypeDesignationBase", propOrder = {\r
"typifiedNames",\r
"homotypicalGroup",\r
- "isNotDesignated"\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
- private static final Logger logger = Logger.getLogger(TypeDesignationBase.class);\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
@XmlElement(name = "IsNotDesignated")\r
- private boolean 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
super();\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
+ * @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
* @see #isNotDesignated()\r
* @see TaxonNameBase#getTypeDesignations()\r
*/\r
- protected TypeDesignationBase(ReferenceBase citation, String citationMicroReference, String originalNameString, boolean isNotDesignated){\r
+ protected TypeDesignationBase(ReferenceBase citation, String citationMicroReference, String originalNameString, boolean notDesignated){\r
super(citation, citationMicroReference, originalNameString);\r
- this.isNotDesignated = isNotDesignated;\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
* \r
* @see #getTypifiedNames()\r
*/\r
- @ManyToOne\r
- @Cascade({CascadeType.SAVE_UPDATE})\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
* type designation. This is a subset of the taxon names belonging to the\r
* corresponding {@link #getHomotypicalGroup() homotypical group}.\r
*/\r
- @ManyToMany\r
- @Cascade({CascadeType.SAVE_UPDATE})\r
public Set<TaxonNameBase> getTypifiedNames() {\r
return typifiedNames;\r
}\r
* in case of a {@link SpecimenTypeDesignation specimen type designation}, should then be "null".\r
*/\r
public boolean isNotDesignated() {\r
- return isNotDesignated;\r
+ return notDesignated;\r
}\r
\r
/**\r
* @see #isNotDesignated()\r
*/\r
- public void setNotDesignated(boolean isNotDesignated) {\r
- this.isNotDesignated = isNotDesignated;\r
- }\r
-\r
-\r
- @Deprecated //for hibernate use only\r
- private void setTypifiedNames(Set<TaxonNameBase> typifiedNames) {\r
- this.typifiedNames = typifiedNames;\r
+ public void setNotDesignated(boolean notDesignated) {\r
+ this.notDesignated = notDesignated;\r
}\r
\r
@Deprecated //for bidirectional use only\r
protected void addTypifiedName(TaxonNameBase taxonName){\r
this.typifiedNames.add(taxonName);\r
}\r
- \r
-\r
}\r