Project

General

Profile

« Previous | Next » 

Revision 55d8bf29

Added by Andreas Müller over 9 years ago

latest Vibrant Activator DwcA import changes

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/app/vibrant/DwcaScratchpadImportActivator.java
10 10
package eu.etaxonomy.cdm.app.vibrant;
11 11

  
12 12
import java.net.URI;
13
import java.util.UUID;
13 14

  
14 15
import org.apache.log4j.Logger;
15 16

  
......
37 38
	
38 39
	//database validation status (create, update, validate ...)
39 40
	static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
40
	static final URI source = dwca_test_scratch_test();
41
	
41

  
42
	//	static final URI source =  dwca_emonocots_dioscoreaceae();
43
	static final URI source =  dwca_emonocots_zingiberaceae();
44
//	static final URI source =  dwca_emonocots_cypripedioideae();
42 45
	
43 46
//	static final ICdmDataSource cdmDestination = CdmDestinations.localH2();
44
	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql_dwca();
47
	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql();
45 48
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql_test();
46

  
47 49
	
48 50
	//default nom code is ICZN as it allows adding publication year 
49
	static final NomenclaturalCode defaultNomCode = null;
51
	static final NomenclaturalCode defaultNomCode = NomenclaturalCode.ICBN;
50 52

  
53
	//title
54
	static final String title = "Scratchpad test import";
51 55
	
52 56
	//check - import
53 57
	static final CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
58
	static int partitionSize = 1000;
54 59
	
55 60
	//config
56 61
	static DatasetUse datasetUse = DatasetUse.CLASSIFICATION;
57 62
	
58 63
	//validate
59
	static boolean validateRankConsistency = true;
64
	static boolean validateRankConsistency = false;
60 65
	
61 66
	
62 67
	//taxa
63 68
	static final boolean doTaxa = true;
69
	static final boolean doDistribution = true;
64 70
	
65 71
	
66 72
	
67 73
	static final MappingType mappingType = MappingType.InMemoryMapping;
68 74
	
