- removed debug output
authorPatric Plitzner <p.plitzner@bgbm.org>
Thu, 19 Jun 2014 12:39:11 +0000 (12:39 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Thu, 19 Jun 2014 12:39:11 +0000 (12:39 +0000)
 - made DerivateLabelProvider use occurrence service

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/dataimport/DataImportEditorContextMenu.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateLabelProvider.java

index 36c45b12618328353b3fc5aa06df2ddaa1f53479..d556221c8047671c0d13d992bea81a35e6644b08 100644 (file)
@@ -70,7 +70,6 @@ public class DataImportEditorContextMenu extends CompoundContributionItem {
                                                 DataImportEditor<?> dataImportEditor = (DataImportEditor<?>)activeEditor;
                                                 CdmStore.getService(IOccurrenceService.class).saveOrUpdate((SpecimenOrObservationBase<?>) next);
                                                 dataImportEditor.getConversationHolder().commit(true);
-                                                System.out.println("commit");
                                             }
                                         }
                                     }
index 4842391de8b705be7880ad31e63fc570e126be7d..ba8fa96b552751ec7fba20ececd391dfbbf36a49 100644 (file)
@@ -19,6 +19,7 @@ import org.eclipse.swt.graphics.Image;
 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;
@@ -104,9 +105,7 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
      * @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();
         }
@@ -143,8 +142,9 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
         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()+", ":"";