2 * Copyright (C) 2009 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
.io
.specimen
.excel
.in
;
12 import java
.util
.ArrayList
;
13 import java
.util
.List
;
14 import java
.util
.TreeMap
;
16 import org
.apache
.log4j
.Logger
;
18 import eu
.etaxonomy
.cdm
.io
.excel
.common
.ExcelRowBase
;
19 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableSource
;
20 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignation
;
21 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignationStatus
;
22 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
23 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
30 public class SpecimenRow
extends ExcelRowBase
{
31 @SuppressWarnings("unused")
32 private static final Logger logger
= Logger
.getLogger(SpecimenRow
.class);
34 private String basisOfRecord
;
36 private String country
;
37 private String isoCountry
;
38 private String locality
;
39 private String latitude
;
40 private String longitude
;
41 private String referenceSystem
;
42 private String errorRadius
;
43 private String altitude
;
44 private String altitudeMax
;
45 private String fieldNotes
;
46 private String collectingDate
;
47 private String collectingDateEnd
;
48 private String collectorsNumber
;
52 private String accessionNumber
;
53 private String barcode
;
55 // private String author;
57 // private String family;
58 // private String genus;
59 // private String specificEpithet;
60 private String collectionCode
;
61 private String collection
;
64 private TreeMap
<Integer
, IdentifiableSource
> sources
= new TreeMap
<Integer
, IdentifiableSource
>();
65 private TreeMap
<Integer
, String
> collectors
= new TreeMap
<Integer
, String
>();
66 private TreeMap
<Integer
, String
> unitNotes
= new TreeMap
<Integer
, String
>();
67 private TreeMap
<Integer
, SpecimenTypeDesignation
> types
= new TreeMap
<Integer
, SpecimenTypeDesignation
>();
68 private TreeMap
<Integer
, DeterminationLight
> determinations
= new TreeMap
<Integer
, DeterminationLight
>();
69 private List
<PostfixTerm
> levels
= new ArrayList
<PostfixTerm
>();
73 public SpecimenRow() {
78 // may be public if necessary
79 protected class DeterminationLight
{
85 String infraSpeciesEpi
;
89 String determinedWhen
;
94 // **************************** GETTER / SETTER *********************************/
96 public void setBasisOfRecord(String basisOfRecord
) {
97 this.basisOfRecord
= basisOfRecord
;
101 public String
getBasisOfRecord() {
102 return basisOfRecord
;
106 public void setCountry(String country
) {
107 this.country
= country
;
111 public String
getCountry() {
116 public void setIsoCountry(String isoCountry
) {
117 this.isoCountry
= isoCountry
;
121 public String
getIsoCountry() {
126 public void setLocality(String locality
) {
127 this.locality
= locality
;
131 public String
getLocality() {
136 public void setFieldNotes(String fieldNotes
) {
137 this.fieldNotes
= fieldNotes
;
141 public String
getFieldNotes() {
146 public void setAccessionNumber(String accessionNumber
) {
147 this.accessionNumber
= accessionNumber
;
151 public String
getAccessionNumber() {
152 return accessionNumber
;
156 public void setBarcode(String barcode
) {
157 this.barcode
= barcode
;
161 // * @return the author
163 // public String getAuthor() {
169 // * @param author the author to set
171 // public void setAuthor(String author) {
172 // this.author = author;
177 * @return the absoluteElevation
179 public String
getAltitude() {
185 * @param absoluteElevation the absoluteElevation to set
187 public void setAltitude(String altitude
) {
188 this.altitude
= altitude
;
193 * @return the collectionCode
195 public String
getCollectionCode() {
196 return collectionCode
;
201 * @param collectionCode the collectionCode to set
203 public void setCollectionCode(String collectionCode
) {
204 this.collectionCode
= collectionCode
;
209 * @return the collectingDate
211 public String
getCollectingDate() {
212 return collectingDate
;
217 * @param collectingDate the collectingDate to set
219 public void setCollectingDate(String collectingDate
) {
220 this.collectingDate
= collectingDate
;
225 * @return the collectorsNumber
227 public String
getCollectorsNumber() {
228 return collectorsNumber
;
233 * @param collectorsNumber the collectorsNumber to set
235 public void setCollectorsNumber(String collectorsNumber
) {
236 this.collectorsNumber
= collectorsNumber
;
241 * @return the barcode
243 public String
getBarcode() {
249 * @return the collectingDateEnd
251 public String
getCollectingDateEnd() {
252 return collectingDateEnd
;
257 * @param collectingDateEnd the collectingDateEnd to set
259 public void setCollectingDateEnd(String collectingDateEnd
) {
260 this.collectingDateEnd
= collectingDateEnd
;
265 * @return the latitude
267 public String
getLatitude() {
273 * @param latitude the latitude to set
275 public void setLatitude(String latitude
) {
276 this.latitude
= latitude
;
281 * @return the longitude
283 public String
getLongitude() {
289 * @param longitude the longitude to set
291 public void setLongitude(String longitude
) {
292 this.longitude
= longitude
;
296 public void putIdInSource(int key
, String id
){
297 IdentifiableSource source
= getOrMakeSource(key
);
298 source
.setIdInSource(id
);
300 public void putSourceReference(int key
, Reference
<?
> reference
){
301 IdentifiableSource source
= getOrMakeSource(key
);
302 source
.setCitation(reference
);
305 public List
<IdentifiableSource
> getSources() {
306 return getOrdered(sources
);
309 public void putCollector(int key
, String collector
){
310 this.collectors
.put(key
, collector
);
313 public List
<String
> getCollectors() {
314 return getOrdered(collectors
);
317 public void putUnitNote(int key
, String unitNote
){
318 this.unitNotes
.put(key
, unitNote
);
321 public List
<String
> getUnitNotes() {
322 return getOrdered(unitNotes
);
331 private IdentifiableSource
getOrMakeSource(int key
) {
332 IdentifiableSource source
= sources
.get(key
);
334 source
= IdentifiableSource
.NewInstance();
335 sources
.put(key
, source
);
341 public void putTypeCategory(int key
, SpecimenTypeDesignationStatus status
){
342 SpecimenTypeDesignation designation
= getOrMakeTypeDesignation(key
);
343 designation
.setTypeStatus(status
);
345 public void putTypifiedName(int key
, TaxonNameBase
<?
,?
> name
){
347 SpecimenTypeDesignation designation
= getOrMakeTypeDesignation(key
);
348 name
.addTypeDesignation(designation
, false);
352 public List
<SpecimenTypeDesignation
> getTypeDesignations() {
353 return getOrdered(types
);
357 private SpecimenTypeDesignation
getOrMakeTypeDesignation(int key
) {
358 SpecimenTypeDesignation designation
= types
.get(key
);
359 if (designation
== null){
360 designation
= SpecimenTypeDesignation
.NewInstance();
361 types
.put(key
, designation
);
366 public void putDeterminationFamily(int key
, String family
){
367 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
368 determinationEvent
.family
= family
;
371 public void putDeterminationFullName(int key
, String fullName
){
372 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
373 determinationEvent
.fullName
= fullName
;
376 public void putDeterminationRank(int key
, String rank
){
377 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
378 determinationEvent
.rank
= rank
;
381 public void putDeterminationGenus(int key
, String genus
){
382 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
383 determinationEvent
.genus
= genus
;
386 public void putDeterminationSpeciesEpi(int key
, String speciesEpi
){
387 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
388 determinationEvent
.speciesEpi
= speciesEpi
;
391 public void putDeterminationInfraSpeciesEpi(int key
, String infraSpeciesEpi
){
392 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
393 determinationEvent
.infraSpeciesEpi
= infraSpeciesEpi
;
396 public void putDeterminationAuthor(int key
, String author
){
397 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
398 determinationEvent
.author
= author
;
401 public void putDeterminationDeterminedBy(int key
, String determinedBy
){
402 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
403 determinationEvent
.determinedBy
= determinedBy
;
406 public void putDeterminationDeterminedWhen(int key
, String determinedWhen
){
407 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
408 determinationEvent
.determinedWhen
= determinedWhen
;
411 public void putDeterminationDeterminationNotes(int key
, String notes
){
412 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
413 determinationEvent
.notes
= notes
;
416 public void putDeterminationDeterminationModifier(int key
, String modifier
){
417 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
418 determinationEvent
.modifier
= modifier
;
421 public List
<DeterminationLight
> getDetermination() {
422 return getOrdered(determinations
);
427 private DeterminationLight
getOrMakeDetermination(int key
) {
428 DeterminationLight determination
= this.determinations
.get(key
);
429 if (determination
== null){
430 determination
= new DeterminationLight();
431 this.determinations
.put(key
, determination
);
433 return determination
;
437 private<T
extends Object
> List
<T
> getOrdered(TreeMap
<?
, T
> tree
) {
438 List
<T
> result
= new ArrayList
<T
>();
439 for (T value
: tree
.values()){
445 public void setSex(String sex
) {
450 public String
getSex() {
456 * @return the referenceSystem
458 public String
getReferenceSystem() {
459 return referenceSystem
;
464 * @param referenceSystem the referenceSystem to set
466 public void setReferenceSystem(String referenceSystem
) {
467 this.referenceSystem
= referenceSystem
;
472 * @return the errorRadius
474 public String
getErrorRadius() {
480 * @param errorRadius the errorRadius to set
482 public void setErrorRadius(String errorRadius
) {
483 this.errorRadius
= errorRadius
;
487 public void setCollection(String collection
) {
488 this.collection
= collection
;
492 public String
getCollection() {
497 public void addLeveledArea(String levelPostfix
, String value
) {
498 PostfixTerm area
= new PostfixTerm();
500 area
.postfix
= levelPostfix
;
501 this.levels
.add(area
);
504 public List
<PostfixTerm
> getLeveledAreas(){
508 public void setAltitudeMax(String altitudeMax
) {
509 this.altitudeMax
= altitudeMax
;
513 public String
getAltitudeMax() {