Project

General

Profile

« Previous | Next » 

Revision 5bfe953d

Added by Andreas Müller over 5 years ago

ref #7664 adapt app-import to typified return types

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/app/wp6/palmae/UseImport.java
273 273
		MarkerType useMarkerType = (MarkerType) termService.find(UUID.fromString("2e6e42d9-e92a-41f4-899b-03c0ac64f039"));
274 274
		Feature featureUseRecord = (Feature) termService.find(UUID.fromString("8125a59d-b4d5-4485-89ea-67306297b599"));
275 275
		Feature featureUseSummary = (Feature) termService.find(UUID.fromString("6acb0348-c070-4512-a37c-67bcac016279"));
276
		Pager<DefinedTermBase>  notAvailModPager = termService.findByTitle(DefinedTerm.class, "N/A", null, null, null, null, null, null);
277
		Pager<DefinedTermBase>  notAvailStatePager = termService.findByTitle(State.class, "N/A", null, null, null, null, null, null);
278
		DefinedTerm notAvailMod = (DefinedTerm) notAvailModPager.getRecords().get(0);
279
		State notAvailState = (State) notAvailStatePager.getRecords().get(0);
276
		Pager<DefinedTerm>  notAvailModPager = termService.findByTitle(DefinedTerm.class, "N/A", null, null, null, null, null, null);
277
		Pager<State>  notAvailStatePager = termService.findByTitle(State.class, "N/A", null, null, null, null, null, null);
278
		DefinedTerm notAvailMod = notAvailModPager.getRecords().get(0);
279
		State notAvailState = notAvailStatePager.getRecords().get(0);
280 280

  
281 281
		int i = 0;
282 282
		int j = 0;
