Revision a784f00f
Added by Katja Luther about 14 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/IdentifiableEntity.java | ||
---|---|---|
99 | 99 |
@XmlElement(name = "TitleCache", required = true) |
100 | 100 |
@XmlJavaTypeAdapter(FormattedTextAdapter.class) |
101 | 101 |
@Column(length=255, name="titleCache") |
102 |
@Fields({@Field(index = org.hibernate.search.annotations.Index.TOKENIZED), |
|
103 |
@Field(name = "titleCache_forSort", index = org.hibernate.search.annotations.Index.UN_TOKENIZED)
|
|
102 |
@Fields({@Field(name = "titleCache_tokenized",index = org.hibernate.search.annotations.Index.TOKENIZED),
|
|
103 |
@Field(index = org.hibernate.search.annotations.Index.UN_TOKENIZED) |
|
104 | 104 |
}) |
105 | 105 |
@FieldBridge(impl=StripHtmlBridge.class) |
106 | 106 |
@Match(value=MatchMode.CACHE, cacheReplaceMode=ReplaceMode.ALL) |
... | ... | |
112 | 112 |
@XmlElement(name = "ProtectedTitleCache") |
113 | 113 |
protected boolean protectedTitleCache; |
114 | 114 |
|
115 |
@XmlElementWrapper(name = "Rights") |
|
115 |
@XmlElementWrapper(name = "Rights", nillable = true)
|
|
116 | 116 |
@XmlElement(name = "Rights") |
117 | 117 |
@OneToMany(fetch = FetchType.LAZY) |
118 | 118 |
@Cascade({CascadeType.SAVE_UPDATE, CascadeType.MERGE, CascadeType.DELETE, CascadeType.DELETE_ORPHAN}) |
119 | 119 |
//TODO |
120 | 120 |
@Merge(MergeMode.ADD_CLONE) |
121 |
@NotNull |
|
122 |
private Set<Rights> rights = new HashSet<Rights>(); |
|
121 |
private Set<Rights> rights; |
|
123 | 122 |
|
124 |
@XmlElementWrapper(name = "Credits") |
|
123 |
@XmlElementWrapper(name = "Credits", nillable = true)
|
|
125 | 124 |
@XmlElement(name = "Credit") |
126 | 125 |
@IndexColumn(name="sortIndex", base = 0) |
127 | 126 |
@OneToMany(fetch = FetchType.LAZY) |
128 | 127 |
@Cascade({CascadeType.SAVE_UPDATE, CascadeType.MERGE, CascadeType.DELETE, CascadeType.DELETE_ORPHAN}) |
129 | 128 |
//TODO |
130 | 129 |
@Merge(MergeMode.ADD_CLONE) |
131 |
@NotNull |
|
132 |
private List<Credit> credits = new ArrayList<Credit>(); |
|
130 |
private List<Credit> credits; |
|
133 | 131 |
|
134 |
@XmlElementWrapper(name = "Extensions") |
|
132 |
@XmlElementWrapper(name = "Extensions", nillable = true)
|
|
135 | 133 |
@XmlElement(name = "Extension") |
136 | 134 |
@OneToMany(fetch = FetchType.LAZY) |
137 | 135 |
@Cascade({CascadeType.SAVE_UPDATE, CascadeType.MERGE, CascadeType.DELETE, CascadeType.DELETE_ORPHAN}) |
138 | 136 |
@Merge(MergeMode.ADD_CLONE) |
139 |
@NotNull |
|
140 |
private Set<Extension> extensions = new HashSet<Extension>(); |
|
137 |
private Set<Extension> extensions; |
|
141 | 138 |
|
142 |
@XmlElementWrapper(name = "Sources") |
|
139 |
@XmlElementWrapper(name = "Sources", nillable = true)
|
|
143 | 140 |
@XmlElement(name = "IdentifiableSource") |
144 | 141 |
@OneToMany(fetch = FetchType.LAZY) |
145 | 142 |
@Cascade({CascadeType.SAVE_UPDATE, CascadeType.MERGE, CascadeType.DELETE, CascadeType.DELETE_ORPHAN}) |
146 | 143 |
@Merge(MergeMode.ADD_CLONE) |
147 |
@NotNull |
|
148 |
private Set<IdentifiableSource> sources = new HashSet<IdentifiableSource>(); |
|
144 |
private Set<IdentifiableSource> sources; |
|
149 | 145 |
|
150 | 146 |
@XmlTransient |
151 | 147 |
@Transient |
... | ... | |
252 | 248 |
* @see eu.etaxonomy.cdm.model.common.IIdentifiableEntity#addRights(eu.etaxonomy.cdm.model.media.Rights) |
253 | 249 |
*/ |
254 | 250 |
public void addRights(Rights right){ |
255 |
this.rights.add(right);
|
|
251 |
getRights().add(right);
|
|
256 | 252 |
} |
257 | 253 |
/* (non-Javadoc) |
258 | 254 |
* @see eu.etaxonomy.cdm.model.common.IIdentifiableEntity#removeRights(eu.etaxonomy.cdm.model.media.Rights) |
259 | 255 |
*/ |
260 | 256 |
public void removeRights(Rights right){ |
261 |
this.rights.remove(right);
|
|
257 |
getRights().remove(right);
|
|
262 | 258 |
} |
263 | 259 |
|
264 | 260 |
|
... | ... | |
273 | 269 |
* @see eu.etaxonomy.cdm.model.common.IIdentifiableEntity#getCredits(int) |
274 | 270 |
*/ |
275 | 271 |
public Credit getCredits(int index){ |
276 |
return this.credits.get(index);
|
|
272 |
return getCredits().get(index);
|
|
277 | 273 |
} |
278 | 274 |
|
279 | 275 |
/* (non-Javadoc) |
280 | 276 |
* @see eu.etaxonomy.cdm.model.common.IIdentifiableEntity#addCredit(eu.etaxonomy.cdm.model.common.Credit) |
281 | 277 |
*/ |
282 | 278 |
public void addCredit(Credit credit){ |
283 |
this.credits.add(credit);
|
|
279 |
getCredits().add(credit);
|
|
284 | 280 |
} |
285 | 281 |
|
286 | 282 |
|
... | ... | |
288 | 284 |
* @see eu.etaxonomy.cdm.model.common.IIdentifiableEntity#addCredit(eu.etaxonomy.cdm.model.common.Credit, int) |
289 | 285 |
*/ |
290 | 286 |
public void addCredit(Credit credit, int index){ |
291 |
this.credits.add(index, credit);
|
|
287 |
getCredits().add(index, credit);
|
|
292 | 288 |
} |
293 | 289 |
|
294 | 290 |
/* (non-Javadoc) |
295 | 291 |
* @see eu.etaxonomy.cdm.model.common.IIdentifiableEntity#removeCredit(eu.etaxonomy.cdm.model.common.Credit) |
296 | 292 |
*/ |
297 | 293 |
public void removeCredit(Credit credit){ |
298 |
this.credits.remove(credit);
|
|
294 |
getCredits().remove(credit);
|
|
299 | 295 |
} |
300 | 296 |
|
301 | 297 |
/* (non-Javadoc) |
302 | 298 |
* @see eu.etaxonomy.cdm.model.common.IIdentifiableEntity#removeCredit(int) |
303 | 299 |
*/ |
304 | 300 |
public void removeCredit(int index){ |
305 |
this.credits.remove(index);
|
|
301 |
getCredits().remove(index);
|
|
306 | 302 |
} |
307 | 303 |
|
308 | 304 |
|
... | ... | |
326 | 322 |
public void addExtension(Extension extension){ |
327 | 323 |
if (extension != null){ |
328 | 324 |
extension.setExtendedObj(this); |
329 |
this.extensions.add(extension);
|
|
325 |
getExtensions().add(extension);
|
|
330 | 326 |
} |
331 | 327 |
} |
332 | 328 |
/* (non-Javadoc) |
... | ... | |
335 | 331 |
public void removeExtension(Extension extension){ |
336 | 332 |
if (extension != null){ |
337 | 333 |
extension.setExtendedObj(null); |
338 |
this.extensions.remove(extension);
|
|
334 |
getExtensions().remove(extension);
|
|
339 | 335 |
} |
340 | 336 |
} |
341 | 337 |
|
... | ... | |
373 | 369 |
if (oldSourcedObj != null && oldSourcedObj != this){ |
374 | 370 |
oldSourcedObj.getSources().remove(source); |
375 | 371 |
} |
376 |
this.sources.add(source);
|
|
372 |
getSources().add(source);
|
|
377 | 373 |
source.setSourcedObj(this); |
378 | 374 |
} |
379 | 375 |
} |
... | ... | |
382 | 378 |
* @see eu.etaxonomy.cdm.model.common.ISourceable#removeSource(eu.etaxonomy.cdm.model.common.IOriginalSource) |
383 | 379 |
*/ |
384 | 380 |
public void removeSource(IdentifiableSource source) { |
385 |
this.sources.remove(source);
|
|
381 |
getSources().remove(source);
|
|
386 | 382 |
} |
387 | 383 |
|
388 | 384 |
//******************************** TO STRING *****************************************************/ |
... | ... | |
511 | 507 |
|
512 | 508 |
//Extensions |
513 | 509 |
result.extensions = new HashSet<Extension>(); |
514 |
for (Extension extension : this.extensions ){
|
|
510 |
for (Extension extension : getExtensions() ){
|
|
515 | 511 |
Extension newExtension = (Extension)extension.clone(); |
516 | 512 |
result.addExtension(newExtension); |
517 | 513 |
} |
518 | 514 |
|
519 | 515 |
//OriginalSources |
520 | 516 |
result.sources = new HashSet<IdentifiableSource>(); |
521 |
for (IdentifiableSource source : this.sources){
|
|
517 |
for (IdentifiableSource source : getSources()){
|
|
522 | 518 |
IdentifiableSource newSource = (IdentifiableSource)source.clone(); |
523 | 519 |
result.addSource(newSource); |
524 | 520 |
} |
525 | 521 |
|
526 | 522 |
//Rights |
527 | 523 |
result.rights = new HashSet<Rights>(); |
528 |
for(Rights rights : this.rights) {
|
|
524 |
for(Rights rights : getRights()) {
|
|
529 | 525 |
result.addRights(rights); |
530 | 526 |
} |
531 | 527 |
|
532 | 528 |
|
533 | 529 |
//Rights |
534 | 530 |
result.credits = new ArrayList<Credit>(); |
535 |
for(Credit credit : this.credits) {
|
|
531 |
for(Credit credit : getCredits()) {
|
|
536 | 532 |
result.addCredit(credit); |
537 | 533 |
} |
538 | 534 |
|
Also available in: Unified diff
merge cate-development2 branch with trunk