for(NameComposite composite : nameEditor.getDirtyNames()){
logger.warn("Found " + composite + " with possible duplicates");
- NonViralName nonViralName = (NonViralName) composite.getParsedName();
-
-
- duplicateNames = findMatchingLatinNames(nonViralName);
- duplicateCombinationAuthorTeams = findMatchingAuthors((TeamOrPersonBase) nonViralName.getCombinationAuthorTeam());
- duplicateExCombinationAuthorTeams = findMatchingAuthors((TeamOrPersonBase) nonViralName.getExCombinationAuthorTeam());
- duplicateBasionymAuthorTeams = findMatchingAuthors((TeamOrPersonBase) nonViralName.getBasionymAuthorTeam());
- duplicateExBasionymAuthorTeams = findMatchingAuthors((TeamOrPersonBase) nonViralName.getExBasionymAuthorTeam());
- duplicateReferences = findMatchingNomenclaturalReference(nonViralName.getNomenclaturalReference());
-
- saveNameElements(composite);
-
- emptyDuplicateSets();
+ arbitrate(composite);
}
}
+
+ public void arbitrate(NameComposite composite){
+ NonViralName nonViralName = (NonViralName) composite.getParsedName();
+
+ duplicateNames = findMatchingLatinNames(nonViralName);
+ duplicateCombinationAuthorTeams = findMatchingAuthors((TeamOrPersonBase) nonViralName.getCombinationAuthorTeam());
+ duplicateExCombinationAuthorTeams = findMatchingAuthors((TeamOrPersonBase) nonViralName.getExCombinationAuthorTeam());
+ duplicateBasionymAuthorTeams = findMatchingAuthors((TeamOrPersonBase) nonViralName.getBasionymAuthorTeam());
+ duplicateExBasionymAuthorTeams = findMatchingAuthors((TeamOrPersonBase) nonViralName.getExBasionymAuthorTeam());
+ duplicateReferences = findMatchingNomenclaturalReference(nonViralName.getNomenclaturalReference());
+
+ saveNameElements(composite);
+
+ emptyDuplicateSets();
+ }
/**
*
}else if (duplicateNames.size() == 1){
composite.setName(duplicateNames.iterator().next());
}else{
-
- // do stuff
+ // FIXME TODO resolve multiple duplications. Use first match for a start
+ composite.setName(duplicateNames.iterator().next());
}
// debug
for(TaxonNameBase name : duplicateNames){
- logger.warn(name.getFullTitleCache());
+ logger.info(name.getFullTitleCache());
}
}
// exactly one match. We assume that the user wants this reference
composite.getName().setNomenclaturalReference(duplicateReferences.iterator().next());
}else{
- // do stuff
+ // FIXME TODO resolve multiple duplications. Use first match for a start
+ composite.getName().setNomenclaturalReference(duplicateReferences.iterator().next());
}
// debug
}else if(duplicateCombinationAuthorTeams.size() == 1){
name.setCombinationAuthorTeam(duplicateCombinationAuthorTeams.iterator().next());
}else{
- // do stuff
+ // FIXME TODO resolve multiple duplications. Use first match for a start
+ name.setCombinationAuthorTeam(duplicateCombinationAuthorTeams.iterator().next());
}
if(duplicateExCombinationAuthorTeams.size() == 0){
}else if(duplicateExCombinationAuthorTeams.size() == 1){
name.setExCombinationAuthorTeam(duplicateExCombinationAuthorTeams.iterator().next());
}else{
- // do stuff
+ // FIXME TODO resolve multiple duplications. Use first match for a start
+ name.setExCombinationAuthorTeam(duplicateExCombinationAuthorTeams.iterator().next());
}
if(duplicateBasionymAuthorTeams.size() == 0){
}else if(duplicateBasionymAuthorTeams.size() == 1){
name.setBasionymAuthorTeam(duplicateBasionymAuthorTeams.iterator().next());
}else{
- // do stuff
+ // FIXME TODO resolve multiple duplications. Use first match for a start
+ name.setBasionymAuthorTeam(duplicateBasionymAuthorTeams.iterator().next());
}
if(duplicateExBasionymAuthorTeams.size() == 0){
}else if(duplicateExBasionymAuthorTeams.size() == 1){
name.setExBasionymAuthorTeam(duplicateExBasionymAuthorTeams.iterator().next());
}else{
- // do stuff
+ // FIXME TODO resolve multiple duplications. Use first match for a start
+ name.setExBasionymAuthorTeam(duplicateExBasionymAuthorTeams.iterator().next());
}
\r
private TaxonEditorInput input;\r
\r
+ private DuplicateArbitrator duplicateArbitrator;\r
\r
public MultiPageTaxonEditor() {\r
super(); \r
conversation.bind();\r
}\r
\r
- //handle existing names and authors\r
- DuplicateArbitrator duplicateArbitrator = (DuplicateArbitrator) getAdapter(DuplicateArbitrator.class);\r
- \r
- if(duplicateArbitrator != null){\r
- // disable for now because of transaction problems.\r
- duplicateArbitrator.arbitrate();\r
- }\r
+ handleDuplicates();\r
\r
// commit the conversation and start a new transaction immediately\r
conversation.commit(true);\r
this.setDirty(false);\r
}\r
\r
+ /**\r
+ * Resolve existing names, authors and references \r
+ */\r
+ public void handleDuplicates() {\r
+ getDuplicateArbitrator().arbitrate();\r
+ }\r
+\r
+\r
+\r
private void setDirty(boolean dirty) {\r
this.dirty = dirty;\r
firePropertyChange(PROP_DIRTY);\r
return editors;\r
}\r
\r
+\r
+\r
+ /**\r
+ * @return the duplicateArbitrator\r
+ */\r
+ public DuplicateArbitrator getDuplicateArbitrator() {\r
+ if(duplicateArbitrator == null){\r
+ duplicateArbitrator = (DuplicateArbitrator) getAdapter(DuplicateArbitrator.class);\r
+ }\r
+ return duplicateArbitrator;\r
+ }\r
}
\ No newline at end of file