* @throws MatchException
*/
public static IMatchStrategy NonViralNameMatchStrategy() throws MatchException{
- return PreferencesUtil.getMatchStrategy(NonViralName.class);
+ return getDefaultNonViralNameMatchStrategy();// PreferencesUtil.getMatchStrategy(NonViralName.class);
}
/**
* @throws MatchException
*/
public static IMatchStrategy TeamOrPersonMatchStrategy() throws MatchException{
- return PreferencesUtil.getMatchStrategy(TeamOrPersonBase.class);
- }
+ return null;// PreferencesUtil.getMatchStrategy(TeamOrPersonBase.class);
+ }
/**
*
* @throws MatchException
*/
public static IMatchStrategy ReferenceMatchStrategy() throws MatchException{
- return PreferencesUtil.getMatchStrategy(ReferenceBase.class);
+ return getDefaultReferenceMatchStrategy();// PreferencesUtil.getMatchStrategy(ReferenceBase.class);
}
/**
public static IMatchStrategy getDefaultReferenceMatchStrategy() throws MatchException{
IMatchStrategy strategy = PreferencesUtil.getDefaultMatchStrategy(ReferenceBase.class);
+ strategy.setMatchMode("title", MatchMode.EQUAL);
+ strategy.setMatchMode("inReference", MatchMode.IGNORE);
+
return strategy;
}
resolveDuplicateNames(name);
resolveAllDuplicateAuthors(name);
-
+
resolveDuplicateReferences(name);
if(duplicateInReferences != null)
* @param name The name to resolve duplicates for.
*/
private void resolveDuplicateInReferences(NonViralName name) {
- ReferenceBase reference = (ReferenceBase) name.getNomenclaturalReference();
- if(duplicateInReferences.size() == 1){
- // exactly one match. We assume that the user wants this reference
- reference.setInReference((ReferenceBase) duplicateInReferences.iterator().next());
- }else if(duplicateInReferences.size() > 1){
- // FIXME TODO resolve multiple duplications. Use first match for a start
- reference.setInReference((ReferenceBase) duplicateInReferences.iterator().next());
+ ReferenceBase reference = (ReferenceBase) HibernateProxyHelper.deproxy(name.getNomenclaturalReference());
+
+ if(duplicateInReferences.size() > 0){
+ ReferenceBase inReference = (ReferenceBase) duplicateInReferences.iterator().next();
+ reference.setInReference(inReference);
+ logger.warn(reference.generateTitle());
+ // FIXME TODO resolve multiple duplications. We use first match for a start
+ logger.warn(reference.getTitleCache());
}
}
*/
private void resolveAllDuplicateAuthors(NonViralName name) {
- if(duplicateCombinationAuthorTeams.size() == 1){
- name.setCombinationAuthorTeam(duplicateCombinationAuthorTeams.iterator().next());
- }else if(duplicateCombinationAuthorTeams.size() > 1){
- // FIXME TODO resolve multiple duplications. Use first match for a start
+ if(duplicateCombinationAuthorTeams.size() > 0){
name.setCombinationAuthorTeam(duplicateCombinationAuthorTeams.iterator().next());
+ ReferenceBase reference = (ReferenceBase) name.getNomenclaturalReference();
+ reference.setAuthorTeam(duplicateCombinationAuthorTeams.iterator().next());
+ // FIXME TODO resolve multiple duplications. We use first match for a start.
}
- if(duplicateExCombinationAuthorTeams.size() == 1){
- name.setExCombinationAuthorTeam(duplicateExCombinationAuthorTeams.iterator().next());
- }else if(duplicateExCombinationAuthorTeams.size() > 1){
- // FIXME TODO resolve multiple duplications. Use first match for a start
+ if(duplicateExCombinationAuthorTeams.size() > 0){
name.setExCombinationAuthorTeam(duplicateExCombinationAuthorTeams.iterator().next());
+ // FIXME TODO resolve multiple duplications. We use first match for a start.
}
- if(duplicateBasionymAuthorTeams.size() == 1){
- name.setBasionymAuthorTeam(duplicateBasionymAuthorTeams.iterator().next());
- }else if(duplicateBasionymAuthorTeams.size() > 1){
- // FIXME TODO resolve multiple duplications. Use first match for a start
+ if(duplicateBasionymAuthorTeams.size() > 0){
name.setBasionymAuthorTeam(duplicateBasionymAuthorTeams.iterator().next());
+ // FIXME TODO resolve multiple duplications. We use first match for a start.
}
- if(duplicateExBasionymAuthorTeams.size() == 1){
- name.setExBasionymAuthorTeam(duplicateExBasionymAuthorTeams.iterator().next());
- }else if(duplicateExBasionymAuthorTeams.size() > 1){
- // FIXME TODO resolve multiple duplications. Use first match for a start
+ if(duplicateExBasionymAuthorTeams.size() > 0){
name.setExBasionymAuthorTeam(duplicateExBasionymAuthorTeams.iterator().next());
+ // FIXME TODO resolve multiple duplications. We use first match for a start.
}
}
duplicateExBasionymAuthorTeams = findMatchingAuthors((TeamOrPersonBase) name.getExBasionymAuthorTeam());
INomenclaturalReference nomenclaturalReference = name.getNomenclaturalReference();
- duplicateReferences = findMatchingNomenclaturalReference(nomenclaturalReference);
- // check if the reference has an inreference and also check if the inReference already exists
- // FIXME implement this once the transition to new reference model is complete (cdmlib 3.2)
+ // check if the reference has an inreference and also check if the inReference already exists
if(nomenclaturalReference != null){
ReferenceBase inReference = ((ReferenceBase)nomenclaturalReference).getInReference();
if(inReference != null){
duplicateInReferences = findMatchingNomenclaturalReference(inReference);
}
}
+
+ duplicateReferences = findMatchingNomenclaturalReference(nomenclaturalReference);
}
/**