Project

General

Profile

Download (3.85 KB) Statistics
| Branch: | Tag: | Revision:
1 a345da86 n.hoffmann
// $Id$
2
/**
3
* Copyright (C) 2007 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
11
package eu.etaxonomy.taxeditor.parser;
12
13
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
14
import eu.etaxonomy.cdm.model.name.NonViralName;
15 d31115e0 n.hoffmann
import eu.etaxonomy.cdm.model.reference.Reference;
16 a345da86 n.hoffmann
import eu.etaxonomy.cdm.strategy.match.IMatchStrategy;
17
import eu.etaxonomy.cdm.strategy.match.MatchException;
18
import eu.etaxonomy.cdm.strategy.match.MatchMode;
19 3bab40a1 n.hoffmann
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
20 a345da86 n.hoffmann
21
/**
22
 * This class defines the MatchStrategies that will be used by the ParseHandler.
23 3be6ef3e n.hoffmann
 *
24 a345da86 n.hoffmann
 * @author n.hoffmann
25
 * @created Jan 22, 2010
26
 * @version 1.0
27
 */
28
public class MatchStrategyConfigurator {
29
	
30
	/**
31 3be6ef3e n.hoffmann
	 * <p>NonViralNameMatchStrategy</p>
32
	 *
33
	 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
34
	 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
35 a345da86 n.hoffmann
	 */
36
	public static IMatchStrategy NonViralNameMatchStrategy() throws MatchException{
37 85ec5ed4 n.hoffmann
		return getDefaultNonViralNameMatchStrategy();// PreferencesUtil.getMatchStrategy(NonViralName.class);
38 a345da86 n.hoffmann
	}
39
	
40
	/**
41 3be6ef3e n.hoffmann
	 * <p>TeamOrPersonMatchStrategy</p>
42
	 *
43
	 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
44
	 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
45 a345da86 n.hoffmann
	 */
46
	public static IMatchStrategy TeamOrPersonMatchStrategy() throws MatchException{
47 85ec5ed4 n.hoffmann
		return null;// PreferencesUtil.getMatchStrategy(TeamOrPersonBase.class);
48
	} 
49 a345da86 n.hoffmann
	
50
	/**
51 3be6ef3e n.hoffmann
	 * <p>ReferenceMatchStrategy</p>
52
	 *
53
	 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
54
	 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
55 a345da86 n.hoffmann
	 */
56
	public static IMatchStrategy ReferenceMatchStrategy() throws MatchException{
57 85ec5ed4 n.hoffmann
		return getDefaultReferenceMatchStrategy();// PreferencesUtil.getMatchStrategy(ReferenceBase.class);
58 a345da86 n.hoffmann
	}
59
60
	/**
61 3be6ef3e n.hoffmann
	 * <p>getDefaultNonViralNameMatchStrategy</p>
62
	 *
63
	 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
64
	 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
65 a345da86 n.hoffmann
	 */
66
	public static IMatchStrategy getDefaultNonViralNameMatchStrategy() throws MatchException{
67 3bab40a1 n.hoffmann
		IMatchStrategy strategy = PreferencesUtil.getDefaultMatchStrategy(NonViralName.class);
68 a345da86 n.hoffmann
		
69
		strategy.setMatchMode("nomenclaturalReference", MatchMode.IGNORE);
70
		strategy.setMatchMode("combinationAuthorTeam", MatchMode.IGNORE);
71
		strategy.setMatchMode("exCombinationAuthorTeam", MatchMode.IGNORE);
72
		strategy.setMatchMode("basionymAuthorTeam", MatchMode.IGNORE);
73
		strategy.setMatchMode("exBasionymAuthorTeam", MatchMode.IGNORE);
74
		
75
		return strategy;
76
	}
77
78
	/**
79 3be6ef3e n.hoffmann
	 * <p>getDefaultTeamOrPersonMatchStrategy</p>
80
	 *
81
	 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
82
	 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
83 a345da86 n.hoffmann
	 */
84
	public static IMatchStrategy getDefaultTeamOrPersonMatchStrategy() throws MatchException{
85 3bab40a1 n.hoffmann
		IMatchStrategy strategy = PreferencesUtil.getDefaultMatchStrategy(TeamOrPersonBase.class);
86 a345da86 n.hoffmann
		
87
		return strategy;
88
	}
89
	
90
91 3be6ef3e n.hoffmann
	/**
92
	 * <p>getDefaultReferenceMatchStrategy</p>
93
	 *
94
	 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
95
	 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
96
	 */
97 a345da86 n.hoffmann
	public static IMatchStrategy getDefaultReferenceMatchStrategy() throws MatchException{
98 d31115e0 n.hoffmann
		IMatchStrategy strategy = PreferencesUtil.getDefaultMatchStrategy(Reference.class);
99 a345da86 n.hoffmann
		
100 85ec5ed4 n.hoffmann
		strategy.setMatchMode("title", MatchMode.EQUAL);
101
		strategy.setMatchMode("inReference", MatchMode.IGNORE);
102
		
103 a345da86 n.hoffmann
		return strategy;
104
	}
105 3bab40a1 n.hoffmann
106
	/**
107 3be6ef3e n.hoffmann
	 * <p>setMatchStrategy</p>
108
	 *
109
	 * @param matchStrategy a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
110 3bab40a1 n.hoffmann
	 */
111
	public static void setMatchStrategy(IMatchStrategy matchStrategy) {
112
		PreferencesUtil.setMatchStrategy(matchStrategy);
113
	}
114 a345da86 n.hoffmann
	
115
}