......
284 284
			for (ArrayList<String> lstUseSummary : lstUseSummaries) {
285 285
				i++;
286 286
				String idTaxonToUpdate = lstUseSummary.get(3);
287
				TaxonBase taxon = taxonService.find(UUID.fromString(idTaxonToUpdate));
287
				TaxonBase<?> taxon = taxonService.find(UUID.fromString(idTaxonToUpdate));
288 288
				if (taxon != null) {
289 289
					TaxonDescription newUseDescription = TaxonDescription.NewInstance();
290 290
					Marker useMarker = Marker.NewInstance(useMarkerType, true);
......
312 312
							useRecord.setFeature(featureUseRecord);
313 313
							String modifyingText = "";
314 314
							if(lstUseRecord.get(3) != null && lstUseRecord.get(3).length() > 0) {
315
								Pager<DefinedTermBase> useCategoryPager = termService.findByTitle(State.class, lstUseRecord.get(3), null, null, null, null, null, null);
315
								Pager<State> useCategoryPager = termService.findByTitle(State.class, lstUseRecord.get(3), null, null, null, null, null, null);
316 316
								State useCategory = null;
317 317
								if(useCategoryPager.getCount() > 0) {
318
									useCategory = (State) useCategoryPager.getRecords().get(0);
318
									useCategory = useCategoryPager.getRecords().get(0);
319 319
								} else {
320 320
									useCategory = notAvailState;
321 321
								}
......
338 338
							}
339 339

  
340 340
							if(lstUseRecord.get(4) != null && lstUseRecord.get(4).length() > 0) {
341
								Pager<DefinedTermBase> useSubCategoryPager = termService.findByTitle(State.class, lstUseRecord.get(4), null, null, null, null, null, null);
341
								Pager<State> useSubCategoryPager = termService.findByTitle(State.class, lstUseRecord.get(4), null, null, null, null, null, null);
342 342
								State useSubCategory = null;
343 343
								if(useSubCategoryPager.getCount() > 0) {
344
									useSubCategory = (State) useSubCategoryPager.getRecords().get(0);
344
									useSubCategory = useSubCategoryPager.getRecords().get(0);
345 345

  
346 346
								} else {
347 347
									useSubCategory = notAvailState;
......
363 363

  
364 364
							}
365 365
							if(lstUseRecord.get(5) != null && lstUseRecord.get(5).length() > 0) {
366
								Pager<DefinedTermBase> countryPager = termService.findByTitle(DefinedTerm.class, lstUseRecord.get(5), null, null, null, null, null, null);
366
								Pager<DefinedTerm> countryPager = termService.findByTitle(DefinedTerm.class, lstUseRecord.get(5), null, null, null, null, null, null);
367 367
								DefinedTerm country = null;
368 368
								if(countryPager.getCount() > 0) {
369
									country = (DefinedTerm) countryPager.getRecords().get(0);
369
									country = countryPager.getRecords().get(0);
370 370
								} else {
371 371
									country = notAvailMod;
372 372
								}
......
379 379
							}
380 380

  
381 381
							if(lstUseRecord.get(6) != null && lstUseRecord.get(6).length() > 0) {
382
								Pager<DefinedTermBase> plantPartPager = termService.findByTitle(DefinedTerm.class, lstUseRecord.get(6), null, null, null, null, null, null);
382
								Pager<DefinedTerm> plantPartPager = termService.findByTitle(DefinedTerm.class, lstUseRecord.get(6), null, null, null, null, null, null);
383 383
								DefinedTerm plantPart = null;
384 384
								if(plantPartPager.getCount() > 0) {
385
									plantPart = (DefinedTerm) plantPartPager.getRecords().get(0);
385
									plantPart = plantPartPager.getRecords().get(0);
386 386
								} else {
387 387
									plantPart = notAvailMod;
388 388
								}
......
394 394
								useRecord.addModifier(plantPart);
395 395
							}
396 396
							if(lstUseRecord.get(7) != null && lstUseRecord.get(7).length() > 0) {
397
								Pager<DefinedTermBase> humanGroupPager = termService.findByTitle(DefinedTerm.class, lstUseRecord.get(7), null, null, null, null, null, null);
397
								Pager<DefinedTerm> humanGroupPager = termService.findByTitle(DefinedTerm.class, lstUseRecord.get(7), null, null, null, null, null, null);
398 398
								DefinedTerm humanGroup = null;
399 399
								if(humanGroupPager.getCount() > 0) {
400
									humanGroup = (DefinedTerm) humanGroupPager.getRecords().get(0);
400
									humanGroup = humanGroupPager.getRecords().get(0);
401 401
								} else {
402 402
									humanGroup = notAvailMod;
403 403
								}
......
409 409
								useRecord.addModifier(humanGroup);
410 410
							}
411 411
							if(lstUseRecord.get(8) != null && lstUseRecord.get(8).length() > 0) {
412
								Pager<DefinedTermBase> ethnicGroupPager = termService.findByTitle(DefinedTerm.class, lstUseRecord.get(8), null, null, null, null, null, null);
412
								Pager<DefinedTerm> ethnicGroupPager = termService.findByTitle(DefinedTerm.class, lstUseRecord.get(8), null, null, null, null, null, null);
413 413
								DefinedTerm ethnicGroup = null;
414 414
								if(ethnicGroupPager.getCount() > 0) {
415
									ethnicGroup = (DefinedTerm) ethnicGroupPager.getRecords().get(0);
415
									ethnicGroup = ethnicGroupPager.getRecords().get(0);
416 416
									modifyingText += ethnicGroup.toString() + ";";
417 417
								} else {
418 418
									ethnicGroup = notAvailMod;
......
700 700
		TermVocabulary<DefinedTerm> countryVocabulary = vocabularyService.find(UUID.fromString("116c51f1-e63a-46f7-a258-e1149a42868b"));
701 701
		TermVocabulary<DefinedTerm> plantPartVocabulary = vocabularyService.find(UUID.fromString("369914fe-d54b-4063-99ce-abc81d30ad35"));
702 702
		TermVocabulary<DefinedTerm> humanGroupVocabulary =  vocabularyService.find(UUID.fromString("ca46cea5-bdf7-438d-9cd8-e2793d2178dc"));
703
		Pager<DefinedTermBase>  notAvailModPager = termService.findByTitle(DefinedTerm.class, "N/A", null, null, null, null, null, null);
704
		Pager<DefinedTermBase>  notAvailStatePager = termService.findByTitle(State.class, "N/A", null, null, null, null, null, null);
703
		Pager<DefinedTerm>  notAvailModPager = termService.findByTitle(DefinedTerm.class, "N/A", null, null, null, null, null, null);
704
		Pager<State>  notAvailStatePager = termService.findByTitle(State.class, "N/A", null, null, null, null, null, null);
705 705

  
706 706
		conversation.startTransaction();
707 707
		if (existingMarkertype == null) {
app-import/src/main/java/eu/etaxonomy/cdm/io/wp6/CommonNameExcelImport.java
24 24
import eu.etaxonomy.cdm.io.common.mapping.UndefinedTransformerMethodException;
25 25
import eu.etaxonomy.cdm.io.excel.common.ExcelImportBase;
26 26
import eu.etaxonomy.cdm.io.excel.common.ExcelRowBase;
27
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
28 27
import eu.etaxonomy.cdm.model.common.Language;
29 28
import eu.etaxonomy.cdm.model.common.OriginalSourceType;
30 29
import eu.etaxonomy.cdm.model.common.TermType;
......
182 181
				e.printStackTrace();
183 182
			}
184 183
			if (result == null){
185
				List<DefinedTermBase> candidates = getTermService().findByTitle(Country.class, area, null, criteria, null, null, orderHints, null).getRecords();
184
				List<? extends NamedArea> candidates = getTermService().findByTitle(Country.class, area, null, criteria, null, null, orderHints, null).getRecords();
186 185
				if (candidates.size() == 0){
187 186
					candidates = getTermService().findByTitle(NamedArea.class, area, null, criteria, null, null, orderHints, null).getRecords();
188 187
				}
189 188
				if (candidates.size()>0){
190 189
					//TODO
191
					result = (NamedArea)candidates.get(0);
190
					result = candidates.get(0);
192 191
				}else{
193 192
					UUID uuidArea;
194 193
					try {

Also available in: Unified diff