69
	private void doImport(ICdmDataSource cdmDestination){
75
	//classification
76
	static final UUID classificationUuid = UUID.fromString("d9d199b6-eaf4-47c8-a732-0639bc445c56");
77
	
78
	
79
	//config
80
	static boolean scientificNameIdAsOriginalSourceId = true;
81
	static boolean guessNomRef = false;
82
	private boolean handleAllRefsAsCitation = false;
83
	private static final boolean useSourceReferenceAsSec = true;
84
	
85

  
86
	//deduplicate
87
	static final boolean doDeduplicate = false;
88

  
89
	
90
	
91
	protected void doImport(URI source, ICdmDataSource cdmDestination, UUID classificationUuid, String title, DbSchemaValidation hbm2dll){
70 92
		
71 93
		//make Source
72 94
		DwcaImportConfigurator config= DwcaImportConfigurator.NewInstance(source, cdmDestination);
73 95
		config.addObserver(new LoggingIoObserver());
96
		config.setClassificationUuid(classificationUuid);
74 97
		config.setCheck(check);
75 98
		config.setDbSchemaValidation(hbm2dll);
76 99
		config.setMappingType(mappingType);
100
		
101
		config.setScientificNameIdAsOriginalSourceId(scientificNameIdAsOriginalSourceId);
77 102
		config.setValidateRankConsistency(validateRankConsistency);
103
		config.setDefaultPartitionSize(partitionSize);
78 104
		config.setNomenclaturalCode(defaultNomCode);
105
		config.setDatasetUse(datasetUse);
106
		config.setGuessNomenclaturalReferences(guessNomRef);
107
		config.setHandleAllRefsAsCitation(handleAllRefsAsCitation);
108
		config.setUseSourceReferenceAsSec(useSourceReferenceAsSec);
109
		config.setSourceReferenceTitle(title);
79 110
		
80 111
		CdmDefaultImport myImport = new CdmDefaultImport();
81 112

  
......
97 128
		return result;
98 129
	}
99 130

  
131
	//Dwca
132
	public static URI dwca_emonocots_local() {
133
		URI sourceUrl = URI.create("file:///C:/localCopy/Data/dwca/import/Scratchpads/dwca_dioscoreaceae_emonocots.zip");
134
		return sourceUrl;
135
	}
100 136
	
101
	//Scratchpads test
102
	public static URI dwca_test_scratch_test() {
103
		URI sourceUrl = URI.create("file:////PESIIMPORT3/vibrant/dwca/dwca_export_scratchpads_test.zip");
137
	//emonocots_dioscoreaceae
138
	public static URI dwca_emonocots_dioscoreaceae() {
139
		URI sourceUrl = URI.create("file:////PESIIMPORT3/vibrant/dwca/dwca_emonocots_dioscoreaceae.zip");
140
		return sourceUrl;
141
	}
142
	
143
	//emonocots_zingiberaceae
144
	public static URI dwca_emonocots_zingiberaceae() {
145
		URI sourceUrl = URI.create("file:////PESIIMPORT3/vibrant/dwca/dwca_emonocots_zingiberaceae.zip");
146
		return sourceUrl;
147
	}
148
	//emonocots_cypripedioideae
149
	public static URI dwca_emonocots_cypripedioideae() {
150
		URI sourceUrl = URI.create("file:////PESIIMPORT3/vibrant/dwca/dwca_emonocots_cypripedioideae.zip");
104 151
		return sourceUrl;
105 152
	}
106 153
	
......
110 157
	 */
111 158
	public static void main(String[] args) {
112 159
		DwcaScratchpadImportActivator me = new DwcaScratchpadImportActivator();
113
		me.doImport(cdmDestination);
160
		me.doImport(source, cdmDestination, classificationUuid, title, hbm2dll);
114 161
	}
115 162
	
116 163
}
app-import/src/main/java/eu/etaxonomy/cdm/app/vibrant/VibrantActivator.java
9 9

  
10 10
package eu.etaxonomy.cdm.app.vibrant;
11 11

  
12
import java.net.URI;
13
import java.util.UUID;
14

  
12 15
import org.apache.log4j.Logger;
13 16

  
14 17
import eu.etaxonomy.cdm.app.berlinModelImport.BerlinModelSources;
......
32 35
	private static final Logger logger = Logger.getLogger(VibrantActivator.class);
33 36

  
34 37
	//database validation status (create, update, validate ...)
35
	static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
38
//	static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
39
	static DbSchemaValidation hbm2dll = DbSchemaValidation.VALIDATE;
40
	
36 41
	static final Source iopiSource = BerlinModelSources.iopi();
37 42
	static final Source mclSource = BerlinModelSources.mcl();
38 43
	static final Source emSource = BerlinModelSources.PESI3_euroMed();
44
	static final URI dioscoreaceaeSource = DwcaScratchpadImportActivator.dwca_emonocots_dioscoreaceae();
45
	static final URI cypripedioideaeSource = DwcaScratchpadImportActivator.dwca_emonocots_cypripedioideae();
46
	static final URI zingiberaceaeSource = DwcaScratchpadImportActivator.dwca_emonocots_zingiberaceae();
39 47
	
40 48
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql();
41
	static final ICdmDataSource cdmDestination = cdm_test_local_vibrant();
49
//	static final ICdmDataSource cdmDestination = cdm_test_local_vibrant();
50
//	static final ICdmDataSource cdmDestination = cdm_vibrant_dev();
51
	static final ICdmDataSource cdmDestination = cdm_vibrant_emonoctos_dev();
52
	
42 53

  
43
	static final boolean doMcl = true;
44
	static final boolean doEuroMed = true;
54
	static final boolean doMcl = false;
55
	static final boolean doEuroMed = false;
45 56
	static final boolean doIopi = false;
57
	static final boolean doDioscoreaceae = true;
58
	static final boolean doZingiberaceae = false;
59
	static final boolean doCypripedioideae = false;
46 60
	
47 61
	
48 62
	/**
......
69 83
			hbm2dll = DbSchemaValidation.NONE;
70 84
		}
71 85
		
86
		if (doDioscoreaceae){
87
			DwcaScratchpadImportActivator scratchpadActivator = new DwcaScratchpadImportActivator();
88
			UUID uuid = UUID.fromString("3bf59b32-9269-4225-944f-570256d40a9b");
89
			scratchpadActivator.doImport(dioscoreaceaeSource, cdmRepository,uuid , "Dioscoreaceae (Scratchpads)", hbm2dll);
90
			hbm2dll = DbSchemaValidation.NONE;
91
		}
92
		
93
		if (doZingiberaceae){
94
			DwcaScratchpadImportActivator scratchpadActivator = new DwcaScratchpadImportActivator();
95
			UUID uuid = UUID.fromString("8fb0f951-ccd8-41c4-8d0b-99ba1fbd2dc2");
96
			scratchpadActivator.doImport(zingiberaceaeSource, cdmRepository, uuid, " (Scratchpads)", hbm2dll);
97
			hbm2dll = DbSchemaValidation.NONE;
98
		}
99
		
100
		if (doCypripedioideae){
101
			DwcaScratchpadImportActivator scratchpadActivator = new DwcaScratchpadImportActivator();
102
			UUID uuid = UUID.fromString("a2b0ecf5-1a9d-4d94-a9ef-f57717a49bfd");
103
			scratchpadActivator.doImport(cypripedioideaeSource, cdmRepository, uuid, " (Scratchpads)", hbm2dll);
104
			hbm2dll = DbSchemaValidation.NONE;
105
		}
106
		
72 107
		if (doEuroMed){
73 108
			logger.warn("DON'T FORGET to reset E+M filter");
74 109
			System.out.println("DON'T FORGET to reset E+M filter");
......
83 118
		String cdmUserName = "root";
84 119
		return CdmDestinations.makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
85 120
	}
121
	
122
	public static ICdmDataSource cdm_vibrant_dev(){
123
		DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
124
		String cdmServer = "160.45.63.201";
125
		String cdmDB = "cdm_vibrant_index"; 
126
		String cdmUserName = "edit";
127
		return CdmDestinations.makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
128
	}
129
	
130
	public static ICdmDataSource cdm_vibrant_emonoctos_dev(){
131
		DatabaseTypeEnum dbType = DatabaseTypeEnum.MySQL;
132
		String cdmServer = "160.45.63.201";
133
		String cdmDB = "cdm_vibrant_index_emonocots"; 
134
		String cdmUserName = "edit";
135
		return CdmDestinations.makeDestination(dbType, cdmServer, cdmDB, -1, cdmUserName, null);
136
	}
86 137

  
87 138
}

Also available in: Unified diff