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.common;
|
11
|
|
12
|
|
13
|
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
|
14
|
import org.apache.log4j.Logger;
|
15
|
import org.hibernate.annotations.Cascade;
|
16
|
import org.hibernate.annotations.CascadeType;
|
17
|
|
18
|
import javax.persistence.*;
|
19
|
import javax.xml.bind.annotation.XmlAccessType;
|
20
|
import javax.xml.bind.annotation.XmlAccessorType;
|
21
|
import javax.xml.bind.annotation.XmlElement;
|
22
|
import javax.xml.bind.annotation.XmlIDREF;
|
23
|
import javax.xml.bind.annotation.XmlRootElement;
|
24
|
import javax.xml.bind.annotation.XmlSchemaType;
|
25
|
import javax.xml.bind.annotation.XmlType;
|
26
|
|
27
|
/**
|
28
|
* abstract class for all objects that may have a reference
|
29
|
* @author m.doering
|
30
|
* @version 1.0
|
31
|
* @created 08-Nov-2007 13:06:47
|
32
|
*/
|
33
|
@XmlAccessorType(XmlAccessType.FIELD)
|
34
|
@XmlType(name = "ReferencedEntityBase", propOrder = {
|
35
|
"citationMicroReference",
|
36
|
"originalNameString",
|
37
|
"citation"
|
38
|
})
|
39
|
@XmlRootElement(name = "ReferencedEntityBase")
|
40
|
@MappedSuperclass
|
41
|
public abstract class ReferencedEntityBase extends AnnotatableEntity implements IReferencedEntity {
|
42
|
|
43
|
static Logger logger = Logger.getLogger(ReferencedEntityBase.class);
|
44
|
|
45
|
//Details of the reference. These are mostly (implicitly) pages but can also be tables or any other element of a
|
46
|
//publication. {if the citationMicroReference exists then there must be also a reference}
|
47
|
@XmlElement(name = "Citation")
|
48
|
@XmlIDREF
|
49
|
@XmlSchemaType(name = "IDREF")
|
50
|
private ReferenceBase citation;
|
51
|
|
52
|
@XmlElement(name = "CitationMicroReference")
|
53
|
private String citationMicroReference;
|
54
|
|
55
|
@XmlElement(name = "OriginalNameString")
|
56
|
private String originalNameString;
|
57
|
|
58
|
public ReferencedEntityBase() {
|
59
|
super();
|
60
|
// TODO Auto-generated constructor stub
|
61
|
}
|
62
|
|
63
|
|
64
|
public ReferencedEntityBase(ReferenceBase citation, String citationMicroReference,
|
65
|
String originalNameString) {
|
66
|
super();
|
67
|
this.citationMicroReference = citationMicroReference;
|
68
|
this.originalNameString = originalNameString;
|
69
|
this.citation = citation;
|
70
|
}
|
71
|
|
72
|
|
73
|
|
74
|
public String getCitationMicroReference(){
|
75
|
return this.citationMicroReference;
|
76
|
}
|
77
|
public void setCitationMicroReference(String citationMicroReference){
|
78
|
this.citationMicroReference = citationMicroReference;
|
79
|
}
|
80
|
|
81
|
|
82
|
public String getOriginalNameString(){
|
83
|
return this.originalNameString;
|
84
|
}
|
85
|
public void setOriginalNameString(String originalNameString){
|
86
|
this.originalNameString = originalNameString;
|
87
|
}
|
88
|
|
89
|
@ManyToOne
|
90
|
@Cascade({CascadeType.SAVE_UPDATE})
|
91
|
public ReferenceBase getCitation(){
|
92
|
return this.citation;
|
93
|
}
|
94
|
public void setCitation(ReferenceBase citation) {
|
95
|
this.citation = citation;
|
96
|
}
|
97
|
|
98
|
//****************** CLONE ************************************************/
|
99
|
|
100
|
/* (non-Javadoc)
|
101
|
* @see java.lang.Object#clone()
|
102
|
*/
|
103
|
@Override
|
104
|
public Object clone() throws CloneNotSupportedException{
|
105
|
ReferencedEntityBase result = (ReferencedEntityBase)super.clone();
|
106
|
|
107
|
//no changes to: citation, citationMicroReference, originalNameString
|
108
|
return result;
|
109
|
}
|
110
|
|
111
|
}
|