Project

General

Profile

Download (3.82 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 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

    
10
package eu.etaxonomy.taxeditor.parser;
11

    
12
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
13
import eu.etaxonomy.cdm.model.name.TaxonName;
14
import eu.etaxonomy.cdm.model.reference.Reference;
15
import eu.etaxonomy.cdm.strategy.match.IMatchStrategy;
16
import eu.etaxonomy.cdm.strategy.match.MatchException;
17
import eu.etaxonomy.cdm.strategy.match.MatchMode;
18
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
19

    
20
/**
21
 * This class defines the MatchStrategies that will be used by the ParseHandler.
22
 *
23
 * @author n.hoffmann
24
 * @created Jan 22, 2010
25
 */
26
public class MatchStrategyConfigurator {
27
	
28
	/**
29
	 * <p>NonViralNameMatchStrategy</p>
30
	 *
31
	 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
32
	 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
33
	 */
34
	public static IMatchStrategy NonViralNameMatchStrategy() throws MatchException{
35
		return getDefaultNonViralNameMatchStrategy();// PreferencesUtil.getMatchStrategy(NonViralName.class);
36
	}
37
	
38
	/**
39
	 * <p>TeamOrPersonMatchStrategy</p>
40
	 *
41
	 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
42
	 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
43
	 */
44
	public static IMatchStrategy TeamOrPersonMatchStrategy() throws MatchException{
45
		return PreferencesUtil.getMatchStrategy(TeamOrPersonBase.class);
46
	} 
47
	
48
	/**
49
	 * <p>ReferenceMatchStrategy</p>
50
	 *
51
	 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
52
	 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
53
	 */
54
	public static IMatchStrategy ReferenceMatchStrategy() throws MatchException{
55
		return getDefaultReferenceMatchStrategy();// PreferencesUtil.getMatchStrategy(ReferenceBase.class);
56
	}
57

    
58
	/**
59
	 * <p>getDefaultNonViralNameMatchStrategy</p>
60
	 *
61
	 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
62
	 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
63
	 */
64
	public static IMatchStrategy getDefaultNonViralNameMatchStrategy() throws MatchException{
65
		IMatchStrategy strategy = PreferencesUtil.getDefaultMatchStrategy(TaxonName.class);
66
		
67
		strategy.setMatchMode("nomenclaturalReference", MatchMode.IGNORE);
68
		strategy.setMatchMode("combinationAuthorship", MatchMode.IGNORE);
69
		strategy.setMatchMode("exCombinationAuthorship", MatchMode.IGNORE);
70
		strategy.setMatchMode("basionymAuthorship", MatchMode.IGNORE);
71
		strategy.setMatchMode("exBasionymAuthorship", MatchMode.IGNORE);
72
		
73
		return strategy;
74
	}
75

    
76
	/**
77
	 * <p>getDefaultTeamOrPersonMatchStrategy</p>
78
	 *
79
	 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
80
	 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
81
	 */
82
	public static IMatchStrategy getDefaultTeamOrPersonMatchStrategy() throws MatchException{
83
		IMatchStrategy strategy = PreferencesUtil.getDefaultMatchStrategy(TeamOrPersonBase.class);
84
		
85
		return strategy;
86
	}
87
	
88

    
89
	/**
90
	 * <p>getDefaultReferenceMatchStrategy</p>
91
	 *
92
	 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
93
	 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
94
	 */
95
	public static IMatchStrategy getDefaultReferenceMatchStrategy() throws MatchException{
96
		IMatchStrategy strategy = PreferencesUtil.getDefaultMatchStrategy(Reference.class);
97
		
98
		strategy.setMatchMode("title", MatchMode.EQUAL);
99
		strategy.setMatchMode("inReference", MatchMode.IGNORE);
100
		
101
		return strategy;
102
	}
103

    
104
	/**
105
	 * <p>setMatchStrategy</p>
106
	 *
107
	 * @param matchStrategy a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
108
	 */
109
	public static void setMatchStrategy(IMatchStrategy matchStrategy) {
110
		PreferencesUtil.setMatchStrategy(matchStrategy);
111
	}
112
	
113
}
(1-1/2)