1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2015 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.cdm.format.occurrences;
|
11
|
|
12
|
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
|
13
|
|
14
|
|
15
|
/**
|
16
|
* @author pplitzner
|
17
|
* @date Nov 30, 2015
|
18
|
*
|
19
|
*/
|
20
|
public class DerivedUnitFormatter extends SpecimenOrObservationBaseFormatter{
|
21
|
|
22
|
public DerivedUnitFormatter(Object object, FormatKey[] formatKeys) {
|
23
|
super(object, formatKeys);
|
24
|
}
|
25
|
|
26
|
@Override
|
27
|
protected void initFormatKeys(Object object) {
|
28
|
super.initFormatKeys(object);
|
29
|
DerivedUnit derivedUnit = (DerivedUnit)object;
|
30
|
for (FormatKey formatKey : formatKeys) {
|
31
|
switch (formatKey) {
|
32
|
case ACCESSION_NUMBER:
|
33
|
formatKeyMap.put(FormatKey.ACCESSION_NUMBER, derivedUnit.getAccessionNumber());
|
34
|
break;
|
35
|
case BARCODE:
|
36
|
formatKeyMap.put(FormatKey.BARCODE, derivedUnit.getBarcode());
|
37
|
break;
|
38
|
case CATALOG_NUMBER:
|
39
|
formatKeyMap.put(FormatKey.CATALOG_NUMBER, derivedUnit.getCatalogNumber());
|
40
|
break;
|
41
|
case MOST_SIGNIFICANT_IDENTIFIER:
|
42
|
formatKeyMap.put(FormatKey.MOST_SIGNIFICANT_IDENTIFIER, derivedUnit.getMostSignificantIdentifier());
|
43
|
break;
|
44
|
case COLLECTION_CODE:
|
45
|
if(derivedUnit.getCollection()!=null){
|
46
|
formatKeyMap.put(FormatKey.COLLECTION_CODE, derivedUnit.getCollection().getCode());
|
47
|
}
|
48
|
break;
|
49
|
case COLLECTION_NAME:
|
50
|
if(derivedUnit.getCollection()!=null){
|
51
|
formatKeyMap.put(FormatKey.COLLECTION_NAME, derivedUnit.getCollection().getName());
|
52
|
}
|
53
|
break;
|
54
|
|
55
|
default:
|
56
|
break;
|
57
|
}
|
58
|
}
|
59
|
}
|
60
|
|
61
|
}
|