2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.parser
;
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
;
21 * This class defines the MatchStrategies that will be used by the ParseHandler.
24 * @created Jan 22, 2010
27 public class MatchStrategyConfigurator
{
30 * <p>NonViralNameMatchStrategy</p>
32 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
33 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
35 public static IMatchStrategy
NonViralNameMatchStrategy() throws MatchException
{
36 return getDefaultNonViralNameMatchStrategy();// PreferencesUtil.getMatchStrategy(NonViralName.class);
40 * <p>TeamOrPersonMatchStrategy</p>
42 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
43 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
45 public static IMatchStrategy
TeamOrPersonMatchStrategy() throws MatchException
{
46 return PreferencesUtil
.getMatchStrategy(TeamOrPersonBase
.class);
50 * <p>ReferenceMatchStrategy</p>
52 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
53 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
55 public static IMatchStrategy
ReferenceMatchStrategy() throws MatchException
{
56 return getDefaultReferenceMatchStrategy();// PreferencesUtil.getMatchStrategy(ReferenceBase.class);
60 * <p>getDefaultNonViralNameMatchStrategy</p>
62 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
63 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
65 public static IMatchStrategy
getDefaultNonViralNameMatchStrategy() throws MatchException
{
66 IMatchStrategy strategy
= PreferencesUtil
.getDefaultMatchStrategy(TaxonName
.class);
68 strategy
.setMatchMode("nomenclaturalReference", MatchMode
.IGNORE
);
69 strategy
.setMatchMode("combinationAuthorship", MatchMode
.IGNORE
);
70 strategy
.setMatchMode("exCombinationAuthorship", MatchMode
.IGNORE
);
71 strategy
.setMatchMode("basionymAuthorship", MatchMode
.IGNORE
);
72 strategy
.setMatchMode("exBasionymAuthorship", MatchMode
.IGNORE
);
78 * <p>getDefaultTeamOrPersonMatchStrategy</p>
80 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
81 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
83 public static IMatchStrategy
getDefaultTeamOrPersonMatchStrategy() throws MatchException
{
84 IMatchStrategy strategy
= PreferencesUtil
.getDefaultMatchStrategy(TeamOrPersonBase
.class);
91 * <p>getDefaultReferenceMatchStrategy</p>
93 * @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
94 * @throws eu.etaxonomy.cdm.strategy.match.MatchException if any.
96 public static IMatchStrategy
getDefaultReferenceMatchStrategy() throws MatchException
{
97 IMatchStrategy strategy
= PreferencesUtil
.getDefaultMatchStrategy(Reference
.class);
99 strategy
.setMatchMode("title", MatchMode
.EQUAL
);
100 strategy
.setMatchMode("inReference", MatchMode
.IGNORE
);
106 * <p>setMatchStrategy</p>
108 * @param matchStrategy a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object.
110 public static void setMatchStrategy(IMatchStrategy matchStrategy
) {
111 PreferencesUtil
.setMatchStrategy(matchStrategy
);