3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.taxeditor
.parser
;
13 import eu
.etaxonomy
.cdm
.model
.agent
.TeamOrPersonBase
;
14 import eu
.etaxonomy
.cdm
.model
.name
.NonViralName
;
15 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
16 import eu
.etaxonomy
.cdm
.strategy
.match
.IMatchStrategy
;
17 import eu
.etaxonomy
.cdm
.strategy
.match
.MatchException
;
18 import eu
.etaxonomy
.cdm
.strategy
.match
.MatchMode
;
19 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
22 * This class defines the MatchStrategies that will be used by the ParseHandler.
25 * @created Jan 22, 2010
28 public class MatchStrategyConfigurator
{
31 * <p>NonViralNameMatchStrategy</p>
33 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
34 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
36 public static IMatchStrategy
NonViralNameMatchStrategy() throws MatchException
{
37 return getDefaultNonViralNameMatchStrategy();// PreferencesUtil.getMatchStrategy(NonViralName.class);
41 * <p>TeamOrPersonMatchStrategy</p>
43 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
44 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
46 public static IMatchStrategy
TeamOrPersonMatchStrategy() throws MatchException
{
47 return null;// PreferencesUtil.getMatchStrategy(TeamOrPersonBase.class);
51 * <p>ReferenceMatchStrategy</p>
53 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
54 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
56 public static IMatchStrategy
ReferenceMatchStrategy() throws MatchException
{
57 return getDefaultReferenceMatchStrategy();// PreferencesUtil.getMatchStrategy(ReferenceBase.class);
61 * <p>getDefaultNonViralNameMatchStrategy</p>
63 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
64 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
66 public static IMatchStrategy
getDefaultNonViralNameMatchStrategy() throws MatchException
{
67 IMatchStrategy strategy
= PreferencesUtil
.getDefaultMatchStrategy(NonViralName
.class);
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
);
79 * <p>getDefaultTeamOrPersonMatchStrategy</p>
81 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
82 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
84 public static IMatchStrategy
getDefaultTeamOrPersonMatchStrategy() throws MatchException
{
85 IMatchStrategy strategy
= PreferencesUtil
.getDefaultMatchStrategy(TeamOrPersonBase
.class);
92 * <p>getDefaultReferenceMatchStrategy</p>
94 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
95 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
97 public static IMatchStrategy
getDefaultReferenceMatchStrategy() throws MatchException
{
98 IMatchStrategy strategy
= PreferencesUtil
.getDefaultMatchStrategy(Reference
.class);
100 strategy
.setMatchMode("title", MatchMode
.EQUAL
);
101 strategy
.setMatchMode("inReference", MatchMode
.IGNORE
);
107 * <p>setMatchStrategy</p>
109 * @param matchStrategy a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
111 public static void setMatchStrategy(IMatchStrategy matchStrategy
) {
112 PreferencesUtil
.setMatchStrategy(matchStrategy
);