Intensive model change for referenceBase and subclass, smaller model changes for...
[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.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.ReferenceBaseDefaultCacheStrategy;
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 private static final long serialVersionUID = 2224085476416095383L;
60 @SuppressWarnings("unused")
61 private static final Logger logger = Logger.getLogger(Report.class);
62
63 // @XmlElement(name = "Institution")
64 // @XmlIDREF
65 // @XmlSchemaType(name = "IDREF")
66 // @ManyToOne(fetch = FetchType.LAZY)
67 // @IndexedEmbedded
68 // @Cascade(CascadeType.SAVE_UPDATE)
69 // private Institution institution;
70
71 protected Report() {
72 super();
73 this.type = ReferenceType.Report;
74 this.cacheStrategy = new ReferenceBaseDefaultCacheStrategy<Report>();
75 }
76
77 /**
78 * Creates a new empty report instance
79 *
80 * @see #NewInstance(Institution)
81 */
82 public static Report NewInstance(){
83 Report result = new Report();
84 return result;
85 }
86
87 /**
88 * Creates a new report instance with the given {@link eu.etaxonomy.cdm.model.agent.Institution institution}.
89 *
90 * @param institution the institution where <i>this</i> report has
91 * been elaborated
92 * @see #NewInstance()
93 */
94 public static Report NewInstance(Institution institution){
95 Report result = NewInstance();
96 result.setInstitution(institution);
97 return result;
98 }
99
100
101 /**
102 * Returns the {@link eu.etaxonomy.cdm.model.agent.Institution institution} in which <i>this</i>
103 * report has been elaborated.
104 *
105 * @return the institution
106 * @see eu.etaxonomy.cdm.model.agent.Institution
107 */
108 public Institution getInstitution(){
109 return this.institution;
110 }
111
112 /**
113 * @see #getInstitution()
114 */
115 public void setInstitution(Institution institution){
116 this.institution = institution;
117 }
118
119 /**
120 * Clones <i>this</i> report instance. This is a shortcut that enables to
121 * create a new instance that differs only slightly from <i>this</i>
122 * report instance by modifying only some of the attributes.<BR>
123 * This method overrides the clone method from {@link PublicationBase PublicationBase}.
124 *
125 * @see PublicationBase#clone()
126 * @see eu.etaxonomy.cdm.model.media.IdentifiableMediaEntity#clone()
127 * @see java.lang.Object#clone()
128 */
129 @Override
130 public Report clone(){
131 Report result = (Report)super.clone();
132 //no changes to: institution
133 return result;
134 }
135
136
137 }