- if (authorAndYear.contains("?")){\r
- authorAndYear = authorAndYear.replace("H?bner", "H\u00fcbner");\r
- authorAndYear = authorAndYear.replace("Oberth?r", "Oberth\u00fcr");\r
- authorAndYear = authorAndYear.replace("M?n?tri?s","M\u00E9n\u00E9tri\u00E9s");\r
- authorAndYear = authorAndYear.replace("Schifferm?ller","Schifferm\u00fcller");\r
- \r
- //TODO remove\r
- authorAndYear = authorAndYear.replace("?", "");\r
- \r
+ }\r
+ }\r
+\r
+ /**\r
+ * @param zooName\r
+ * @param state\r
+ */\r
+ private void handleDenisSchiffermueller(ZoologicalName zooName,\r
+ GlobisImportState state) {\r
+ String teamStr = "Denis & Schifferm\u00FCller";\r
+ Team team = state.getTeam(teamStr);\r
+ if (team == null){\r
+ team = Team.NewInstance();\r
+ state.putTeam(teamStr, team);\r
+ getAgentService().save(team);\r
+ }\r
+ zooName.setCombinationAuthorship(team);\r
+ zooName.setPublicationYear(1775);\r
+ zooName.setAuthorshipCache("[Denis & Schifferm\u00FCller], 1775", true);\r
+ }\r
+\r
+\r
+ private void deduplicateAuthors(ZoologicalName zooName, GlobisImportState state) {\r
+ zooName.setCombinationAuthorship(getExistingAuthor(zooName.getCombinationAuthorship(), state));\r
+ zooName.setExCombinationAuthorship(getExistingAuthor(zooName.getExCombinationAuthorship(), state));\r
+ zooName.setBasionymAuthorship(getExistingAuthor(zooName.getBasionymAuthorship(), state));\r
+ zooName.setExBasionymAuthorship(getExistingAuthor(zooName.getExBasionymAuthorship(), state));\r
+ }\r
+\r
+ private TeamOrPersonBase<?> getExistingAuthor(INomenclaturalAuthor nomAuthor, GlobisImportState state) {\r
+ TeamOrPersonBase<?> author = (TeamOrPersonBase<?>)nomAuthor;\r
+ if (author == null){\r
+ return null;\r
+ }\r
+ if (author instanceof Person){\r
+ Person person = state.getPerson(author.getTitleCache());\r
+ return saveAndDecide(person, author, author.getTitleCache(), state);\r
+ }else if (author instanceof Team){\r
+ String key = GlobisAuthorImport.makeTeamKey((Team)author, state, getAgentService());\r
+ Team existingTeam = state.getTeam(key);\r
+ if (existingTeam == null){\r
+ Team newTeam = Team.NewInstance();\r
+ for (Person member :((Team) author).getTeamMembers()){\r
+ Person existingPerson = state.getPerson(member.getTitleCache());\r
+ if (existingPerson != null){\r
+ try {\r
+ getAgentService().update(existingPerson);\r
+ } catch (NonUniqueObjectException nuoe){\r
+ // person already exists in\r
+ existingPerson = CdmBase.deproxy(getAgentService().find(existingPerson.getUuid()), Person.class);\r
+ state.putPerson(existingPerson.getTitleCache(), existingPerson);\r
+ } catch (Exception e) {\r
+ throw new RuntimeException (e);\r
+ }\r
+ newTeam.addTeamMember(existingPerson);\r
+//\r
+// logger.warn("newTeam " + newTeam.getId());\r
+ }else{\r
+ newTeam.addTeamMember(member);\r
+ }\r
+ }\r
+ author = newTeam;\r