Revision 0ecfd682
Added by Andreas Müller almost 8 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/DescriptionElementSource.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
package eu.etaxonomy.cdm.model.description; |
12 | 12 |
|
13 |
import javax.persistence.Column; |
|
14 | 13 |
import javax.persistence.Entity; |
15 | 14 |
import javax.persistence.FetchType; |
16 |
import javax.persistence.JoinColumn; |
|
17 | 15 |
import javax.persistence.ManyToOne; |
18 | 16 |
import javax.xml.bind.annotation.XmlElement; |
19 | 17 |
import javax.xml.bind.annotation.XmlIDREF; |
... | ... | |
21 | 19 |
import javax.xml.bind.annotation.XmlType; |
22 | 20 |
|
23 | 21 |
import org.apache.log4j.Logger; |
24 |
import org.hibernate.annotations.Any; |
|
25 | 22 |
import org.hibernate.annotations.Cascade; |
26 | 23 |
import org.hibernate.annotations.CascadeType; |
27 | 24 |
import org.hibernate.envers.Audited; |
28 |
import org.hibernate.envers.NotAudited; |
|
29 | 25 |
|
30 | 26 |
import eu.etaxonomy.cdm.model.common.OriginalSourceBase; |
31 | 27 |
import eu.etaxonomy.cdm.model.common.OriginalSourceType; |
... | ... | |
49 | 45 |
* @created 18.09.2009 |
50 | 46 |
*/ |
51 | 47 |
@XmlType(name = "DescriptionElementSource", propOrder = { |
52 |
"sourcedObj", |
|
53 | 48 |
"nameUsedInSource" |
54 | 49 |
}) |
55 | 50 |
@Entity |
... | ... | |
120 | 115 |
return result; |
121 | 116 |
} |
122 | 117 |
|
123 |
|
|
124 |
//TODO evtl. JoinTable http://www.programcreek.com/java-api-examples/index.php?api=org.hibernate.annotations.AnyMetaDef |
|
125 |
|
|
126 |
@XmlElement(name = "SourcedObject") |
|
127 |
@XmlIDREF |
|
128 |
@XmlSchemaType(name = "IDREF") |
|
129 |
@Any(metaDef = "CdmBase", |
|
130 |
metaColumn=@Column(name = "sourcedObj_type"), |
|
131 |
fetch = FetchType.LAZY, |
|
132 |
optional = false) |
|
133 |
@JoinColumn(name = "sourcedObj_id") |
|
134 |
@ManyToOne(fetch = FetchType.LAZY) |
|
135 |
@Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE}) |
|
136 |
@NotAudited |
|
137 |
private DescriptionElementBase sourcedObj; |
|
118 |
// ************************* FIELDS ********************************/ |
|
138 | 119 |
|
139 | 120 |
@XmlElement(name = "nameUsedInSource") |
140 | 121 |
@XmlIDREF |
... | ... | |
157 | 138 |
|
158 | 139 |
// ************************** GETTER / SETTER ***************************/ |
159 | 140 |
|
160 |
|
|
161 |
@Override |
|
162 |
public DescriptionElementBase getSourcedObj() { |
|
163 |
return sourcedObj; |
|
164 |
} |
|
165 |
|
|
166 |
@Override |
|
167 |
public void setSourcedObj(DescriptionElementBase sourcedObj) { |
|
168 |
this.sourcedObj = sourcedObj; |
|
169 |
} |
|
170 |
|
|
171 |
|
|
172 | 141 |
/** |
173 | 142 |
* @return the taxonNameUsedInSource |
174 | 143 |
*/ |
... | ... | |
186 | 155 |
|
187 | 156 |
//*********************************** CLONE *********************************************************/ |
188 | 157 |
|
189 |
|
|
190 |
/** |
|
191 |
* Clones this original source and sets the clones sourced object to 'sourceObj' |
|
192 |
* @see java.lang.Object#clone() |
|
193 |
*/ |
|
194 |
public DescriptionElementSource clone(DescriptionElementBase sourcedObj) throws CloneNotSupportedException{ |
|
195 |
DescriptionElementSource result = (DescriptionElementSource)clone(); |
|
196 |
result.setSourcedObj(sourcedObj); |
|
197 |
return result; |
|
198 |
} |
|
199 |
|
|
200 | 158 |
@Override |
201 | 159 |
public Object clone() throws CloneNotSupportedException{ |
202 | 160 |
DescriptionElementSource result = (DescriptionElementSource)super.clone(); |
203 | 161 |
|
204 |
//no changes to: sourcedObj
|
|
162 |
//no changes |
|
205 | 163 |
return result; |
206 | 164 |
} |
207 | 165 |
|
Also available in: Unified diff
Remove bidirectionality for supplemental data #5743