1 |
9479da48
|
Andreas Müller
|
/**
|
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.common;
|
11 |
|
|
|
12 |
|
|
|
13 |
f6765014
|
ben.clark
|
import javax.persistence.FetchType;
|
14 |
|
|
import javax.persistence.ManyToOne;
|
15 |
|
|
import javax.persistence.MappedSuperclass;
|
16 |
6a3a07f6
|
a.babadshanjan
|
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 |
9479da48
|
Andreas Müller
|
|
24 |
f6765014
|
ben.clark
|
import org.apache.log4j.Logger;
|
25 |
|
|
import org.hibernate.annotations.Cascade;
|
26 |
|
|
import org.hibernate.annotations.CascadeType;
|
27 |
3201480a
|
Andreas Müller
|
import org.hibernate.envers.Audited;
|
28 |
f6765014
|
ben.clark
|
|
29 |
1d36aa54
|
Andreas Müller
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
30 |
f6765014
|
ben.clark
|
|
31 |
9479da48
|
Andreas Müller
|
/**
|
32 |
|
|
* abstract class for all objects that may have a reference
|
33 |
|
|
* @author m.doering
|
34 |
|
|
* @version 1.0
|
35 |
|
|
* @created 08-Nov-2007 13:06:47
|
36 |
|
|
*/
|
37 |
6a3a07f6
|
a.babadshanjan
|
@XmlAccessorType(XmlAccessType.FIELD)
|
38 |
|
|
@XmlType(name = "ReferencedEntityBase", propOrder = {
|
39 |
|
|
"citationMicroReference",
|
40 |
|
|
"originalNameString",
|
41 |
|
|
"citation"
|
42 |
|
|
})
|
43 |
|
|
@XmlRootElement(name = "ReferencedEntityBase")
|
44 |
9479da48
|
Andreas Müller
|
@MappedSuperclass
|
45 |
3201480a
|
Andreas Müller
|
@Audited
|
46 |
9479da48
|
Andreas Müller
|
public abstract class ReferencedEntityBase extends AnnotatableEntity implements IReferencedEntity {
|
47 |
6f5157ef
|
Andreas Müller
|
private static final long serialVersionUID = -5614669050360359126L;
|
48 |
0d575644
|
Andreas Müller
|
@SuppressWarnings("unused")
|
49 |
|
|
private static final Logger logger = Logger.getLogger(ReferencedEntityBase.class);
|
50 |
6a3a07f6
|
a.babadshanjan
|
|
51 |
9479da48
|
Andreas Müller
|
//Details of the reference. These are mostly (implicitly) pages but can also be tables or any other element of a
|
52 |
|
|
//publication. {if the citationMicroReference exists then there must be also a reference}
|
53 |
6a3a07f6
|
a.babadshanjan
|
@XmlElement(name = "Citation")
|
54 |
|
|
@XmlIDREF
|
55 |
|
|
@XmlSchemaType(name = "IDREF")
|
56 |
ee91bcd9
|
ben.clark
|
@ManyToOne(fetch = FetchType.LAZY)
|
57 |
9dc8a26e
|
ben.clark
|
@Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE})
|
58 |
3201480a
|
Andreas Müller
|
private Reference<?> citation;
|
59 |
6a3a07f6
|
a.babadshanjan
|
|
60 |
|
|
@XmlElement(name = "CitationMicroReference")
|
61 |
9479da48
|
Andreas Müller
|
private String citationMicroReference;
|
62 |
6a3a07f6
|
a.babadshanjan
|
|
63 |
|
|
@XmlElement(name = "OriginalNameString")
|
64 |
9479da48
|
Andreas Müller
|
private String originalNameString;
|
65 |
|
|
|
66 |
640937e9
|
Andreas Müller
|
// ************ CONSTRUCTOR ********************************************/
|
67 |
|
|
|
68 |
|
|
//for hibernate use only
|
69 |
|
|
protected ReferencedEntityBase() {
|
70 |
9479da48
|
Andreas Müller
|
super();
|
71 |
|
|
}
|
72 |
|
|
|
73 |
640937e9
|
Andreas Müller
|
|
74 |
9479da48
|
Andreas Müller
|
|
75 |
1d36aa54
|
Andreas Müller
|
public ReferencedEntityBase(Reference citation, String citationMicroReference,
|
76 |
9479da48
|
Andreas Müller
|
String originalNameString) {
|
77 |
|
|
super();
|
78 |
|
|
this.citationMicroReference = citationMicroReference;
|
79 |
|
|
this.originalNameString = originalNameString;
|
80 |
|
|
this.citation = citation;
|
81 |
|
|
}
|
82 |
ee91bcd9
|
ben.clark
|
|
83 |
640937e9
|
Andreas Müller
|
//********************* GETTER / SETTER *******************************/
|
84 |
|
|
|
85 |
9479da48
|
Andreas Müller
|
public String getCitationMicroReference(){
|
86 |
|
|
return this.citationMicroReference;
|
87 |
|
|
}
|
88 |
|
|
public void setCitationMicroReference(String citationMicroReference){
|
89 |
|
|
this.citationMicroReference = citationMicroReference;
|
90 |
|
|
}
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
public String getOriginalNameString(){
|
94 |
|
|
return this.originalNameString;
|
95 |
|
|
}
|
96 |
|
|
public void setOriginalNameString(String originalNameString){
|
97 |
|
|
this.originalNameString = originalNameString;
|
98 |
|
|
}
|
99 |
|
|
|
100 |
1d36aa54
|
Andreas Müller
|
public Reference getCitation(){
|
101 |
9479da48
|
Andreas Müller
|
return this.citation;
|
102 |
|
|
}
|
103 |
1d36aa54
|
Andreas Müller
|
public void setCitation(Reference citation) {
|
104 |
9479da48
|
Andreas Müller
|
this.citation = citation;
|
105 |
|
|
}
|
106 |
835c12dd
|
Andreas Müller
|
|
107 |
|
|
//****************** CLONE ************************************************/
|
108 |
|
|
|
109 |
|
|
/* (non-Javadoc)
|
110 |
|
|
* @see java.lang.Object#clone()
|
111 |
|
|
*/
|
112 |
e1c9b32e
|
a.babadshanjan
|
@Override
|
113 |
835c12dd
|
Andreas Müller
|
public Object clone() throws CloneNotSupportedException{
|
114 |
|
|
ReferencedEntityBase result = (ReferencedEntityBase)super.clone();
|
115 |
|
|
|
116 |
|
|
//no changes to: citation, citationMicroReference, originalNameString
|
117 |
|
|
return result;
|
118 |
|
|
}
|
119 |
9479da48
|
Andreas Müller
|
|
120 |
|
|
}
|