Project

General

Profile

« Previous | Next » 

Revision d63fc1f3

Added by Andreas Müller almost 8 years ago

#5946 Implement/fix referencing objets label provider for TaxonNode and DerivationEvent

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DescriptionHelper.java
61 61
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
62 62
import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
63 63
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
64
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
64 65
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
65 66
import eu.etaxonomy.cdm.model.taxon.Classification;
66 67
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
67 68
import eu.etaxonomy.cdm.model.taxon.Taxon;
69
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
68 70
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
69 71
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
70 72
import eu.etaxonomy.taxeditor.store.CdmStore;
......
245 247
			return getCache((HomotypicalGroup) element);
246 248
		}else if (element instanceof TaxonNode) {
247 249
			return getCache((TaxonNode) element);
250
		}else if (element instanceof DeterminationEvent) {
251
			return getCache((DeterminationEvent) element);
248 252
		}else if (element instanceof Marker) {
249 253
			Marker marker = (Marker) element;
250 254
			MarkerType type = marker.getMarkerType();
......
262 266
	}
263 267

  
264 268

  
269
	private static String getCache(DeterminationEvent detEvent) {
270
		//taxon
271
		String taxonStr = "no taxon";
272
		TaxonNameBase<?,?> taxonName = detEvent.getTaxonName();
273
		TaxonBase<?> taxon = detEvent.getTaxon();
274
		if (taxonName != null){
275
			taxonStr = taxonName.getTitleCache();
276
		}else if (taxon != null){
277
			taxonStr = taxon.getTitleCache();
278
		}
279
		//unit
280
		String unitStr = "no unit";
281
		SpecimenOrObservationBase<?> unit = detEvent.getIdentifiedUnit();
282
		if (unit != null){
283
			unitStr = unit.getTitleCache();
284
		}
285
		
286
		String result = CdmUtils.concat(" determined as ", unitStr, taxonStr);
287

  
288
		return result;
289
	}
290

  
265 291
	private static String getCache(TaxonNode taxonNode) {
266 292
		String result = "";
267 293
		Classification classification = taxonNode.getClassification();
......
291 317
		}
292 318
		result = CdmUtils.concat(": ", result, parentStr);
293 319
		
294
		return null;
320
		return result;
295 321
	}
296 322

  
297 323
	private static String getCache(TypeDesignationBase<?> designation) {
......
360 386
				toMethod.setAccessible(true);
361 387
				from = (IdentifiableEntity<?>)fromMethod.invoke(rel);
362 388
				to = (IdentifiableEntity<?>)toMethod.invoke(rel);
363
			} catch (NoSuchMethodException e) {
364
				throw new RuntimeException(e);
365
			} catch (SecurityException e) {
366
				throw new RuntimeException(e);
367
			} catch (IllegalAccessException e) {
368
				throw new RuntimeException(e);
369
			} catch (IllegalArgumentException e) {
370
				throw new RuntimeException(e);
371
			} catch (InvocationTargetException e) {
389
			} catch (NoSuchMethodException | SecurityException | IllegalAccessException
390
				| IllegalArgumentException | InvocationTargetException e) {
372 391
				throw new RuntimeException(e);
373 392
			}
374
			
375 393
		}
376 394
		String typeLabel = null;
377 395
		if (type != null){

Also available in: Unified diff