Project

General

Profile

Revision f9288024

IDf9288024d35effc40f8273883f6050c4990b9487
Parent df0829ae
Child e17b1d77

Added by Katja Luther about 3 years ago

merge conflict

View differences:

cdm-pesi/src/main/java/eu/etaxonomy/cdm/app/common/CdmDestinations.java
34 34
	public static ICdmDataSource cdm_test_local_faunaEu_mysql(){
35 35
		DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
36 36
		String cdmServer = "127.0.0.1";
37
		String cdmDB = "cdm_faunaeu_2015_09";
37
		String cdmDB = "cdm_faunaeu_2017_03";
38 38
		String cdmUserName = "root";
39 39
		return makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
40 40
	}
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/faunaEuropaea/FaunaEuropaeaAuthorImport.java
47 47
	private static int modCount = 1000;
48 48
	private final static String authorSeparator = ", ";
49 49
	private final static String lastAuthorSeparator = " & ";
50
	private static String capitalWord = "\\p{javaUpperCase}\\p{javaLowerCase}*";
50 51
	 protected static String fWs = "\\s*";
51 52
	 protected static String oWs = "\\s+";
52 53
	 protected static String finalTeamSplitter = "(" + fWs + "(&)" + fWs + "|" + oWs + "et" + oWs + ")";
53 54
	protected static String notFinalTeamSplitter = "((?:" + fWs + "," + fWs + ")(?!([A-Z][\\.]))"+"|" + finalTeamSplitter + ")";
54
	protected static String test = "(,\\s(?![A-Z][.|\\s|$]))|" + finalTeamSplitter ;
55
	protected static String test = "(, \\s(?!([A-Z].|\\s|$))|,$)" ;
56
	//protected static String test = "((,\\s("+capitalWord+")+)|(,($|,?!(\\s))))";
55 57

  
56 58

  
57 59
	/* (non-Javadoc)
......
227 229
        //Lastname A, Lastname B & Lastname
228 230
        //Lastname A Lastname B & Lastname C
229 231
        //Lastname, J & Lastname, L
230
        String[] teamMembers = refAuthor.split(test);
231

  
232
        String lastMember;
232
        String[] firstTeamMembers = refAuthor.split(finalTeamSplitter);
233
        String[] teamMembers = null;
234
        String lastMember = null;
235
        lastMember = firstTeamMembers[firstTeamMembers.length-1];
233 236

  
237
        if (firstTeamMembers.length == 2){
238
            teamMembers = firstTeamMembers[0].split(test);
239
        }
234 240
        Person teamMember;
235 241
        author = Team.NewInstance();
236
        if (teamMembers.length>1){
242
        if (teamMembers != null){
237 243
            for(String member:teamMembers){
238 244
                if (!member.trim().equals("")){
239 245
                    teamMember = Person.NewInstance();
......
241 247
                   ((Team)author).addTeamMember(teamMember);
242 248
                }
243 249
            }
250
            teamMember = Person.NewInstance();
251
            teamMember.setTitleCache(lastMember, true);
252
            ((Team)author).addTeamMember(teamMember);
253

  
244 254
        }else{
245
            author = Person.NewInstance();
246
            author.setTitleCache(refAuthor, true);
255
            teamMembers = lastMember.split(test);
256
            if (teamMembers.length >1){
257
                for(String member:teamMembers){
258
                    if (!member.trim().equals("")){
259
                        teamMember = Person.NewInstance();
260
                        teamMember.setTitleCache(member, true);
261
                       ((Team)author).addTeamMember(teamMember);
262
                    }
263
                }
264
            }else{
265
                author = Person.NewInstance();
266
                author.setTitleCache(lastMember, true);
267
            }
268

  
247 269

  
248 270
        }
249 271
        author.getTitleCache();
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/faunaEuropaea/FaunaEuropaeaDistributionImport.java
678 678
				} else {
679 679
					taxonDescription = TaxonDescription.NewInstance();
680 680
					taxon.addDescription(taxonDescription);
681
					taxonDescription.setDefault(true);
682
					//addOriginalSource(taxonDescription, null, "Default Import", state.getConfig().getSourceReference());
681 683
				}
682 684

  
683 685
				taxonUuid = taxonBase.getUuid();
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/faunaEuropaea/FaunaEuropaeaVernacularNamesImport.java
35 35
	private static final Logger logger = Logger.getLogger(FaunaEuropaeaVernacularNamesImport.class);
36 36

  
37 37
	private HashMap<String, Reference> sourceMap = new HashMap<String, Reference>();
38
	private Reference pesiProject = ReferenceFactory.newDatabase();
38 39

  
39 40
	@Override
40 41
	protected void doInvoke(FaunaEuropaeaImportState state) {
41 42
		int limit = state.getConfig().getLimitSave();
43
		pesiProject.setTitle("PESI");
42 44

  
43 45
		if (state.getConfig().isDoVernacularNames()){
44 46
			/* Taxon store for retrieving taxa from and saving taxa to CDM */
......
231 233
							+ taxonBase.getClass().getSimpleName() + " using accepted Taxon for vernacular name");
232 234
					continue;
233 235
				}
234

  
235 236
				taxonDescription = TaxonDescription.NewInstance();
237
				addOriginalSource(taxonDescription, null, "CommonNameDefaultImport", pesiProject);
238

  
236 239
				taxon.addDescription(taxonDescription);
237 240

  
238 241
				taxonUuid = taxonBase.getUuid();
......
297 300
						verName.setArea(NamedArea.NORTH_AMERICA());
298 301
					}
299 302
					verName.setCreated(null);
300
					addOriginalSource(verName, null, null, sourceMap.get(fauEuHelperVernacularName.getSource()));
303
					if (fauEuHelperVernacularName.getSource() != null){
304
					    addOriginalSource(verName, null, null, sourceMap.get(fauEuHelperVernacularName.getSource()));
305
					}
301 306
					taxonDescription.addElement(verName);
302 307

  
303 308
				}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)