import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
+import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import org.hibernate.annotations.CascadeType;
import org.hibernate.envers.Audited;
-import eu.etaxonomy.cdm.model.common.ReferencedEntityBase;
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
/**
@XmlType(name = "NameTypeDesignation", propOrder = {
"rejectedType",
"conservedType",
- "lectoType",
+ /*"lectoType",*/
"typeName"
})
@Entity
@Audited
-public class NameTypeDesignation extends TypeDesignationBase implements ITypeDesignation {
+public class NameTypeDesignation extends TypeDesignationBase<NameTypeDesignationStatus>
+implements ITypeDesignation {
- static Logger logger = Logger.getLogger(NameTypeDesignation.class);
+ final static Logger logger = Logger.getLogger(NameTypeDesignation.class);
@XmlElement(name = "IsRejectedType")
private boolean rejectedType;
@XmlElement(name = "IsConservedType")
private boolean conservedType;
- @XmlElement(name = "IsLectoType")
- private boolean lectoType;
+// @XmlElement(name = "IsLectoType")
+// private boolean lectoType;
@XmlElement(name = "TypeName")
@XmlIDREF
@ManyToOne(fetch = FetchType.LAZY)
@Cascade(CascadeType.SAVE_UPDATE)
private TaxonNameBase typeName;
+
-// @XmlElement(name = "HomotypicalGroup")
-// @XmlIDREF
-// @XmlSchemaType(name = "IDREF")
-// private HomotypicalGroup homotypicalGroup;
-
+ public static NameTypeDesignation NewInstance() {
+ return new NameTypeDesignation();
+ }
// ************* CONSTRUCTORS *************/
* @see #NameTypeDesignation(TaxonNameBase, ReferenceBase, String, String, boolean, boolean, boolean)
*/
protected NameTypeDesignation() {
- super();
}
+
/**
* Class constructor: creates a new name type designation instance
* (including its {@link eu.etaxonomy.cdm.model.reference.ReferenceBase reference source} and eventually
* @see TypeDesignationBase#isNotDesignated()
* @see TaxonNameBase#addNameTypeDesignation(TaxonNameBase, ReferenceBase, String, String, boolean, boolean, boolean, boolean, boolean)
*/
- protected NameTypeDesignation(TaxonNameBase typeName, ReferenceBase citation, String citationMicroReference,
- String originalNameString, boolean rejectedType, boolean conservedType, boolean isNotDesignated) {
- super(citation, citationMicroReference, originalNameString, isNotDesignated);
+ protected NameTypeDesignation(TaxonNameBase typeName, NameTypeDesignationStatus status,
+ ReferenceBase citation, String citationMicroReference, String originalNameString) {
+ super(citation, citationMicroReference, originalNameString);
this.setTypeName(typeName);
+ this.setTypeStatus(status);
+ }
+
+ /**
+ * Class constructor: creates a new name type designation instance
+ * (including its {@link eu.etaxonomy.cdm.model.reference.ReferenceBase reference source} and eventually
+ * the taxon name string originally used by this reference when establishing
+ * the former designation).
+ *
+ * @param typeName the taxon name used as a type
+ * @param citation the reference source for the new designation
+ * @param citationMicroReference the string with the details describing the exact localisation within the reference
+ * @param originalNameString the taxon name string used originally in the reference source for the new designation
+ * @param isRejectedType the boolean flag indicating whether the competent authorities rejected
+ * <i>this</i> name type designation
+ * @param isConservedType the boolean flag indicating whether the competent authorities conserved
+ * <i>this</i> name type designation
+ * @param isNotDesignated the boolean flag indicating whether there is no name type at all for
+ * <i>this</i> name type designation
+ * @see #NameTypeDesignation()
+ * @see TypeDesignationBase#isNotDesignated()
+ * @see TaxonNameBase#addNameTypeDesignation(TaxonNameBase, ReferenceBase, String, String, boolean, boolean, boolean, boolean, boolean)
+ */
+ protected NameTypeDesignation( TaxonNameBase typeName,
+ ReferenceBase citation,
+ String citationMicroReference,
+ String originalNameString,
+ NameTypeDesignationStatus status,
+ boolean rejectedType,
+ boolean conservedType,
+ boolean isNotDesignated
+ ) {
+ this(typeName, status, citation, citationMicroReference, originalNameString);
+ this.setNotDesignated(isNotDesignated);
this.rejectedType = rejectedType;
this.conservedType = conservedType;
}
/**
* @see #getTypeName()
*/
- private void setTypeName(TaxonNameBase typeName){
+ public void setTypeName(TaxonNameBase typeName){
this.typeName = typeName;
}
this.conservedType = conservedType;
}
+ @Transient
+ public boolean isLectoType() {
+ if (getTypeStatus() == null) {
+ return false;
+ }
+ return getTypeStatus().isLectotype();
+ }
+
/**
* Returns the boolean value "true" if the use of the species {@link TaxonNameBase taxon name}
* as the type for <i>this</i> taxon name type designation was posterior to the
*
* @see ReferencedEntityBase#getCitation()
*/
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.model.name.ITypeDesignation#isLectoType()
- */
- public boolean isLectoType() {
- return lectoType;
- }
-
- /**
- * @see #isLectoType()
- */
- public void setLectoType(boolean lectoType) {
- this.lectoType = lectoType;
- }
+// /* (non-Javadoc)
+// * @see eu.etaxonomy.cdm.model.name.ITypeDesignation#isLectoType()
+// */
+// public boolean isLectoType() {
+// return lectoType;
+// }
+//
+// /**
+// * @see #isLectoType()
+// */
+// public void setLectoType(boolean lectoType) {
+// this.lectoType = lectoType;
+// }
}
\ No newline at end of file