2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.model
.common
;
13 import javax
.persistence
.FetchType
;
14 import javax
.persistence
.ManyToOne
;
15 import javax
.persistence
.MappedSuperclass
;
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
;
24 import org
.apache
.log4j
.Logger
;
25 import org
.hibernate
.annotations
.Cascade
;
26 import org
.hibernate
.annotations
.CascadeType
;
27 import org
.hibernate
.envers
.Audited
;
29 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
32 * abstract class for all objects that may have a reference
35 * @created 08-Nov-2007 13:06:47
37 @XmlAccessorType(XmlAccessType
.FIELD
)
38 @XmlType(name
= "ReferencedEntityBase", propOrder
= {
39 "citationMicroReference",
43 @XmlRootElement(name
= "ReferencedEntityBase")
46 public abstract class ReferencedEntityBase
extends AnnotatableEntity
implements IReferencedEntity
{
47 private static final long serialVersionUID
= -5614669050360359126L;
48 @SuppressWarnings("unused")
49 private static final Logger logger
= Logger
.getLogger(ReferencedEntityBase
.class);
51 //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 @XmlElement(name
= "Citation")
55 @XmlSchemaType(name
= "IDREF")
56 @ManyToOne(fetch
= FetchType
.LAZY
)
57 @Cascade({CascadeType
.SAVE_UPDATE
,CascadeType
.MERGE
})
58 private Reference
<?
> citation
;
60 @XmlElement(name
= "CitationMicroReference")
61 private String citationMicroReference
;
63 @XmlElement(name
= "OriginalNameString")
64 private String originalNameString
;
66 // ************ CONSTRUCTOR ********************************************/
68 //for hibernate use only
69 protected ReferencedEntityBase() {
75 public ReferencedEntityBase(Reference citation
, String citationMicroReference
,
76 String originalNameString
) {
78 this.citationMicroReference
= citationMicroReference
;
79 this.originalNameString
= originalNameString
;
80 this.citation
= citation
;
83 //********************* GETTER / SETTER *******************************/
85 public String
getCitationMicroReference(){
86 return this.citationMicroReference
;
88 public void setCitationMicroReference(String citationMicroReference
){
89 this.citationMicroReference
= citationMicroReference
;
93 public String
getOriginalNameString(){
94 return this.originalNameString
;
96 public void setOriginalNameString(String originalNameString
){
97 this.originalNameString
= originalNameString
;
100 public Reference
getCitation(){
101 return this.citation
;
103 public void setCitation(Reference citation
) {
104 this.citation
= citation
;
107 //****************** CLONE ************************************************/
110 * @see java.lang.Object#clone()
113 public Object
clone() throws CloneNotSupportedException
{
114 ReferencedEntityBase result
= (ReferencedEntityBase
)super.clone();
116 //no changes to: citation, citationMicroReference, originalNameString