1
|
/**
|
2
|
* Copyright (C) 2021 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
|
package eu.etaxonomy.cdm.model.taxon;
|
10
|
|
11
|
import javax.persistence.Column;
|
12
|
import javax.persistence.Entity;
|
13
|
import javax.validation.constraints.NotNull;
|
14
|
import javax.xml.bind.annotation.XmlAccessType;
|
15
|
import javax.xml.bind.annotation.XmlAccessorType;
|
16
|
import javax.xml.bind.annotation.XmlAttribute;
|
17
|
import javax.xml.bind.annotation.XmlRootElement;
|
18
|
import javax.xml.bind.annotation.XmlType;
|
19
|
|
20
|
import org.hibernate.annotations.Type;
|
21
|
import org.hibernate.envers.Audited;
|
22
|
|
23
|
import eu.etaxonomy.cdm.model.common.TimePeriod;
|
24
|
import eu.etaxonomy.cdm.model.common.VersionableEntity;
|
25
|
|
26
|
/**
|
27
|
* see https://dev.e-taxonomy.eu/redmine/issues/9692
|
28
|
*
|
29
|
* @author a.mueller
|
30
|
* @since 02.07.2021
|
31
|
*/
|
32
|
@XmlAccessorType(XmlAccessType.FIELD)
|
33
|
@XmlType(name = "TaxonomicOperation", propOrder = {
|
34
|
"type",
|
35
|
"timePeriod"
|
36
|
})
|
37
|
@XmlRootElement(name = "TaxonomicOperation")
|
38
|
@Entity
|
39
|
@Audited
|
40
|
public class TaxonomicOperation extends VersionableEntity {
|
41
|
|
42
|
private static final long serialVersionUID = 6044997707560990508L;
|
43
|
|
44
|
@XmlAttribute(name ="TaxonomicOperationType")
|
45
|
@NotNull
|
46
|
@Type(type = "eu.etaxonomy.cdm.hibernate.EnumUserType",
|
47
|
parameters = {@org.hibernate.annotations.Parameter(name="enumClass", value="eu.etaxonomy.cdm.model.taxon.TaxonomicOperationType")}
|
48
|
)
|
49
|
@Audited
|
50
|
@Column(length=20)
|
51
|
private TaxonomicOperationType type;
|
52
|
|
53
|
private TimePeriod timePeriod = TimePeriod.NewInstance();
|
54
|
|
55
|
// *************************** FACTORY METHODS **************************/
|
56
|
|
57
|
public static TaxonomicOperation NewInstance(TaxonomicOperationType type){
|
58
|
return new TaxonomicOperation(type, null);
|
59
|
}
|
60
|
|
61
|
// ************************ CONSTRUCTOR *******************************/
|
62
|
|
63
|
@Deprecated //for jaxb/hibernate use only
|
64
|
private TaxonomicOperation(){}
|
65
|
|
66
|
private TaxonomicOperation(TaxonomicOperationType type, TimePeriod timePeriod) {
|
67
|
this.type = type;
|
68
|
this.setTimePeriod(timePeriod);
|
69
|
}
|
70
|
|
71
|
// ********************* GETTER / SETTER ********************************/
|
72
|
|
73
|
public TaxonomicOperationType getType() {
|
74
|
return type;
|
75
|
}
|
76
|
public void setType(TaxonomicOperationType type) {
|
77
|
this.type = type;
|
78
|
}
|
79
|
|
80
|
public TimePeriod getTimePeriod() {
|
81
|
return timePeriod;
|
82
|
}
|
83
|
public void setTimePeriod(TimePeriod timePeriod) {
|
84
|
this.timePeriod = timePeriod;
|
85
|
}
|
86
|
}
|