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.
11 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
.JoinColumn
;
17 import javax
.xml
.bind
.annotation
.XmlElement
;
18 import javax
.xml
.bind
.annotation
.XmlIDREF
;
19 import javax
.xml
.bind
.annotation
.XmlSchemaType
;
20 import javax
.xml
.bind
.annotation
.XmlType
;
22 import org
.apache
.log4j
.Logger
;
23 import org
.hibernate
.annotations
.Any
;
24 import org
.hibernate
.envers
.Audited
;
25 import org
.hibernate
.envers
.NotAudited
;
27 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
30 * This class represents an {@link eu.etaxonomy.cdm.model.common.IOriginalSource IOriginalSource}
31 * that can be used with {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity identifiable entity}.
33 * @see eu.etaxonomy.cdm.model.common.IOriginalSource
39 @XmlType(name
= "IdentifiableSource", propOrder
= {
44 public class IdentifiableSource
extends OriginalSourceBase
<IdentifiableEntity
>{
45 private static final long serialVersionUID
= -8487673428764273806L;
46 @SuppressWarnings("unused")
47 private static final Logger logger
= Logger
.getLogger(IdentifiableSource
.class);
54 public static IdentifiableSource
NewInstance(){
55 return new IdentifiableSource();
58 public static IdentifiableSource
NewInstance(String id
){
59 IdentifiableSource result
= new IdentifiableSource();
60 result
.setIdInSource(id
);
64 public static IdentifiableSource
NewInstance(String id
, String idNamespace
){
65 IdentifiableSource result
= NewInstance(id
);
66 result
.setIdNamespace(idNamespace
);
70 public static IdentifiableSource
NewInstance(String id
, String idNamespace
, Reference citation
, String microCitation
){
71 IdentifiableSource result
= NewInstance(id
, idNamespace
);
72 result
.setCitation(citation
);
73 result
.setCitationMicroReference(microCitation
);
77 public static IdentifiableSource
NewInstance(Reference citation
, String microCitation
){
78 IdentifiableSource result
= NewInstance();
79 result
.setCitation(citation
);
80 result
.setCitationMicroReference(microCitation
);
84 @XmlElement(name
= "SourcedObject")
86 @XmlSchemaType(name
= "IDREF")
87 @Any(metaDef
= "CdmBase",
88 metaColumn
=@Column(name
= "sourcedObj_type"),
89 fetch
= FetchType
.LAZY
,
91 @JoinColumn(name
= "sourcedObj_id")
93 private IdentifiableEntity sourcedObj
;
97 * @see eu.etaxonomy.cdm.model.common.IOriginalSource#getSourcedObj()
99 public IdentifiableEntity
getSourcedObj() {
104 * @see eu.etaxonomy.cdm.model.common.IOriginalSource#setSourcedObj(eu.etaxonomy.cdm.model.common.IdentifiableEntity)
106 public void setSourcedObj(IdentifiableEntity sourcedObj
) {
107 this.sourcedObj
= sourcedObj
;
110 //*********************************** CLONE *********************************************************/
113 * Clones this original source and sets the clones sourced object to 'sourceObj'
114 * @see java.lang.Object#clone()
116 public IdentifiableSource
clone(IdentifiableEntity sourcedObj
) throws CloneNotSupportedException
{
117 IdentifiableSource result
= (IdentifiableSource
)clone();
118 result
.setSourcedObj(sourcedObj
);
123 * @see eu.etaxonomy.cdm.model.common.OriginalSourceBase#clone()
124 * @see java.lang.Object#clone()
127 public Object
clone() throws CloneNotSupportedException
{
128 IdentifiableSource result
= (IdentifiableSource
)super.clone();
130 //no changes to: sourcedObj