1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.cdm.model.name;
|
11
|
|
12
|
|
13
|
import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;
|
14
|
import eu.etaxonomy.cdm.model.occurrence.Specimen;
|
15
|
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
|
16
|
import eu.etaxonomy.cdm.model.common.ReferencedEntityBase;
|
17
|
import org.apache.log4j.Logger;
|
18
|
import org.hibernate.annotations.Cascade;
|
19
|
import org.hibernate.annotations.CascadeType;
|
20
|
|
21
|
import java.util.*;
|
22
|
import javax.persistence.*;
|
23
|
|
24
|
/**
|
25
|
* {only for typified names which have the "species" rank or below}
|
26
|
* @author m.doering
|
27
|
* @version 1.0
|
28
|
* @created 08-Nov-2007 13:06:52
|
29
|
*/
|
30
|
@Entity
|
31
|
public class SpecimenTypeDesignation extends ReferencedEntityBase {
|
32
|
static Logger logger = Logger.getLogger(SpecimenTypeDesignation.class);
|
33
|
private HomotypicalGroup homotypicalGroup;
|
34
|
private DerivedUnitBase typeSpecimen;
|
35
|
private TypeDesignationStatus typeStatus;
|
36
|
|
37
|
public SpecimenTypeDesignation(HomotypicalGroup homotypicalGroup,
|
38
|
DerivedUnitBase specimen, TypeDesignationStatus status,
|
39
|
ReferenceBase citation, String citationMicroReference, String originalNameString) {
|
40
|
super(citation, citationMicroReference, originalNameString);
|
41
|
this.setHomotypicalGroup(homotypicalGroup);
|
42
|
this.setTypeSpecimen(specimen);
|
43
|
this.setTypeStatus(status);
|
44
|
}
|
45
|
|
46
|
|
47
|
@ManyToOne
|
48
|
public HomotypicalGroup getHomotypicalGroup() {
|
49
|
return homotypicalGroup;
|
50
|
}
|
51
|
public void setHomotypicalGroup(HomotypicalGroup newHomotypicalGroup) {
|
52
|
if(this.homotypicalGroup == newHomotypicalGroup) return;
|
53
|
if (homotypicalGroup != null) {
|
54
|
homotypicalGroup.typeDesignations.remove(this);
|
55
|
}
|
56
|
if (newHomotypicalGroup!= null) {
|
57
|
newHomotypicalGroup.typeDesignations.add(this);
|
58
|
}
|
59
|
this.homotypicalGroup = newHomotypicalGroup;
|
60
|
}
|
61
|
|
62
|
|
63
|
@ManyToOne
|
64
|
@Cascade({CascadeType.SAVE_UPDATE})
|
65
|
public DerivedUnitBase getTypeSpecimen(){
|
66
|
return this.typeSpecimen;
|
67
|
}
|
68
|
public void setTypeSpecimen(DerivedUnitBase typeSpecimen){
|
69
|
this.typeSpecimen = typeSpecimen;
|
70
|
}
|
71
|
|
72
|
@ManyToOne
|
73
|
public TypeDesignationStatus getTypeStatus(){
|
74
|
return this.typeStatus;
|
75
|
}
|
76
|
public void setTypeStatus(TypeDesignationStatus typeStatus){
|
77
|
this.typeStatus = typeStatus;
|
78
|
}
|
79
|
|
80
|
}
|