Project

General

Profile

« Previous | Next » 

Revision fd70771b

Added by Andreas Müller over 12 years ago

minor

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/app/eflora/FloraMalesianaVol13Activator.java
46 46
	private static final Logger logger = Logger.getLogger(FloraMalesianaVol13Activator.class);
47 47
	
48 48
	//database validation status (create, update, validate ...)
49
	static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
49
	static DbSchemaValidation hbm2dll = DbSchemaValidation.VALIDATE;
50 50
	static final URI fmSource13_small = EfloraSources.fm_13_small_families();
51 51
	static final URI fmSource13_large = EfloraSources.fm_13_large_families();
52 52
	
......
56 56
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_flora_malesiana_production();
57 57
	static final ICdmDataSource cdmDestination = CdmDestinations.localH2();
58 58
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql();
59
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql_test();
60
	
61
	private boolean includeVol13_small = true;
62
	private boolean includeVol13_large = true;
63
	
64
	private boolean h2ForCheck = false;
59 65
	
60 66

  
61 67
	//feature tree uuid
......
72 78
	//taxa
73 79
	static final boolean doTaxa = true;
74 80

  
75
	private boolean includeVol13_small = true;
76
	private boolean includeVol13_large = false;
81
	
82
	private boolean replaceStandardKeyTitles = false;
77 83

  
78 84
	private IIoObserver observer = new LoggingIoObserver();
79 85
	private Set<IIoObserver> observerList = new HashSet<IIoObserver>();
......
81 87
	
