- added conversation/session support to DerivateLabelProvider
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / view / derivateSearch / DerivateLabelProvider.java
index 260854f859bdc8dd12a21ca9164975854f6d8089..13c6f8dfbba7ad7cca67d754366c6ac3183e46b3 100644 (file)
@@ -16,7 +16,9 @@ import java.util.UUID;
 import org.eclipse.jface.viewers.ColumnLabelProvider;
 import org.eclipse.jface.viewers.TreeNode;
 import org.eclipse.swt.graphics.Image;
+import org.hibernate.LazyInitializationException;
 
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.model.common.DefinedTerm;
 import eu.etaxonomy.cdm.model.molecular.DnaSample;
 import eu.etaxonomy.cdm.model.molecular.Sequence;
@@ -32,7 +34,12 @@ import eu.etaxonomy.taxeditor.model.ImageResources;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
 /**
- * Label provider for the views to show {@link SpecimenOrObservationBase}s.
+ * Label provider for the views to show {@link SpecimenOrObservationBase}s.<br>
+ * <br>
+ * <b>Note:</b> If you use this label provider you need to assure that you
+ * created a {@link ConversationHolder} resp. have an open session because
+ * the labels are generated from various fields of the derivate hierarchy which
+ * are lazy loaded and could therefore throw a {@link LazyInitializationException}.
  */
 public class DerivateLabelProvider extends ColumnLabelProvider {
 
@@ -111,7 +118,7 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
             if(gatheringEvent!=null){
                 label += gatheringEvent.getCountry()!=null?gatheringEvent.getCountry().getLabel()+", ":"";
                 label += gatheringEvent.getLocality()!=null?gatheringEvent.getLocality().getText()+", ":"";
-//                label += gatheringEvent.getGatheringDate()!=null?gatheringEvent.getGatheringDate()+", ":"";
+                label += gatheringEvent.getGatheringDate()!=null?gatheringEvent.getGatheringDate()+", ":"";
                 label += gatheringEvent.getCollector()!=null?gatheringEvent.getCollector()+", ":"";
             }
             label += fieldUnit.getFieldNumber()!=null?fieldUnit.getFieldNumber():"";
@@ -136,7 +143,7 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
                 label += derivedUnit.getBarcode()!=null?derivedUnit.getBarcode():"";
             }
             else if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.TissueSample){
-
+//                kindofTissue + SampleDesignation
             }
         }
         else if(element instanceof MediaSpecimen){