Project

General

Profile

« Previous | Next » 

Revision f6c86214

Added by Andreas Müller over 4 years ago

ref #8508 improve import-export pipeline for ERMS

View differences:

cdm-pesi/src/main/java/eu/etaxonomy/cdm/app/pesi/ErmsImportActivator.java
30 30
 * @author a.mueller
31 31
 */
32 32
public class ErmsImportActivator {
33
	private static final Logger logger = Logger.getLogger(ErmsImportActivator.class);
34 33

  
35
	//database validation status (create, update, validate ...)
36
	static DbSchemaValidation hbm2dll = DbSchemaValidation.VALIDATE;
34
    private static final Logger logger = Logger.getLogger(ErmsImportActivator.class);
37 35

  
38 36
//	static final Source ermsSource = PesiSources.PESI3_ERMS();
39 37
	static final Source ermsSource = PesiSources.PESI2019_ERMS();
40 38

  
41 39
//	static final ICdmDataSource cdmDestination = CdmDestinations.test_cdm_pesi_erms();
42
	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql_erms();
43
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql_erms2();
40
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql_erms();
41
	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql_erms2();
44 42

  
45
	static final UUID classificationUuid = UUID.fromString("6fa988a9-10b7-48b0-a370-2586fbc066eb");
43
	static final Source pesiDestination =
44
	        cdmDestination == CdmDestinations.cdm_test_local_mysql_erms()?
45
	                PesiDestinations.pesi_test_local_CDM_ERMS2PESI():
46
	                PesiDestinations.pesi_test_local_CDM_ERMS2PESI_2()    ;
47

  
48
	static final boolean includeExport2PESI = true;
46 49

  
50
	static final UUID classificationUuid = UUID.fromString("6fa988a9-10b7-48b0-a370-2586fbc066eb");
47 51
	static final String classificationName = "ERMS 2019";
48 52

  
49 53
	//check - import
50 54
	static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
51

  
52 55
	static final int partitionSize = 5000;
53

  
54 56
	//ignore null
55 57
	static final boolean ignoreNull = true;
56 58

  
57
	static final boolean includeExport2PESI = false;
58

  
59 59
// ***************** ALL ************************************************//
60 60

  
61 61
//	static final DO_REFERENCES doReferences =  DO_REFERENCES.ALL;
62 62
//	static final boolean doTaxa = true;
63
//	static final boolean doRelTaxa = true; //should always run with doTaxa because dependent on state from doTaxa
63
//	static final boolean doRelTaxa = doTaxa; //should always run with doTaxa because dependent on state from doTaxa
64 64
//  static final boolean doCommonNames = true;
65 65
//  static final boolean doNotes = false;
66 66
//	static final boolean doDistributions = true;
......
69 69

  
70 70
//******************** NONE ***************************************//
71 71

  
72
	static final DO_REFERENCES doReferences =  DO_REFERENCES.NONE;
72
	static final DO_REFERENCES doReferences = DO_REFERENCES.ALL;
73 73
	static final boolean doTaxa = true;
74
	static final boolean doRelTaxa = true; //should always run with doTaxa because dependent on state from doTaxa
74
	static final boolean doRelTaxa = doTaxa; //should always run with doTaxa because dependent on state from doTaxa
75 75
	static final boolean doCommonNames = false;
76 76
	static final boolean doNotes = false;
77 77
	static final boolean doDistributions = false;
78 78
	static final boolean doLinks = false;
79 79
	static final boolean doImages = false;
80 80

  
81
	private static DbSchemaValidation hbm2dll = (doReferences ==  DO_REFERENCES.ALL)? DbSchemaValidation.CREATE:DbSchemaValidation.VALIDATE;
81 82

  
82 83
	private void doImport(Source source, ICdmDataSource destination, DbSchemaValidation hbm2dll){
83 84
		System.out.println("Start import from ("+ ermsSource.getDatabase() + ") ...");
......
133 134
			ermsExport.doTaxa = doTaxa;
134 135
			ermsExport.doTreeIndex = doTaxa;
135 136
			ermsExport.doRelTaxa = doRelTaxa;
136
            ermsExport.doDescriptions = doImages;
137 137
            ermsExport.doInferredSynonyms = doRelTaxa;
138
            ermsExport.doDescriptions = doImages;
138 139

  
139
			ermsExport.doExport(cdmDB);
140
			ermsExport.doExport(cdmDB, pesiDestination);
140 141
		}
141 142
		System.exit(0);
142 143
	}
