Revision c8dc4e4a
Added by Andreas Müller almost 4 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DescriptionHelper.java | ||
---|---|---|
58 | 58 |
import eu.etaxonomy.cdm.model.name.NameTypeDesignation; |
59 | 59 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation; |
60 | 60 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
61 |
import eu.etaxonomy.cdm.model.name.TextualTypeDesignation; |
|
61 | 62 |
import eu.etaxonomy.cdm.model.name.TypeDesignationBase; |
62 | 63 |
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase; |
63 | 64 |
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent; |
... | ... | |
402 | 403 |
|
403 | 404 |
private static String getCache(TypeDesignationBase<?> designation) { |
404 | 405 |
designation = CdmBase.deproxy(designation); |
405 |
TypeDesignationStatusBase<?> status = designation.getTypeStatus(); |
|
406 |
Set<TaxonName> from; |
|
407 |
IdentifiableEntity<?> to; |
|
408 |
from = designation.getTypifiedNames(); |
|
406 |
//from |
|
407 |
String fromString = ""; |
|
408 |
Set<TaxonName> from = designation.getTypifiedNames(); |
|
409 |
if(from != null){ |
|
410 |
for (TaxonName name : from){ |
|
411 |
fromString = CdmUtils.concat(",", fromString, name.getTitleCache()); |
|
412 |
} |
|
413 |
} |
|
414 |
//to |
|
415 |
IdentifiableEntity<?> to = null; |
|
416 |
String toStr = ""; |
|
409 | 417 |
if (designation.isInstanceOf(SpecimenTypeDesignation.class)){ |
410 | 418 |
to = ((SpecimenTypeDesignation)designation).getTypeSpecimen(); |
411 | 419 |
}else if (designation.isInstanceOf(NameTypeDesignation.class)){ |
412 | 420 |
to = ((NameTypeDesignation)designation).getTypeName(); |
421 |
}else if (designation.isInstanceOf(TextualTypeDesignation.class)){ |
|
422 |
toStr = ((TextualTypeDesignation)designation).getPreferredText(CdmStore.getDefaultLanguage()); |
|
413 | 423 |
}else{ |
414 | 424 |
throw new RuntimeException("Type Designation class not supported: " + designation.getClass().getName()); |
415 | 425 |
} |
426 |
toStr = to == null? toStr : to.getTitleCache(); |
|
427 |
//status |
|
416 | 428 |
String typeLabel = null; |
429 |
TypeDesignationStatusBase<?> status = designation.getTypeStatus(); |
|
417 | 430 |
if (status != null){ |
418 | 431 |
Representation typeRepr = status.getPreferredRepresentation(CdmStore.getDefaultLanguage()); |
419 | 432 |
if (typeRepr != null){ |
... | ... | |
432 | 445 |
if (isBlank(typeLabel)){ |
433 | 446 |
typeLabel = "->"; |
434 | 447 |
} |
435 |
String fromString = ""; |
|
436 |
if(from != null){ |
|
437 |
for (TaxonName name : from){ |
|
438 |
CdmUtils.concat(",", fromString, name.getTitleCache()); |
|
439 |
} |
|
440 |
} |
|
448 |
//concat |
|
441 | 449 |
String result = CdmUtils.concat(" ", new String[]{from == null ? null : fromString, |
442 |
typeLabel, to == null? null : to.getTitleCache()});
|
|
450 |
typeLabel, toStr});
|
|
443 | 451 |
return result; |
444 | 452 |
} |
445 | 453 |
|
Also available in: Unified diff
fix #9045 fix exception in DescriptionHelper for TextualTypeDesignations and fix missing from part type designations