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
.Column
;
14 import javax
.persistence
.Entity
;
15 import javax
.persistence
.FetchType
;
16 import javax
.persistence
.Inheritance
;
17 import javax
.persistence
.InheritanceType
;
18 import javax
.persistence
.JoinColumn
;
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
;
27 import org
.apache
.log4j
.Logger
;
28 import org
.hibernate
.annotations
.Any
;
29 import org
.hibernate
.annotations
.Table
;
30 import org
.hibernate
.envers
.Audited
;
31 import org
.hibernate
.envers
.NotAudited
;
34 * Abstract base class for classes implementing {@link eu.etaxonomy.cdm.model.common.IOriginalSource IOriginalSource}.
35 * @see eu.etaxonomy.cdm.model.common.IOriginalSource
39 * @created 08-Nov-2007 13:06:22
42 @XmlAccessorType(XmlAccessType
.FIELD
)
43 @XmlType(name
= "OriginalSource", propOrder
= {
47 @XmlRootElement(name
= "OriginalSource")
50 @Inheritance(strategy
=InheritanceType
.SINGLE_TABLE
)
51 @Table(appliesTo
="OriginalSourceBase")
52 public abstract class OriginalSourceBase
<T
extends ISourceable
> extends ReferencedEntityBase
implements Cloneable
, IOriginalSource
<T
> {
53 private static final long serialVersionUID
= -1972959999261181462L;
54 @SuppressWarnings("unused")
55 private static final Logger logger
= Logger
.getLogger(OriginalSourceBase
.class);
57 //The object's ID in the source, where the alternative string comes from
58 @XmlElement(name
= "IdInSource")
59 private String idInSource
;
61 @XmlElement(name
= "IdNamespace")
62 private String idNamespace
;
64 /*@XmlElement(name = "SourcedObject")
66 @XmlSchemaType(name = "IDREF")
67 @Any(metaDef = "CdmBase",
68 metaColumn=@Column(name = "sourcedObj_type"),
69 fetch = FetchType.LAZY,
71 @JoinColumn(name = "sourcedObj_id")
73 protected IdentifiableEntity sourcedObj;*/
78 protected OriginalSourceBase(){
83 * @see eu.etaxonomy.cdm.model.common.IOriginalSource#getIdInSource()
86 public String
getIdInSource(){
87 return this.idInSource
;
90 * @see eu.etaxonomy.cdm.model.common.IOriginalSource#setIdInSource(java.lang.String)
92 public void setIdInSource(String idInSource
){
93 this.idInSource
= idInSource
;
98 * @see eu.etaxonomy.cdm.model.common.IOriginalSource#getIdNamespace()
100 public String
getIdNamespace() {
105 * @see eu.etaxonomy.cdm.model.common.IOriginalSource#setIdNamespace(java.lang.String)
107 public void setIdNamespace(String idNamespace
) {
108 this.idNamespace
= idNamespace
;
112 //****************** CLONE ************************************************/
115 * @see java.lang.Object#clone()
118 public Object
clone() throws CloneNotSupportedException
{
119 OriginalSourceBase result
= (OriginalSourceBase
)super.clone();
121 //no changes to: idInSource, sourcedObj
126 * Clones this original source and sets the clones sourced object to 'sourceObj'
127 * @see java.lang.Object#clone()
129 public OriginalSourceBase
clone(IdentifiableEntity sourcedObj
) throws CloneNotSupportedException
{
130 OriginalSourceBase result
= (OriginalSourceBase
)clone();
131 result
.setSourcedObj(sourcedObj
);