cdm-pesi/src/main/java/eu/etaxonomy/cdm/app/pesi/PesiExportActivatorERMS.java
33 33
//    static final ICdmDataSource cdmSource = CdmDestinations.cdm_test_local_mysql_erms2();
34 34

  
35 35
	//database validation status (create, update, validate ...)
36
//	static final Source pesiDestination = PesiDestinations.pesi_test_local_CDM_ERMS2PESI();
37
	static final Source pesiDestination = PesiDestinations.pesi_test_local_CDM_ERMS2PESI_2();
36
	static final Source pesiDestination = PesiDestinations.pesi_test_local_CDM_ERMS2PESI();
37
//	static final Source pesiDestination = PesiDestinations.pesi_test_local_CDM_ERMS2PESI_2();
38 38

  
39 39
// ****************** ALL *****************************************
40 40

  
41
//	static boolean deleteAll = true;
42
//	static DO_REFERENCES doReferences =  DO_REFERENCES.ALL;
43
//	static boolean doTaxa = true;
44
//	static boolean doTreeIndex = true;
45
//	static boolean doInferredSynonyms = true;
46
//	static boolean doRelTaxa = true;
47
//	static boolean doDescriptions = true;
41
	boolean deleteAll = true;
42
	DO_REFERENCES doReferences =  DO_REFERENCES.ALL;
43
	boolean doTaxa = true;
44
	boolean doTreeIndex = true;
45
	boolean doInferredSynonyms = true;
46
	boolean doRelTaxa = true;
47
	boolean doDescriptions = false;
48 48

  
49 49
// ************************ NONE **************************************** //
50 50

  
51
	static boolean deleteAll = false;
52
	static DO_REFERENCES doReferences =  DO_REFERENCES.ALL;
53
	static boolean doTaxa = true;
54
	static boolean doTreeIndex = true; //only with doTaxa
55
	static boolean doInferredSynonyms = true; //only with doTaxa
56
	static boolean doRelTaxa = true;
57
	static boolean doDescriptions = false;
51
//	boolean deleteAll = false;
52
//	static DO_REFERENCES doReferences =  DO_REFERENCES.NONE;
53
//	boolean doTaxa = true;
54
//	boolean doTreeIndex = doTaxa; //only with doTaxa
55
//	boolean doInferredSynonyms = false; //only with doTaxa
56
//	boolean doRelTaxa = false;
57
//	boolean doDescriptions = false;
58 58

  
59 59
//	static final boolean doNotes = false;
60 60
//	static final boolean doNoteSources = false;
......
74 74

  
75 75
	static final int partitionSize = 1000;
76 76

  
77
	public boolean 	doExport(ICdmDataSource source){
77
	public boolean 	doExport(ICdmDataSource source, Source destination){
78 78
		System.out.println("Start export to PESI ("+ pesiDestination.getDatabase() + ") ...");
79 79

  
80
		//make PESI Source
81
		Source destination = pesiDestination;
82 80
		PesiTransformer transformer = new PesiTransformer(destination);
83 81

  
84 82
		PesiExportConfigurator config = PesiExportConfigurator.NewInstance(destination, source, transformer);
......
86 84
		config.setDoTreeIndex(doTreeIndex); //only with doTaxa
87 85
		config.setDoInferredSynonyms(doInferredSynonyms); //only with doTaxa
88 86

  
87
		config.setDoReferences(doReferences);
89 88
		config.setDoTaxa(doTaxa);
90 89
		config.setDoRelTaxa(doRelTaxa);
91
		config.setDoReferences(doReferences);
92 90
		config.setDoDescription(doDescriptions);
93 91

  
94 92
//		config.setDoOccurrence(doOccurrence);
......
120 118
		PesiExportActivatorERMS ex = new PesiExportActivatorERMS();
121 119
		ICdmDataSource source = CdmDestinations.chooseDestination(args) != null ? CdmDestinations.chooseDestination(args) : cdmSource;
122 120

  
123
		ex.doExport(source);
121
		ex.doExport(source, pesiDestination);
124 122
		System.exit(0);
125 123
	}
126 124
}

Also available in: Unified diff