Project

General

Profile

Download (1.96 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
 * @author pplitzner
15
 * @since Nov 30, 2015
16
 */
17
public class DerivedUnitFormatter extends SpecimenOrObservationBaseFormatter{
18

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

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

    
52
            default:
53
                break;
54
            }
55
        }
56
    }
57
}
(1-1/5)