import org.hibernate.LazyInitializationException;
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
import eu.etaxonomy.cdm.model.common.DefinedTerm;
import eu.etaxonomy.cdm.model.molecular.DnaSample;
import eu.etaxonomy.cdm.model.molecular.Sequence;
* @return
*/
public static String getDerivateText(Object element){
- TreeNode parentNode = null;
if(element instanceof TreeNode){
- parentNode = ((TreeNode) element).getParent();
//unwrap specimen from TreeNode
element = ((TreeNode) element).getValue();
}
else if(element instanceof DerivedUnit){
DerivedUnit derivedUnit = (DerivedUnit)element;
if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.PreservedSpecimen){
- if(parentNode!=null && parentNode.getValue() instanceof FieldUnit){
- FieldUnit fieldUnit = (FieldUnit) parentNode.getValue();
+ java.util.Collection<FieldUnit> fieldUnits = CdmStore.getService(IOccurrenceService.class).getFieldUnits(derivedUnit.getUuid());
+ if(fieldUnits!=null && !fieldUnits.isEmpty()){
+ FieldUnit fieldUnit = fieldUnits.iterator().next();
GatheringEvent gatheringEvent = fieldUnit.getGatheringEvent();
if(gatheringEvent!=null){
label += gatheringEvent.getCollector()!=null?gatheringEvent.getCollector()+", ":"";