1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2009 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.strategy.parser;
|
11
|
|
12
|
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
|
13
|
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
|
14
|
import eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException;
|
15
|
|
16
|
/**
|
17
|
* @author a.mueller
|
18
|
* @date 25.07.2011
|
19
|
*
|
20
|
*/
|
21
|
public class SpecimenTypeParser {
|
22
|
|
23
|
|
24
|
public static class TypeInfo{
|
25
|
public SpecimenTypeDesignationStatus status;
|
26
|
public String collectionString;
|
27
|
}
|
28
|
|
29
|
/**
|
30
|
* see also CentralAfricaFernsTaxonParser#handleTypeLocationPart
|
31
|
*/
|
32
|
public static final String typeTypePattern = "(holo|lecto|iso|isolecto|syn|isosyn|neo|isoneo)\\.?";
|
33
|
public static final String collectionPattern = "^[A-Z]+(\\-[A-Z]+)?";
|
34
|
|
35
|
|
36
|
|
37
|
public static SpecimenTypeDesignationStatus makeSpecimentTypeStatus(String type) throws UnknownCdmTypeException {
|
38
|
//TODO further types
|
39
|
SpecimenTypeDesignationStatus status;
|
40
|
if (type.equalsIgnoreCase("iso")){
|
41
|
status = SpecimenTypeDesignationStatus.ISOTYPE();
|
42
|
}else if (type.equalsIgnoreCase("isolecto")){
|
43
|
status = SpecimenTypeDesignationStatus.ISOLECTOTYPE();
|
44
|
}else if (type.equalsIgnoreCase("syn")){
|
45
|
status = SpecimenTypeDesignationStatus.SYNTYPE();
|
46
|
}else if (type.equalsIgnoreCase("holo")){
|
47
|
status = SpecimenTypeDesignationStatus.HOLOTYPE();
|
48
|
}else if (type.equalsIgnoreCase("lecto")){
|
49
|
status = SpecimenTypeDesignationStatus.LECTOTYPE();
|
50
|
}else if (type.equalsIgnoreCase("isosyn")){
|
51
|
status = SpecimenTypeDesignationStatus.ISOSYNTYPE();
|
52
|
}else if (type.equalsIgnoreCase("neo")){
|
53
|
status = SpecimenTypeDesignationStatus.NEOTYPE();
|
54
|
}else if (type.equalsIgnoreCase("isoneo")){
|
55
|
status = SpecimenTypeDesignationStatus.ISONEOTYPE();
|
56
|
}else{
|
57
|
String message = "Type Status not supported: " + type;
|
58
|
throw new UnknownCdmTypeException(message);
|
59
|
}
|
60
|
return status;
|
61
|
}
|
62
|
}
|