Project

General

Profile

Download (1.97 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2015 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
package eu.etaxonomy.cdm.format.occurrences;
10

    
11
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
12

    
13

    
14
/**
15
 * @author pplitzner
16
 \* @since Nov 30, 2015
17
 *
18
 */
19
public class DerivedUnitFormatter extends SpecimenOrObservationBaseFormatter{
20

    
21
    public DerivedUnitFormatter(Object object, FormatKey[] formatKeys) {
22
        super(object, formatKeys);
23
    }
24

    
25
    @Override
26
    protected void initFormatKeys(Object object) {
27
        super.initFormatKeys(object);
28
        DerivedUnit derivedUnit = (DerivedUnit)object;
29
        for (FormatKey formatKey : formatKeys) {
30
            switch (formatKey) {
31
            case ACCESSION_NUMBER:
32
                formatKeyMap.put(FormatKey.ACCESSION_NUMBER, derivedUnit.getAccessionNumber());
33
                break;
34
            case BARCODE:
35
                formatKeyMap.put(FormatKey.BARCODE, derivedUnit.getBarcode());
36
                break;
37
            case CATALOG_NUMBER:
38
                formatKeyMap.put(FormatKey.CATALOG_NUMBER, derivedUnit.getCatalogNumber());
39
                break;
40
            case MOST_SIGNIFICANT_IDENTIFIER:
41
                formatKeyMap.put(FormatKey.MOST_SIGNIFICANT_IDENTIFIER, derivedUnit.getMostSignificantIdentifier());
42
                break;
43
            case COLLECTION_CODE:
44
                if(derivedUnit.getCollection()!=null){
45
                    formatKeyMap.put(FormatKey.COLLECTION_CODE, derivedUnit.getCollection().getCode());
46
                }
47
                break;
48
            case COLLECTION_NAME:
49
                if(derivedUnit.getCollection()!=null){
50
                    formatKeyMap.put(FormatKey.COLLECTION_NAME, derivedUnit.getCollection().getName());
51
                }
52
                break;
53

    
54
            default:
55
                break;
56
            }
57
        }
58
    }
59

    
60
}
(3-3/9)