Project

General

Profile

« Previous | Next » 

Revision 73f2833f

Added by Andreas Müller over 4 years ago

cleanup

View differences:

cdm-pesi/src/main/java/eu/etaxonomy/cdm/app/pesi/merging/FaunaEuErmsMergeActivator.java
2 2

  
3 3
import java.io.BufferedReader;
4 4
import java.io.File;
5
import java.io.FileNotFoundException;
6 5
import java.io.FileReader;
7 6
import java.io.IOException;
8 7
import java.util.ArrayList;
......
58 57
	static String sFileName = "c:\\test";
59 58

  
60 59
	private void initDb(ICdmDataSource db) {
61

  
62 60
		// Init source DB
63 61
		appCtrInit = CdmIoApplicationController.NewInstance(db, DbSchemaValidation.VALIDATE, false);
64

  
65

  
66 62
	}
67 63

  
68 64
	public static void main(String[] args) {
......
115 111
			}
116 112
			//close the file
117 113
			bufRdr.close();
118
		} catch (FileNotFoundException e) {
119
			// TODO Auto-generated catch block
120
			e.printStackTrace();
121 114
		} catch (IOException e) {
122
			// TODO Auto-generated catch block
123 115
			e.printStackTrace();
124 116
		}
125 117
		return result;
......
261 253
				}
262 254
			}
263 255

  
264

  
265 256
			//Child-Parent Relationship aktualisieren -> dem Child des Fauna Europaea Taxons als parent das akzeptierte Taxon von synErms
266 257
			Set<TaxonNode> nodesErms = taxonErms.getTaxonNodes();
267 258
			Set<TaxonNode> nodesFaunaEu =taxonFaunaEu.getTaxonNodes();
......
311 302
			List<NameRelationship> relSynFaunaEu = appCtrInit.getNameService().listToNameRelationships(synFaunaEu.getName(), null, 100, 0, null, null);
312 303
			List<NameRelationship> relTaxonErms = appCtrInit.getNameService().listToNameRelationships(taxonErms.getName(), null, 100, 0, null, null);
313 304

  
314
			List<NameRelationship> deleteRel = new ArrayList<NameRelationship>();
305
			List<NameRelationship> deleteRel = new ArrayList<>();
315 306
			for (NameRelationship relFauEu: relSynFaunaEu){
316 307
				boolean createNewRelationship = true;
317 308
				for (NameRelationship relErms: relTaxonErms){
......
345 336
		Taxon taxonFaunaEu;
346 337
		Synonym synErms;
347 338
		Taxon taxonErms;
348
		Set<Taxon> acceptedTaxa = new HashSet<Taxon>();
339
		Set<Taxon> acceptedTaxa = new HashSet<>();
349 340
		for (List<String> row: ermsSynFaEuAcc){
350 341
			taxonFaunaEu = (Taxon)appCtrInit.getTaxonService().find(UUID.fromString(row.get(faunaEuUuid)));
351 342
			synErms = (Synonym)appCtrInit.getTaxonService().find(UUID.fromString(row.get(ermsUuid)));
......
462 453
	}
463 454

  
464 455
	//after merging faunaEu taxon and erms taxon, the originalSource of the faunaEu taxon has to be moved to the erms taxon
465
	private void moveOriginalDbToErmsTaxon(TaxonBase faunaEu, TaxonBase erms){
466
		Set<IdentifiableSource> sourcesFaunaEu = faunaEu.getSources();
456
	private void moveOriginalDbToErmsTaxon(TaxonBase<?> faunaEuTaxon, TaxonBase<?> ermsTaxon){
457
		Set<IdentifiableSource> sourcesFaunaEu = faunaEuTaxon.getSources();
467 458
		IdentifiableSource sourceFaunaEu = sourcesFaunaEu.iterator().next();
468
		erms.addSource(sourceFaunaEu);
459
		ermsTaxon.addSource(sourceFaunaEu);
469 460
	}
470 461

  
471 462
	//merged taxon should have a new sec reference

Also available in: Unified diff