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