Project

General

Profile

Download (1.17 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2009 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.strategy.parser;
10

    
11
import org.apache.commons.lang.StringUtils;
12

    
13
import eu.etaxonomy.cdm.model.common.DefinedTerm;
14
import eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException;
15

    
16
/**
17
 * @author a.mueller
18
 \* @since 28.10.2017
19
 */
20
public class DeterminationModifierParser {
21

    
22

    
23
//	public static final String qualifierPattern = "(?i)(aff|cf|vel. aff)\\.?";
24

    
25

    
26

    
27
	public static DefinedTerm parseDeterminationQualifier(String qualifier) throws UnknownCdmTypeException {
28

    
29
		if (StringUtils.isBlank(qualifier)){
30
			return null;
31
		}
32
		DefinedTerm term;
33
		if (qualifier.matches("aff(.?|inis)")){
34
			term = DefinedTerm.DETERMINATION_MODIFIER_AFFINIS();
35
		}else if (qualifier.matches("(cf.?|confer)")){
36
		    term = DefinedTerm.DETERMINATION_MODIFIER_CONFER();
37
		}else{
38
			String message = "Determination qualifier not supported: " + qualifier;
39
			throw new UnknownCdmTypeException(message);
40
		}
41
		return term;
42
	}
43
}
(1-1/8)