Revision 2f6d0465
Added by Patrick Plitzner almost 9 years ago
- fixed potential ClassCastException
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateLabelProvider.java | ||
---|---|---|
20 | 20 |
|
21 | 21 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
22 | 22 |
import eu.etaxonomy.cdm.api.service.IOccurrenceService; |
23 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; |
|
23 | 24 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
24 | 25 |
import eu.etaxonomy.cdm.model.common.DefinedTerm; |
25 | 26 |
import eu.etaxonomy.cdm.model.common.Identifier; |
... | ... | |
315 | 316 |
return ImageResources.getImage(ImageResources.FIELD_UNIT); |
316 | 317 |
} |
317 | 318 |
else if(cdmBase.isInstanceOf(DerivedUnit.class)){ |
318 |
DerivedUnit derivedUnit = (DerivedUnit)element;
|
|
319 |
DerivedUnit derivedUnit = HibernateProxyHelper.deproxy(element, DerivedUnit.class);
|
|
319 | 320 |
if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.FieldUnit){ |
320 | 321 |
return ImageResources.getImage(ImageResources.FIELD_UNIT); |
321 | 322 |
} |
... | ... | |
362 | 363 |
} |
363 | 364 |
|
364 | 365 |
public static Identifier<DnaSample> getCurrentSampleDesignation(CdmBase entity) { |
365 |
if(entity instanceof DnaSample){
|
|
366 |
DnaSample dnaSample = (DnaSample)entity;
|
|
366 |
if(entity.isInstanceOf(DnaSample.class)){
|
|
367 |
DnaSample dnaSample = HibernateProxyHelper.deproxy(entity, DnaSample.class);
|
|
367 | 368 |
for (Identifier<DnaSample> identifier : dnaSample.getIdentifiers()) { |
368 | 369 |
if(identifier.getType()!=null && identifier.getType().equals(DerivateLabelProvider.getSampleDesignationTerm())){ |
369 | 370 |
//first sample designation is the current |
... | ... | |
371 | 372 |
} |
372 | 373 |
} |
373 | 374 |
} |
374 |
else if(entity instanceof Sequence){
|
|
375 |
Sequence sequence = (Sequence)entity;
|
|
375 |
else if(entity.isInstanceOf(Sequence.class)){
|
|
376 |
Sequence sequence = HibernateProxyHelper.deproxy(entity, Sequence.class);
|
|
376 | 377 |
if(sequence.getDnaSample()!=null){ |
377 | 378 |
return getCurrentSampleDesignation(sequence.getDnaSample()); |
378 | 379 |
} |
Also available in: Unified diff