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.reference;
|
11
|
|
12
|
|
13
|
import javax.persistence.Entity;
|
14
|
import javax.persistence.FetchType;
|
15
|
import javax.persistence.ManyToOne;
|
16
|
import javax.xml.bind.annotation.XmlAccessType;
|
17
|
import javax.xml.bind.annotation.XmlAccessorType;
|
18
|
import javax.xml.bind.annotation.XmlElement;
|
19
|
import javax.xml.bind.annotation.XmlIDREF;
|
20
|
import javax.xml.bind.annotation.XmlRootElement;
|
21
|
import javax.xml.bind.annotation.XmlSchemaType;
|
22
|
import javax.xml.bind.annotation.XmlType;
|
23
|
|
24
|
import org.apache.log4j.Logger;
|
25
|
import org.hibernate.annotations.Cascade;
|
26
|
import org.hibernate.annotations.CascadeType;
|
27
|
import org.hibernate.envers.Audited;
|
28
|
import org.hibernate.search.annotations.Indexed;
|
29
|
import org.hibernate.search.annotations.IndexedEmbedded;
|
30
|
import org.springframework.beans.factory.annotation.Configurable;
|
31
|
|
32
|
import eu.etaxonomy.cdm.model.agent.Institution;
|
33
|
import eu.etaxonomy.cdm.strategy.cache.reference.IReferenceBaseCacheStrategy;
|
34
|
import eu.etaxonomy.cdm.strategy.cache.reference.StrictReferenceBaseDefaultCacheStrategy;
|
35
|
|
36
|
/**
|
37
|
* This class represents reports. A report is a document characterized by
|
38
|
* information reflective of inquiry or investigation. Reports often address
|
39
|
* questions posed by individuals in government or science and are generally
|
40
|
* elaborated within an {@link eu.etaxonomy.cdm.model.agent.Institution institution}.
|
41
|
* <P>
|
42
|
* This class corresponds, according to the TDWG ontology, to the publication type
|
43
|
* term (from PublicationTypeTerm): "Report".
|
44
|
*
|
45
|
* @author m.doering
|
46
|
* @version 1.0
|
47
|
* @created 08-Nov-2007 13:06:49
|
48
|
*/
|
49
|
@XmlAccessorType(XmlAccessType.FIELD)
|
50
|
@XmlType(name = "Report", propOrder = {
|
51
|
"institution"
|
52
|
})
|
53
|
@XmlRootElement(name = "Report")
|
54
|
@Entity
|
55
|
@Indexed(index = "eu.etaxonomy.cdm.model.reference.ReferenceBase")
|
56
|
@Audited
|
57
|
@Configurable
|
58
|
public class Report extends PublicationBase<IReferenceBaseCacheStrategy<Report>> implements Cloneable {
|
59
|
static Logger logger = Logger.getLogger(Report.class);
|
60
|
|
61
|
@XmlElement(name = "Institution")
|
62
|
@XmlIDREF
|
63
|
@XmlSchemaType(name = "IDREF")
|
64
|
@ManyToOne(fetch = FetchType.LAZY)
|
65
|
@IndexedEmbedded
|
66
|
@Cascade(CascadeType.SAVE_UPDATE)
|
67
|
private Institution institution;
|
68
|
|
69
|
protected Report() {
|
70
|
this.cacheStrategy = new StrictReferenceBaseDefaultCacheStrategy<Report>();
|
71
|
}
|
72
|
|
73
|
/**
|
74
|
* Creates a new empty report instance
|
75
|
*
|
76
|
* @see #NewInstance(Institution)
|
77
|
*/
|
78
|
public static Report NewInstance(){
|
79
|
Report result = new Report();
|
80
|
return result;
|
81
|
}
|
82
|
|
83
|
/**
|
84
|
* Creates a new report instance with the given {@link eu.etaxonomy.cdm.model.agent.Institution institution}.
|
85
|
*
|
86
|
* @param institution the institution where <i>this</i> report has
|
87
|
* been elaborated
|
88
|
* @see #NewInstance()
|
89
|
*/
|
90
|
public static Report NewInstance(Institution institution){
|
91
|
Report result = NewInstance();
|
92
|
result.setInstitution(institution);
|
93
|
return result;
|
94
|
}
|
95
|
|
96
|
|
97
|
/**
|
98
|
* Returns the {@link eu.etaxonomy.cdm.model.agent.Institution institution} in which <i>this</i>
|
99
|
* report has been elaborated.
|
100
|
*
|
101
|
* @return the institution
|
102
|
* @see eu.etaxonomy.cdm.model.agent.Institution
|
103
|
*/
|
104
|
public Institution getInstitution(){
|
105
|
return this.institution;
|
106
|
}
|
107
|
|
108
|
/**
|
109
|
* @see #getInstitution()
|
110
|
*/
|
111
|
public void setInstitution(Institution institution){
|
112
|
this.institution = institution;
|
113
|
}
|
114
|
|
115
|
/**
|
116
|
* Clones <i>this</i> report instance. This is a shortcut that enables to
|
117
|
* create a new instance that differs only slightly from <i>this</i>
|
118
|
* report instance by modifying only some of the attributes.<BR>
|
119
|
* This method overrides the clone method from {@link PublicationBase PublicationBase}.
|
120
|
*
|
121
|
* @see PublicationBase#clone()
|
122
|
* @see eu.etaxonomy.cdm.model.media.IdentifiableMediaEntity#clone()
|
123
|
* @see java.lang.Object#clone()
|
124
|
*/
|
125
|
@Override
|
126
|
public Report clone(){
|
127
|
Report result = (Report)super.clone();
|
128
|
//no changes to: institution
|
129
|
return result;
|
130
|
}
|
131
|
|
132
|
|
133
|
}
|