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
;
15 import java
.util
.TreeMap
;
16 import java
.util
.UUID
;
18 import org
.apache
.log4j
.Logger
;
20 import eu
.etaxonomy
.cdm
.io
.specimen
.excel
.in
.SpecimenRow
.LeveledArea
;
21 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableSource
;
22 import eu
.etaxonomy
.cdm
.model
.location
.NamedArea
;
23 import eu
.etaxonomy
.cdm
.model
.location
.NamedAreaLevel
;
24 import eu
.etaxonomy
.cdm
.model
.name
.NomenclaturalCode
;
25 import eu
.etaxonomy
.cdm
.model
.name
.NonViralName
;
26 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
27 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignation
;
28 import eu
.etaxonomy
.cdm
.model
.name
.SpecimenTypeDesignationStatus
;
29 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
30 import eu
.etaxonomy
.cdm
.model
.occurrence
.DeterminationEvent
;
31 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
38 public class SpecimenRow
{
39 @SuppressWarnings("unused")
40 private static final Logger logger
= Logger
.getLogger(SpecimenRow
.class);
42 private UUID uuid
= null;
43 private String basisOfRecord
;
44 private String country
;
45 private String isoCountry
;
46 private String locality
;
47 private String latitude
;
48 private String longitude
;
49 private String fieldNotes
;
50 private String fieldNumber
;
51 private String accessionNumber
;
52 private String barcode
;
53 // private String author;
54 private String absoluteElevation
;
55 // private String family;
56 // private String genus;
57 // private String specificEpithet;
59 private String ecology
;
60 private String plantDescription
;
61 private String collectionCode
;
62 private String collection
;
63 private String collectingDate
;
64 private String collectingDateEnd
;
65 private String collectorsNumber
;
66 private String referenceSystem
;
67 private String errorRadius
;
70 private TreeMap
<Integer
, IdentifiableSource
> sources
= new TreeMap
<Integer
, IdentifiableSource
>();
71 private TreeMap
<Integer
, String
> collectors
= new TreeMap
<Integer
, String
>();
72 private TreeMap
<Integer
, SpecimenTypeDesignation
> types
= new TreeMap
<Integer
, SpecimenTypeDesignation
>();
73 private TreeMap
<Integer
, DeterminationLight
> determinations
= new TreeMap
<Integer
, DeterminationLight
>();
74 private List
<LeveledArea
> levels
= new ArrayList
<LeveledArea
>();
78 public SpecimenRow() {
81 protected class LeveledArea
{
88 // may be public if necessary
89 protected class DeterminationLight
{
95 String infraSpeciesEpi
;
99 String determinedWhen
;
104 // **************************** GETTER / SETTER *********************************/
107 public void setUuid(UUID uuid
) {
112 public UUID
getUuid() {
117 public void setBasisOfRecord(String basisOfRecord
) {
118 this.basisOfRecord
= basisOfRecord
;
122 public String
getBasisOfRecord() {
123 return basisOfRecord
;
127 public void setCountry(String country
) {
128 this.country
= country
;
132 public String
getCountry() {
137 public void setIsoCountry(String isoCountry
) {
138 this.isoCountry
= isoCountry
;
142 public String
getIsoCountry() {
147 public void setLocality(String locality
) {
148 this.locality
= locality
;
152 public String
getLocality() {
157 public void setFieldNotes(String fieldNotes
) {
158 this.fieldNotes
= fieldNotes
;
162 public String
getFieldNotes() {
167 public void setAccessionNumber(String accessionNumber
) {
168 this.accessionNumber
= accessionNumber
;
172 public String
getAccessionNumber() {
173 return accessionNumber
;
177 public void setFieldNumber(String fieldNumber
) {
178 this.fieldNumber
= fieldNumber
;
182 public String
getFieldNumber() {
187 public void setBarcode(String barcode
) {
188 this.barcode
= barcode
;
192 // * @return the author
194 // public String getAuthor() {
200 // * @param author the author to set
202 // public void setAuthor(String author) {
203 // this.author = author;
208 * @return the absoluteElevation
210 public String
getAbsoluteElevation() {
211 return absoluteElevation
;
216 * @param absoluteElevation the absoluteElevation to set
218 public void setAbsoluteElevation(String absoluteElevation
) {
219 this.absoluteElevation
= absoluteElevation
;
225 * @return the ecology
227 public String
getEcology() {
233 * @param ecology the ecology to set
235 public void setEcology(String ecology
) {
236 this.ecology
= ecology
;
241 * @return the plantDescription
243 public String
getPlantDescription() {
244 return plantDescription
;
249 * @param plantDescription the plantDescription to set
251 public void setPlantDescription(String plantDescription
) {
252 this.plantDescription
= plantDescription
;
257 * @return the collectionCode
259 public String
getCollectionCode() {
260 return collectionCode
;
265 * @param collectionCode the collectionCode to set
267 public void setCollectionCode(String collectionCode
) {
268 this.collectionCode
= collectionCode
;
273 * @return the collectingDate
275 public String
getCollectingDate() {
276 return collectingDate
;
281 * @param collectingDate the collectingDate to set
283 public void setCollectingDate(String collectingDate
) {
284 this.collectingDate
= collectingDate
;
289 * @return the collectorsNumber
291 public String
getCollectorsNumber() {
292 return collectorsNumber
;
297 * @param collectorsNumber the collectorsNumber to set
299 public void setCollectorsNumber(String collectorsNumber
) {
300 this.collectorsNumber
= collectorsNumber
;
305 * @return the barcode
307 public String
getBarcode() {
313 * @return the collectingDateEnd
315 public String
getCollectingDateEnd() {
316 return collectingDateEnd
;
321 * @param collectingDateEnd the collectingDateEnd to set
323 public void setCollectingDateEnd(String collectingDateEnd
) {
324 this.collectingDateEnd
= collectingDateEnd
;
329 * @return the latitude
331 public String
getLatitude() {
337 * @param latitude the latitude to set
339 public void setLatitude(String latitude
) {
340 this.latitude
= latitude
;
345 * @return the longitude
347 public String
getLongitude() {
353 * @param longitude the longitude to set
355 public void setLongitude(String longitude
) {
356 this.longitude
= longitude
;
360 public void putIdInSource(int key
, String id
){
361 IdentifiableSource source
= getOrMakeSource(key
);
362 source
.setIdInSource(id
);
364 public void putSourceReference(int key
, Reference
<?
> reference
){
365 IdentifiableSource source
= getOrMakeSource(key
);
366 source
.setCitation(reference
);
369 public List
<IdentifiableSource
> getSources() {
370 return getOrdered(sources
);
373 public void putCollector(int key
, String collector
){
374 this.collectors
.put(key
, collector
);
377 public List
<String
> getCollectors() {
378 return getOrdered(collectors
);
387 private IdentifiableSource
getOrMakeSource(int key
) {
388 IdentifiableSource source
= sources
.get(key
);
390 source
= IdentifiableSource
.NewInstance();
391 sources
.put(key
, source
);
397 public void putTypeCategory(int key
, SpecimenTypeDesignationStatus status
){
398 SpecimenTypeDesignation designation
= getOrMakeTypeDesignation(key
);
399 designation
.setTypeStatus(status
);
401 public void putTypifiedName(int key
, TaxonNameBase
<?
,?
> name
){
403 SpecimenTypeDesignation designation
= getOrMakeTypeDesignation(key
);
404 name
.addTypeDesignation(designation
, false);
408 public List
<SpecimenTypeDesignation
> getTypeDesignations() {
409 return getOrdered(types
);
413 private SpecimenTypeDesignation
getOrMakeTypeDesignation(int key
) {
414 SpecimenTypeDesignation designation
= types
.get(key
);
415 if (designation
== null){
416 designation
= SpecimenTypeDesignation
.NewInstance();
417 types
.put(key
, designation
);
422 public void putDeterminationFamily(int key
, String family
){
423 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
424 determinationEvent
.family
= family
;
427 public void putDeterminationFullName(int key
, String fullName
){
428 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
429 determinationEvent
.fullName
= fullName
;
432 public void putDeterminationRank(int key
, String rank
){
433 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
434 determinationEvent
.rank
= rank
;
437 public void putDeterminationGenus(int key
, String genus
){
438 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
439 determinationEvent
.genus
= genus
;
442 public void putDeterminationSpeciesEpi(int key
, String speciesEpi
){
443 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
444 determinationEvent
.speciesEpi
= speciesEpi
;
447 public void putDeterminationInfraSpeciesEpi(int key
, String infraSpeciesEpi
){
448 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
449 determinationEvent
.infraSpeciesEpi
= infraSpeciesEpi
;
452 public void putDeterminationAuthor(int key
, String author
){
453 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
454 determinationEvent
.author
= author
;
457 public void putDeterminationDeterminedBy(int key
, String determinedBy
){
458 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
459 determinationEvent
.determinedBy
= determinedBy
;
462 public void putDeterminationDeterminedWhen(int key
, String determinedWhen
){
463 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
464 determinationEvent
.determinedWhen
= determinedWhen
;
467 public void putDeterminationDeterminationNotes(int key
, String notes
){
468 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
469 determinationEvent
.notes
= notes
;
472 public void putDeterminationDeterminationModifier(int key
, String modifier
){
473 DeterminationLight determinationEvent
= getOrMakeDetermination(key
);
474 determinationEvent
.modifier
= modifier
;
477 public List
<DeterminationLight
> getDetermination() {
478 return getOrdered(determinations
);
483 private DeterminationLight
getOrMakeDetermination(int key
) {
484 DeterminationLight determination
= this.determinations
.get(key
);
485 if (determination
== null){
486 determination
= new DeterminationLight();
487 this.determinations
.put(key
, determination
);
489 return determination
;
493 private<T
extends Object
> List
<T
> getOrdered(TreeMap
<?
, T
> tree
) {
494 List
<T
> result
= new ArrayList
<T
>();
495 for (T value
: tree
.values()){
501 public void setSex(String sex
) {
506 public String
getSex() {
512 * @return the referenceSystem
514 public String
getReferenceSystem() {
515 return referenceSystem
;
520 * @param referenceSystem the referenceSystem to set
522 public void setReferenceSystem(String referenceSystem
) {
523 this.referenceSystem
= referenceSystem
;
528 * @return the errorRadius
530 public String
getErrorRadius() {
536 * @param errorRadius the errorRadius to set
538 public void setErrorRadius(String errorRadius
) {
539 this.errorRadius
= errorRadius
;
543 public void setCollection(String collection
) {
544 this.collection
= collection
;
548 public String
getCollection() {
553 public void addLeveledArea(String levelPostfix
, String value
) {
554 LeveledArea area
= new LeveledArea();
555 this.levels
.add(area
);
556 // getOrMakeLeveledArea(level);
559 public List
<LeveledArea
> getLeveledAreas(){
563 // private NamedAreaLevel getOrMakeLeveledArea(String key) {
564 // NamedAreaLevel level = this.levels.get(key);
565 // if (level == null){
566 // level = new NamedAreaLevel();
567 // this.levels.put(key, level);