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
.Entity
;
14 import javax
.persistence
.Transient
;
16 import org
.apache
.log4j
.Logger
;
19 * Other names/labels/titles (abreviated or not) for the same object (person,
20 * reference, source, etc.)
23 * @created 08-Nov-2007 13:06:22
27 public class OriginalSource
extends ReferencedEntityBase
implements Cloneable
{
28 static Logger logger
= Logger
.getLogger(OriginalSource
.class);
29 //The object's ID in the source, where the alternative string comes from
30 private String idInSource
;
31 private String idNamespace
;
32 private IdentifiableEntity sourcedObj
;
38 public static OriginalSource
NewInstance(){
39 return new OriginalSource();
42 public static OriginalSource
NewInstance(String id
){
43 OriginalSource result
= new OriginalSource();
44 result
.setIdInSource(id
);
48 public static OriginalSource
NewInstance(String id
, String idNamespace
){
49 OriginalSource result
= new OriginalSource();
50 result
.setIdInSource(id
);
51 result
.setIdNamespace(idNamespace
);
59 public OriginalSource(){
63 /*************** GETTER /SETTER ************************************/
65 public String
getIdInSource(){
66 return this.idInSource
;
68 public void setIdInSource(String idInSource
){
69 this.idInSource
= idInSource
;
74 * Returns the id namespace. The id namespace is a String that further defines the origin of
75 * the original record. In the combination with the id it should be unique within one a source.
76 * E.g. if a record comes from table ABC and has the id 345, 'ABC' is a suitable namespace and the
77 * combination of 'ABC' and 345 is a unique id for this source.
78 * The namespace is meant to distinguish import records that come from two different tables, elements, objects, ...
79 * and end up in the same CDM class. In this case the id may not be enough to identify the original record.
80 * @return the idNamespace
82 public String
getIdNamespace() {
87 * @param idNamespace the idNamespace to set
89 public void setIdNamespace(String idNamespace
) {
90 this.idNamespace
= idNamespace
;
95 // @Cascade(CascadeType.SAVE_UPDATE)
96 @Transient //beacause IdentifiableEntity is MappedSuperclass
97 public IdentifiableEntity
getSourcedObj() {
100 public void setSourcedObj(IdentifiableEntity sourcedObj
) {
101 this.sourcedObj
= sourcedObj
;
106 //****************** CLONE ************************************************/
109 * @see java.lang.Object#clone()
112 public Object
clone() throws CloneNotSupportedException
{
113 OriginalSource result
= (OriginalSource
)super.clone();
115 //no changes to: idInSource, sourcedObj
120 * Clones this original source and sets the clones sourced object to 'sourceObj'
121 * @see java.lang.Object#clone()
123 public OriginalSource
clone(IdentifiableEntity sourcedObj
) throws CloneNotSupportedException
{
124 OriginalSource result
= (OriginalSource
)clone();
125 result
.setSourcedObj(sourcedObj
);