Project

General

Profile

Download (2.13 KB) Statistics
| Branch: | Tag: | Revision:
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 parseSpecimenTypeStatus(String type) throws UnknownCdmTypeException {
38
		//TODO also compare with NameTypeParser
39
		//TODO further types
40
		SpecimenTypeDesignationStatus status; 
41
		if (type.equalsIgnoreCase("iso")){
42
			status = SpecimenTypeDesignationStatus.ISOTYPE();
43
		}else if (type.equalsIgnoreCase("isolecto")){
44
			status = SpecimenTypeDesignationStatus.ISOLECTOTYPE();
45
		}else if (type.equalsIgnoreCase("syn")){
46
			status = SpecimenTypeDesignationStatus.SYNTYPE();
47
		}else if (type.equalsIgnoreCase("holo")){
48
			status = SpecimenTypeDesignationStatus.HOLOTYPE();
49
		}else if (type.equalsIgnoreCase("lecto")){
50
			status = SpecimenTypeDesignationStatus.LECTOTYPE();
51
		}else if (type.equalsIgnoreCase("isosyn")){
52
			status = SpecimenTypeDesignationStatus.ISOSYNTYPE();
53
		}else if (type.equalsIgnoreCase("neo")){
54
			status = SpecimenTypeDesignationStatus.NEOTYPE();
55
		}else if (type.equalsIgnoreCase("isoneo")){
56
			status = SpecimenTypeDesignationStatus.ISONEOTYPE();
57
		}else{
58
			String message = "Type Status not supported: " + type;
59
			throw new UnknownCdmTypeException(message);
60
		}
61
		return status;
62
	}
63
}
(6-6/7)