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.io.specimen.SpecimenImportConfiguratorBase;
|
12
|
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
|
13
|
|
14
|
/**
|
15
|
* @author pplitzner
|
16
|
* @date 16.06.2015
|
17
|
*
|
18
|
*/
|
19
|
public class SpecimenImportUtility {
|
20
|
|
21
|
public static String getUnitID(DerivedUnit derivedUnit, SpecimenImportConfiguratorBase config){
|
22
|
if (config instanceof Abcd206ImportConfigurator){
|
23
|
if(((Abcd206ImportConfigurator)config).isMapUnitIdToAccessionNumber()){
|
24
|
return derivedUnit.getAccessionNumber();
|
25
|
}
|
26
|
if(((Abcd206ImportConfigurator)config).isMapUnitIdToBarcode()){
|
27
|
return derivedUnit.getBarcode();
|
28
|
}
|
29
|
}
|
30
|
return derivedUnit.getCatalogNumber();
|
31
|
}
|
32
|
|
33
|
public static void setUnitID(DerivedUnit derivedUnit, String unitId, Abcd206ImportConfigurator config){
|
34
|
if(config.isMapUnitIdToCatalogNumber()
|
35
|
|| !(config.isMapUnitIdToAccessionNumber() || config.isMapUnitIdToBarcode() || config.isMapUnitIdToCatalogNumber())){
|
36
|
// set catalog number (default if nothing is set)
|
37
|
derivedUnit.setCatalogNumber(unitId);
|
38
|
}
|
39
|
if(config.isMapUnitIdToAccessionNumber()){
|
40
|
derivedUnit.setAccessionNumber(unitId);
|
41
|
}
|
42
|
if(config.isMapUnitIdToBarcode()){
|
43
|
derivedUnit.setBarcode(unitId);
|
44
|
}
|
45
|
}
|
46
|
|
47
|
}
|