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.io.taxonx;
|
11
|
|
12
|
import org.apache.log4j.Logger;
|
13
|
|
14
|
import eu.etaxonomy.cdm.model.agent.AgentBase;
|
15
|
import eu.etaxonomy.cdm.model.common.Language;
|
16
|
import eu.etaxonomy.cdm.model.common.LanguageString;
|
17
|
import eu.etaxonomy.cdm.model.name.TaxonName;
|
18
|
import eu.etaxonomy.cdm.model.occurrence.Collection;
|
19
|
import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;
|
20
|
import eu.etaxonomy.cdm.model.occurrence.DerivationEventType;
|
21
|
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
|
22
|
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
|
23
|
import eu.etaxonomy.cdm.model.occurrence.GatheringEvent;
|
24
|
|
25
|
/**
|
26
|
* @author a.mueller
|
27
|
* @created 23.10.2008
|
28
|
* @version 1.0
|
29
|
*/
|
30
|
public class SimpleSpecimen {
|
31
|
private static final Logger logger = Logger.getLogger(SimpleSpecimen.class);
|
32
|
|
33
|
private GatheringEvent gatheringEvent;
|
34
|
private FieldUnit fieldUnit;
|
35
|
private DerivationEvent derivationEvent;
|
36
|
private DerivedUnit specimen;
|
37
|
private Collection collection;
|
38
|
private TaxonName storedUnderName;
|
39
|
private String titleCache;
|
40
|
|
41
|
|
42
|
public static SimpleSpecimen NewInstance(){
|
43
|
return new SimpleSpecimen();
|
44
|
}
|
45
|
|
46
|
private SimpleSpecimen(){
|
47
|
gatheringEvent = GatheringEvent.NewInstance();
|
48
|
|
49
|
//observation
|
50
|
fieldUnit = FieldUnit.NewInstance();
|
51
|
fieldUnit.setGatheringEvent(gatheringEvent);
|
52
|
|
53
|
//derivationEvent
|
54
|
derivationEvent = DerivationEvent.NewInstance(DerivationEventType.ACCESSIONING());
|
55
|
derivationEvent.addOriginal(fieldUnit);
|
56
|
|
57
|
//derivedUnit
|
58
|
specimen = DerivedUnit.NewPreservedSpecimenInstance();
|
59
|
derivationEvent.addDerivative(specimen);
|
60
|
}
|
61
|
|
62
|
public LanguageString getLocality(){
|
63
|
return gatheringEvent.getLocality();
|
64
|
}
|
65
|
|
66
|
|
67
|
/**
|
68
|
* Sets the locality string in the default language
|
69
|
* @param locality
|
70
|
*/
|
71
|
public void setLocality(String locality){
|
72
|
Language lang = Language.DEFAULT();
|
73
|
LanguageString langString = LanguageString.NewInstance(locality, lang);
|
74
|
setLocality(langString);
|
75
|
}
|
76
|
|
77
|
public void setLocality(LanguageString locality){
|
78
|
gatheringEvent.setLocality(locality);
|
79
|
}
|
80
|
|
81
|
/**
|
82
|
* @return the collection
|
83
|
*/
|
84
|
public Collection getCollection() {
|
85
|
return collection;
|
86
|
}
|
87
|
|
88
|
/**
|
89
|
* @param collection the collection to set
|
90
|
*/
|
91
|
public void setCollection(Collection collection) {
|
92
|
this.collection = collection;
|
93
|
}
|
94
|
|
95
|
/**
|
96
|
* @return the storedUnderName
|
97
|
*/
|
98
|
public TaxonName getStoredUnderName() {
|
99
|
return storedUnderName;
|
100
|
}
|
101
|
|
102
|
/**
|
103
|
* @param storedUnderName the storedUnderName to set
|
104
|
*/
|
105
|
public void setStoredUnderName(TaxonName storedUnderName) {
|
106
|
this.storedUnderName = storedUnderName;
|
107
|
}
|
108
|
|
109
|
/**
|
110
|
* @return the collection
|
111
|
*/
|
112
|
public AgentBase getCollector() {
|
113
|
return gatheringEvent.getCollector();
|
114
|
}
|
115
|
|
116
|
public void setCollector(AgentBase collector){
|
117
|
gatheringEvent.setCollector(collector);
|
118
|
}
|
119
|
|
120
|
/**
|
121
|
* @return the collectorsNumber
|
122
|
*/
|
123
|
public String getCollectorsNumber() {
|
124
|
return specimen.getCollectorsNumber();
|
125
|
}
|
126
|
|
127
|
/**
|
128
|
* @param collectorsNumber the collectorsNumber to set
|
129
|
*/
|
130
|
public void setCollectorsNumber(String collectorsNumber) {
|
131
|
this.specimen.setCollectorsNumber(collectorsNumber);
|
132
|
}
|
133
|
|
134
|
|
135
|
/**
|
136
|
* @return the specimen
|
137
|
*/
|
138
|
public DerivedUnit getSpecimen() {
|
139
|
return specimen;
|
140
|
}
|
141
|
|
142
|
/**
|
143
|
* @param specimen the specimen to set
|
144
|
*/
|
145
|
public void setSpecimen(DerivedUnit specimen) {
|
146
|
this.specimen = specimen;
|
147
|
}
|
148
|
|
149
|
/**
|
150
|
* @return the titleCache
|
151
|
*/
|
152
|
public String getTitleCache() {
|
153
|
return this.specimen.getTitleCache();
|
154
|
}
|
155
|
|
156
|
/**
|
157
|
* @param titleCache the titleCache to set
|
158
|
*/
|
159
|
public void setTitleCache(String titleCache) {
|
160
|
this.specimen.setTitleCache(titleCache, true);
|
161
|
}
|
162
|
|
163
|
|
164
|
|
165
|
}
|