1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.cdm.model.common;
|
11
|
|
12
|
import javax.persistence.Entity;
|
13
|
import javax.xml.bind.annotation.XmlType;
|
14
|
|
15
|
import org.apache.log4j.Logger;
|
16
|
import org.hibernate.envers.Audited;
|
17
|
|
18
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
19
|
|
20
|
/**
|
21
|
* This class represents an {@link eu.etaxonomy.cdm.model.common.IOriginalSource IOriginalSource}
|
22
|
* that can be used with {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity identifiable entity}.
|
23
|
*
|
24
|
* @see eu.etaxonomy.cdm.model.common.IOriginalSource
|
25
|
*
|
26
|
* @author a.mueller
|
27
|
* @since 18.09.2009
|
28
|
*/
|
29
|
@XmlType(name = "IdentifiableSource", propOrder = {
|
30
|
})
|
31
|
@Entity
|
32
|
@Audited
|
33
|
public class IdentifiableSource extends OriginalSourceBase<IdentifiableEntity>{
|
34
|
private static final long serialVersionUID = -8487673428764273806L;
|
35
|
@SuppressWarnings("unused")
|
36
|
private static final Logger logger = Logger.getLogger(IdentifiableSource.class);
|
37
|
|
38
|
//********************************* FACTORY ********************************************************/
|
39
|
|
40
|
public static IdentifiableSource NewInstance(OriginalSourceType type){
|
41
|
return new IdentifiableSource(type);
|
42
|
}
|
43
|
|
44
|
public static IdentifiableSource NewDataImportInstance(String id){
|
45
|
IdentifiableSource result = new IdentifiableSource(OriginalSourceType.Import);
|
46
|
result.setIdInSource(id);
|
47
|
return result;
|
48
|
}
|
49
|
|
50
|
public static IdentifiableSource NewDataImportInstance(String id, String idNamespace){
|
51
|
IdentifiableSource result = NewDataImportInstance(id);
|
52
|
result.setIdNamespace(idNamespace);
|
53
|
return result;
|
54
|
}
|
55
|
|
56
|
public static IdentifiableSource NewDataImportInstance(String id, String idNamespace, Reference ref){
|
57
|
IdentifiableSource result = NewDataImportInstance(id, idNamespace);
|
58
|
result.setCitation(ref);
|
59
|
return result;
|
60
|
}
|
61
|
|
62
|
public static IdentifiableSource NewInstance(OriginalSourceType type, String id, String idNamespace, Reference citation, String microCitation){
|
63
|
IdentifiableSource result = NewInstance(type);
|
64
|
result.setIdInSource(id);
|
65
|
result.setIdNamespace(idNamespace);
|
66
|
result.setCitation(citation);
|
67
|
result.setCitationMicroReference(microCitation);
|
68
|
return result;
|
69
|
}
|
70
|
|
71
|
public static IdentifiableSource NewPrimarySourceInstance(Reference citation, String microCitation){
|
72
|
IdentifiableSource result = NewInstance(OriginalSourceType.PrimaryTaxonomicSource);
|
73
|
result.setCitation(citation);
|
74
|
result.setCitationMicroReference(microCitation);
|
75
|
return result;
|
76
|
}
|
77
|
|
78
|
public static IdentifiableSource NewPrimaryMediaSourceInstance(Reference citation, String microCitation){
|
79
|
IdentifiableSource result = NewInstance(OriginalSourceType.PrimaryMediaSource);
|
80
|
result.setCitation(citation);
|
81
|
result.setCitationMicroReference(microCitation);
|
82
|
return result;
|
83
|
}
|
84
|
|
85
|
// ******************************** FIELDS ************************************/
|
86
|
|
87
|
|
88
|
|
89
|
// ****************** CONSTRUCTOR ********************************/
|
90
|
|
91
|
//for hibernate only
|
92
|
private IdentifiableSource() {
|
93
|
}
|
94
|
|
95
|
private IdentifiableSource(OriginalSourceType type) {
|
96
|
super(type);
|
97
|
}
|
98
|
|
99
|
// ********************** GETTER /SETTER *****************************/
|
100
|
|
101
|
|
102
|
//*********************************** CLONE *********************************************************/
|
103
|
|
104
|
|
105
|
@Override
|
106
|
public Object clone() throws CloneNotSupportedException{
|
107
|
IdentifiableSource result = (IdentifiableSource)super.clone();
|
108
|
|
109
|
//no changes
|
110
|
return result;
|
111
|
}
|
112
|
|
113
|
|
114
|
}
|