Project

General

Profile

Download (1.41 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.io.specimen.abcd206.in;
10

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

    
13
/**
14
 * @author pplitzner
15
 \* @since 16.06.2015
16
 *
17
 */
18
public class AbcdImportUtility {
19

    
20
    public static String getUnitID(DerivedUnit derivedUnit, Abcd206ImportConfigurator config){
21
        if(config.isMapUnitIdToAccessionNumber()){
22
            return derivedUnit.getAccessionNumber();
23
        }
24
        if(config.isMapUnitIdToBarcode()){
25
            return derivedUnit.getBarcode();
26
        }
27
        return derivedUnit.getCatalogNumber();
28
    }
29

    
30
    public static void setUnitID(DerivedUnit derivedUnit, String unitId, Abcd206ImportConfigurator config){
31
        if(config.isMapUnitIdToCatalogNumber()
32
                || !(config.isMapUnitIdToAccessionNumber() || config.isMapUnitIdToBarcode() || config.isMapUnitIdToCatalogNumber())){
33
            // set catalog number (default if nothing is set)
34
            derivedUnit.setCatalogNumber(unitId);
35
        }
36
        if(config.isMapUnitIdToAccessionNumber()){
37
            derivedUnit.setAccessionNumber(unitId);
38
        }
39
        if(config.isMapUnitIdToBarcode()){
40
            derivedUnit.setBarcode(unitId);
41
        }
42
    }
43

    
44
}
(7-7/15)