82 88
	private void doImport(ICdmDataSource cdmDestination){
83 89
		observerList.add(observer);
84
		if (cdmDestination.getDatabaseType().equals(CdmDestinations.localH2().getDatabaseType())){
90
		if (h2ForCheck && cdmDestination.getDatabaseType().equals(CdmDestinations.localH2().getDatabaseType())){
85 91
			check = CHECK.CHECK_ONLY;
86 92
		}
87 93
		
......
94 100
		markupConfig.setDoPrintKeys(doPrintKeys);
95 101
		markupConfig.setDbSchemaValidation(hbm2dll);
96 102
		markupConfig.setObservers(observerList);
103
		markupConfig.setReplaceStandardKeyTitles(replaceStandardKeyTitles);
104
		
97 105
		
98
		CdmDefaultImport<MarkupImportConfigurator> myImport = new CdmDefaultImport<MarkupImportConfigurator>();
99

  
100

  
101 106
		markupConfig.setSourceReference(getSourceReference("Flora Malesiana - Vol. 13"));
107
		
108
		CdmDefaultImport<MarkupImportConfigurator> myImport = new CdmDefaultImport<MarkupImportConfigurator>(); 
109
		
110
		//Vol13_2
111
		if (includeVol13_large){
112
			System.out.println("\nStart import from ("+ fmSource13_large.toString() + ") ...");
113
			source = fmSource13_large;
114
			markupConfig.setSource(source);
115
			myImport.invoke(markupConfig);
116
			System.out.println("End import from ("+ fmSource13_large.toString() + ")...");
117
		}
118
		
102 119
		//Vol13_1
103 120
		if (includeVol13_small){
104 121
			System.out.println("\nStart import from ("+ fmSource13_small.toString() + ") ...");
......
108 125
			System.out.println("End import from ("+ fmSource13_small.toString() + ")...");
109 126
		}
110 127

  
111
		//Vol13_2
112
		if (includeVol13_large){
113
			System.out.println("\nStart import from ("+ fmSource13_large.toString() + ") ...");
114
			source = fmSource13_large;
115
			markupConfig.setSource(source);
116
			myImport.invoke(markupConfig);
117
			System.out.println("End import from ("+ fmSource13_large.toString() + ")...");
118
		}
128
		
129
//		makeGeoService();
119 130
		
120 131
		FeatureTree tree = makeFeatureNode(myImport.getCdmAppController().getTermService());
121 132
		myImport.getCdmAppController().getFeatureTreeService().saveOrUpdate(tree);
......
152 163
		
153 164
		addFeataureNodesByStringList(descriptionFeatureList, newNode, transformer, service);
154 165

  
155
		addFeataureNodesByStringList(generellDescriptionsList, root, transformer, service);
166
		addFeataureNodesByStringList(generellDescriptionsUpToAnatomyList, root, transformer, service);
167
		newNode = FeatureNode.NewInstance(Feature.ANATOMY());
168
		addFeataureNodesByStringList(anatomySubfeatureList, newNode, transformer, service);
169
		
170
		newNode = addFeataureNodesByStringList(generellDescriptionsFromAnatomyToPhytoChemoList, root, transformer, service);
171
		addFeataureNodesByStringList(phytoChemoSubFeaturesList, newNode, transformer, service);
156 172

  
173
		newNode = addFeataureNodesByStringList(generellDescriptionsFromPhytoChemoList, root, transformer, service);
174
		
157 175
		
158 176
		newNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
159 177
		root.addChild(newNode);
......
184 202
	};
185 203
	
186 204
	
187
	private static String [] generellDescriptionsList = new String[]{
205
	private static String [] generellDescriptionsUpToAnatomyList = new String[]{
188 206
		"Fossils",
189 207
		"Morphology and anatomy",
190 208
		"Morphology", 
191 209
		"Vegetative morphology and anatomy",
210
	};
211

  
212
	
213
	private static String [] anatomySubfeatureList = new String[]{
214
		"Leaf anatomy",
215
		"Wood anatomy"
216
	};
217

  
218
	private static String [] generellDescriptionsFromAnatomyToPhytoChemoList = new String[]{
192 219
		"Flower morphology",
193 220
		"Palynology",  
194 221
		"Pollination",  
......
198 225
		"Life cycle",
199 226
		"Fruits and embryology",
200 227
		"Dispersal",
201
		"Wood anatomy",  
202
		"Leaf anatomy",  
203 228
		"Chromosome numbers", 
204 229
		"Phytochemistry and Chemotaxonomy",
230
	};
231
	
232
	
233
	private static String [] phytoChemoSubFeaturesList = new String[]{
234
		"Alkaloids",
235
		"Iridoid glucosides",
236
		"Leaf phenolics",
237
		"Storage products of seeds",
238
		"Aluminium",
239
		"Chemotaxonomy",
240
	};
241
	
242

  
243
	private static String [] generellDescriptionsFromPhytoChemoList = new String[]{
205 244
		"Phytochemistry",
206 245
		"Taxonomy",
246
		"history",
247
		"cultivation",
207 248
		"Notes"
208 249
	};
209 250

  
251
	
210 252
	private static String [] descriptionFeatureList = new String[]{
211 253
		"lifeform", 
212 254
		"Bark",
......
234 276
		"Inflorescences",  
235 277
		"Inflorescence",
236 278
		"Young inflorescences", 
237
		"male inflorescences", 
238
		"female inflorescences", 
279
		"Male inflorescences", 
280
		"Female inflorescences", 
239 281
		"Bracts",  
240 282
		"Pedicels",  
241 283
		"flowering buds",  
......
253 295
		"cymes",  
254 296
		"Calyx",  
255 297
		"Petal",  
256
		"Petals",  
298
		"Petals",
299
		"perigone",
300
		"perigone lobes",
257 301
		"perigone tube",
258 302
		"Disc",  
259 303
		"corolla",  
......
296 340
		
297 341
	};
298 342
	
299
	public void addFeataureNodesByStringList(String[] featureStringList, FeatureNode root, IInputTransformer transformer, ITermService termService){
343
	public FeatureNode addFeataureNodesByStringList(String[] featureStringList, FeatureNode root, IInputTransformer transformer, ITermService termService){
344
		FeatureNode lastChild = null;
300 345
		try {
301 346
			for (String featureString : featureStringList){
302
			UUID featureUuid;
303
			featureUuid = transformer.getFeatureUuid(featureString);
304
			Feature feature = (Feature)termService.find(featureUuid);
305
			if (feature != null){
306
				FeatureNode child = FeatureNode.NewInstance(feature);
307
				root.addChild(child);	
347
				UUID featureUuid;
348
				featureUuid = transformer.getFeatureUuid(featureString);
349
				Feature feature = (Feature)termService.find(featureUuid);
350
				if (feature != null){
351
					FeatureNode child = FeatureNode.NewInstance(feature);
352
					root.addChild(child);	
353
				}
308 354
			}
309
		}
355
			
310 356
		} catch (UndefinedTransformerMethodException e) {
311 357
			logger.error("getFeatureUuid is not implemented in transformer. Features could not be added");
312 358
		}
359
		return lastChild;
313 360
	}
314 361
	
315 362

  

Also available in: Unified diff