3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
13 package eu
.etaxonomy
.cdm
.model
.reference
;
17 import javax
.persistence
.FetchType
;
18 import javax
.persistence
.ManyToOne
;
19 import javax
.persistence
.OneToMany
;
20 import javax
.xml
.bind
.annotation
.XmlAccessType
;
21 import javax
.xml
.bind
.annotation
.XmlAccessorType
;
22 import javax
.xml
.bind
.annotation
.XmlElement
;
23 import javax
.xml
.bind
.annotation
.XmlElementWrapper
;
24 import javax
.xml
.bind
.annotation
.XmlIDREF
;
25 import javax
.xml
.bind
.annotation
.XmlSchemaType
;
26 import javax
.xml
.bind
.annotation
.XmlType
;
28 import org
.apache
.log4j
.Logger
;
29 import org
.hibernate
.annotations
.Cascade
;
30 import org
.hibernate
.annotations
.CascadeType
;
31 import org
.hibernate
.envers
.Audited
;
33 import eu
.etaxonomy
.cdm
.model
.common
.VersionableEntity
;
40 @XmlAccessorType(XmlAccessType
.FIELD
)
41 @XmlType(name
= "ReferenceIdentity", propOrder
= {
43 "preferredAbbreviation",
48 public class ReferenceIdentity
extends VersionableEntity
{
49 private static final long serialVersionUID
= -6114973116800471106L;
50 @SuppressWarnings("unused")
51 private static final Logger logger
= Logger
.getLogger(ReferenceIdentity
.class);
53 @XmlElementWrapper(name
= "References")
54 @XmlElement(name
= "Reference")
56 @XmlSchemaType(name
= "IDREF")
57 @OneToMany(mappedBy
="name", fetch
= FetchType
.LAZY
)
58 private Set
<ReferenceBase
> references
;
60 @XmlElement(name
= "PreferredLongForm")
62 @XmlSchemaType(name
= "IDREF")
63 @ManyToOne(fetch
= FetchType
.LAZY
)
65 @Cascade(CascadeType
.SAVE_UPDATE
)
66 private ReferenceBase preferredLongForm
;
69 @XmlElement(name
= "PreferredAbbreviation")
71 @XmlSchemaType(name
= "IDREF")
72 @ManyToOne(fetch
= FetchType
.LAZY
)
74 @Cascade(CascadeType
.SAVE_UPDATE
)
75 private ReferenceBase preferredAbbreviation
;
79 * @return the references
81 public Set
<ReferenceBase
> getReferences() {
87 // * Adds the reference to this reference identity
91 // public boolean addReference(ReferenceBase reference){
92 // if (reference == null){
95 // if (reference.getReferenceIdentity() != null){
96 // reference.setReferenceIdentity(this);
98 // return this.references.add(reference);
101 // public boolean removeReference(ReferenceBase reference){
102 // if (reference == null){
105 // reference.setReferenceIdentity(null);
106 // return this.references.remove(reference);
111 * @return the preferredLongForm
113 public ReferenceBase
getPreferredLongForm() {
114 return preferredLongForm
;
118 * @param preferredLongForm the preferredLongForm to set
120 public void setPreferredLongForm(ReferenceBase preferredLongForm
) {
121 this.preferredLongForm
= preferredLongForm
;
125 * @return the preferredAbbreviation
127 public ReferenceBase
getPreferredAbbreviation() {
128 return preferredAbbreviation
;
132 * @param preferredAbbreviation the preferredAbbreviation to set
134 public void setPreferredAbbreviation(ReferenceBase preferredAbbreviation
) {
135 this.preferredAbbreviation
= preferredAbbreviation
;