- added more paramaters to DnaQuality details view
authorPatric Plitzner <p.plitzner@bgbm.org>
Tue, 21 Oct 2014 07:43:21 +0000 (07:43 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Tue, 21 Oct 2014 07:43:21 +0000 (07:43 +0000)
 - fixed ordering of sample designations for DnaSamples (first is current)

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/AbstractSampleDesignationDetailSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/CurrentSampleDesignationDetailSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/DnaQualityDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SampleDesignationHistoryDetailSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateLabelProvider.java

index 50f8bf02576a741298273085e0a4df1f32df86ec..394143d9058607edc4bfad846d6ba04f83c72643 100644 (file)
@@ -43,15 +43,6 @@ public abstract class AbstractSampleDesignationDetailSection extends
                return identifier;
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
-        */
-       /** {@inheritDoc} */
-       @Override
-       public void addElement(Identifier<DnaSample> sampleDesignation) {
-               getEntity().addIdentifier(sampleDesignation);
-       }
-
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#removeElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
         */
index 4c782d2141a026c96bc90f97a2d248c39ba24420..472f80ef9e243fecbbb70e2ebc98ca882891ea2e 100644 (file)
@@ -12,20 +12,10 @@ package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
 
 import java.util.Collection;
 import java.util.Collections;
-import java.util.LinkedList;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.widgets.Control;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.model.common.Identifier;
 import eu.etaxonomy.cdm.model.molecular.DnaSample;
-import eu.etaxonomy.taxeditor.model.ImageResources;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
@@ -44,42 +34,6 @@ public class CurrentSampleDesignationDetailSection extends AbstractSampleDesigna
                super(formFactory, conversation, parentElement, "Current Sample Designation", style);
        }
 
-       @Override
-       protected Control createToolbar() {
-               ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
-
-               Action addAction = new Action("add", IAction.AS_PUSH_BUTTON){
-                       /* (non-Javadoc)
-                        * @see org.eclipse.jface.action.Action#run()
-                        */
-                       @Override
-                       public void run() {
-                           Identifier<DnaSample> element = createNewElement();
-
-                               getEntity().addIdentifier(element);
-
-                               if(element != null){
-                                       if(! getSection().isExpanded()) {
-                        getSection().setExpanded(true);
-                    }
-                                       internalUpdateSection(true);
-                               }
-                       }
-               };
-               addAction.setImageDescriptor(new ImageDescriptor() {
-
-                       @Override
-                       public ImageData getImageData() {
-                               return ImageResources.getImage(ImageResources.ADD_ICON).getImageData();
-                       }
-               });
-               addAction.setToolTipText(getTooltipString());
-
-               toolBarManager.add(addAction);
-
-               return toolBarManager.createControl(this);
-       }
-
        @Override
        public void refresh() {
                internalUpdateSection(false);
@@ -90,20 +44,13 @@ public class CurrentSampleDesignationDetailSection extends AbstractSampleDesigna
         */
        @Override
        public Collection<Identifier<DnaSample>> getCollection(DnaSample entity) {
-           LinkedList<Identifier<DnaSample>> sampleDesignations = new LinkedList<Identifier<DnaSample>>();
-           for (Identifier<DnaSample> identifier : entity.getIdentifiers()) {
-            if(identifier.getType()!=null && identifier.getType().equals(DerivateLabelProvider.getSampleDesignationTerm())){
-                sampleDesignations.add(identifier);
-            }
-        }
-        Collections.reverse(sampleDesignations);
-        if(sampleDesignations.size()>0){
-            //last sample designation is the current
-            return Collections.singleton(sampleDesignations.getFirst());
-        }
-        else{
-            return Collections.emptyList();
-        }
+           Identifier<DnaSample> currentSampleDesignation = DerivateLabelProvider.getCurrentSampleDesignation(entity);
+           if(currentSampleDesignation!=null){
+               return Collections.singleton(currentSampleDesignation);
+           }
+           else{
+               return Collections.emptyList();
+           }
        }
 
        /* (non-Javadoc)
@@ -115,4 +62,16 @@ public class CurrentSampleDesignationDetailSection extends AbstractSampleDesigna
                return "Create new current sample designation";
        }
 
+          /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
+     */
+    /** {@inheritDoc} */
+    @Override
+    public void addElement(Identifier<DnaSample> sampleDesignation) {
+        //The current sample designation is always the first one found.
+        //The following are recent sample designations with the most recent being
+        //the second one found and so on
+        getEntity().addIdentifier(0, sampleDesignation);
+    }
+
 }
index f8ce69eb1ee92939825a325ae222fef4cc211567..a7a775c58d388b34aa6ed3a07a24266676a468e3 100644 (file)
@@ -10,6 +10,7 @@
 package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
 
 import eu.etaxonomy.cdm.model.common.DefinedTerm;
+import eu.etaxonomy.cdm.model.molecular.DnaQuality;
 import eu.etaxonomy.cdm.model.molecular.DnaSample;
 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
@@ -25,8 +26,10 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
  */
 public class DnaQualityDetailElement extends AbstractCdmDetailElement<DnaSample> {
 
+//    private final TermType qualityTermVocabulary = CdmStore.getService(IVocabularyService.class).find(VocabularyEnum.DnaQualityTerm.getUuid());
+
     private NumberWithLabelElement numberRatioOfAbsorbance260_280;
-    private NumberWithLabelElement numberRatioOfAbsorbance260_230;
+    private NumberWithLabelElement numberRatioOfAbsorbance230_260;
     private NumberWithLabelElement numberConcentration;
     private TermComboElement<DefinedTerm> comboQualityTerm;
     private DateElement dateQualityCheck;
@@ -49,14 +52,25 @@ public class DnaQualityDetailElement extends AbstractCdmDetailElement<DnaSample>
      */
     @Override
     protected void createControls(ICdmFormElement formElement, DnaSample entity, int style) {
+        DnaQuality dnaQuality = entity.getDnaQuality();
+        if(dnaQuality==null){
+            dnaQuality = DnaQuality.NewInstance();
+        }
+        Double ratioOfAbsorbance230_260 = dnaQuality.getRatioOfAbsorbance230_260();
+        Double ratioOfAbsorbance260_280 = dnaQuality.getRatioOfAbsorbance260_280();
+        Double concentration = dnaQuality.getConcentration();
+        DefinedTerm qualityTerm = dnaQuality.getQualityTerm();
+
+        numberRatioOfAbsorbance230_260 = formFactory.createNumberTextWithLabelElement(formElement, "Ratio of absorbance 230-260", ratioOfAbsorbance230_260, style);
+        numberRatioOfAbsorbance260_280 = formFactory.createNumberTextWithLabelElement(formElement, "Ratio of absorbance 260-280", ratioOfAbsorbance260_280, style);
+        numberConcentration = formFactory.createNumberTextWithLabelElement(formElement, "Concentration", concentration, style);
+//        comboQualityTerm = formFactory.createDefinedTermComboElement(qualityTermVocabulary, formElement, "Quality Term", qualityTerm, style);
+
         //TODO DNA purification details
-        //TODO Ratio of absorbance 260-280
-        //TODO Ratio of absorbance 260-230
         //TODO concentration unit
-        //TODO concentration
         //TODO DNA quality
         //TODO Quality check date
-        //TODO Descritpion
+        //TODO Description
     }
 
     /*
@@ -68,5 +82,14 @@ public class DnaQualityDetailElement extends AbstractCdmDetailElement<DnaSample>
      */
     @Override
     public void handleEvent(Object eventSource) {
+        if(eventSource==numberRatioOfAbsorbance230_260){
+            getEntity().getDnaQuality().setRatioOfAbsorbance230_260(numberRatioOfAbsorbance230_260.getDouble());
+        }
+        else if(eventSource==numberRatioOfAbsorbance260_280){
+            getEntity().getDnaQuality().setRatioOfAbsorbance260_280(numberRatioOfAbsorbance260_280.getDouble());
+        }
+        else if(eventSource==numberConcentration){
+            getEntity().getDnaQuality().setConcentration(numberConcentration.getDouble());
+        }
     }
 }
index 08a05af738895671f51dc0aed6c846f53b0de6c4..c7b6f8c5e0d6e3742a8dbd3b592f91d51ec581d0 100644 (file)
@@ -11,7 +11,6 @@
 package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
 
 import java.util.Collection;
-import java.util.Collections;
 import java.util.LinkedList;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
@@ -51,9 +50,8 @@ public class SampleDesignationHistoryDetailSection extends AbstractSampleDesigna
                    sampleDesignations.add(identifier);
                }
            }
-           Collections.reverse(sampleDesignations);
            if(sampleDesignations.size()>0){
-               sampleDesignations.removeFirst();//last is the current sample designation
+               sampleDesignations.removeFirst();//first is the current sample designation
            }
            return sampleDesignations;
        }
@@ -73,4 +71,18 @@ public class SampleDesignationHistoryDetailSection extends AbstractSampleDesigna
                return "Add a sample designation to the history";
        }
 
+       /* (non-Javadoc)
+     * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#addElement(eu.etaxonomy.cdm.model.common.IVersionableEntity)
+     */
+    /** {@inheritDoc} */
+    @Override
+    public void addElement(Identifier<DnaSample> sampleDesignation) {
+        //The current sample designation is always the first one found.
+        //The following are recent sample designations with the most recent being
+        //the second one found and so on
+        Identifier<DnaSample> currentSampleDesignation = DerivateLabelProvider.getCurrentSampleDesignation(getEntity());
+        int indexOfCurrentSampleDesignation = getEntity().getIdentifiers().indexOf(currentSampleDesignation);
+        getEntity().addIdentifier(indexOfCurrentSampleDesignation+1, sampleDesignation);
+    }
+
 }
index 1a1b4833f1fa6463e824093187ef44195c12991e..39d0eb800c2563790a0a9194c87560e0c564f0c8 100644 (file)
@@ -20,7 +20,9 @@ import org.hibernate.LazyInitializationException;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.DefinedTerm;
+import eu.etaxonomy.cdm.model.common.Identifier;
 import eu.etaxonomy.cdm.model.molecular.DnaSample;
 import eu.etaxonomy.cdm.model.molecular.Sequence;
 import eu.etaxonomy.cdm.model.molecular.SingleRead;
@@ -44,6 +46,8 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  */
 public class DerivateLabelProvider extends ColumnLabelProvider {
 
+    private static final String NO_SAMPLE_DESIGNATION = "[no sample designation]";
+
     private Set<SingleRead> multiLinkSingleReads;
 
     private ConversationHolder conversation;
@@ -132,113 +136,150 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
 
     /**
      *
-     * @param element
+     * @param derivate
      * @return
      */
     public String getDerivateText(Object element){
+        //TODO: use list of strings to assemble labels to avoid adding the separator every time and to allow null values
         TreeNode parentNode = null;
+        TreeNode node = null;
+        Object derivate = element;
         if(element instanceof TreeNode){
-            parentNode = ((TreeNode) element).getParent();
+            node = (TreeNode) element;
+            parentNode = node.getParent();
             //unwrap specimen from TreeNode
-            element = ((TreeNode) element).getValue();
+            derivate = node.getValue();
         }
 
         conversation.bind();
 
-        String label = "";
-        if(element instanceof FieldUnit){
-            FieldUnit fieldUnit = (FieldUnit)element;
+        final String emptyString = "";
+        final String separator = ", ";
+
+        String label = emptyString;
+
+        //Field Unit
+        if(derivate instanceof FieldUnit){
+            FieldUnit fieldUnit = (FieldUnit)derivate;
             if(fieldUnit.getGatheringEvent()!=null){
                 GatheringEvent gatheringEvent = fieldUnit.getGatheringEvent();
                 if(!conversation.getSession().contains(gatheringEvent)){
                     fieldUnit = (FieldUnit) CdmStore.getService(IOccurrenceService.class).load(fieldUnit.getUuid());
                     gatheringEvent = fieldUnit.getGatheringEvent();
                 }
-                label += gatheringEvent.getCountry()!=null?gatheringEvent.getCountry().getLabel()+", ":"";
-                label += gatheringEvent.getLocality()!=null?gatheringEvent.getLocality().getText()+", ":"";
-                label += gatheringEvent.getGatheringDate()!=null?gatheringEvent.getGatheringDate()+", ":"";
-                label += gatheringEvent.getCollector()!=null?gatheringEvent.getCollector()+", ":"";
+                label += gatheringEvent.getCountry()!=null?gatheringEvent.getCountry().getLabel()+separator:emptyString;
+                label += gatheringEvent.getLocality()!=null?gatheringEvent.getLocality().getText()+separator:emptyString;
+                label += gatheringEvent.getGatheringDate()!=null?gatheringEvent.getGatheringDate()+separator:emptyString;
+                label += gatheringEvent.getCollector()!=null?gatheringEvent.getCollector()+separator:emptyString;
             }
-            label += fieldUnit.getFieldNumber()!=null?fieldUnit.getFieldNumber():"";
+            label += fieldUnit.getFieldNumber()!=null?fieldUnit.getFieldNumber():emptyString;
         }
-        else if(element instanceof MediaSpecimen){
-            MediaSpecimen mediaSpecimen = (MediaSpecimen)element;
+        //MediaSpecimen
+        else if(derivate instanceof MediaSpecimen){
+            MediaSpecimen mediaSpecimen = (MediaSpecimen)derivate;
             if(mediaSpecimen.getMediaSpecimen()!=null){
-                label += mediaSpecimen.getMediaSpecimen().getTitle()!=null?mediaSpecimen.getMediaSpecimen().getTitle().getText()+", ":"[no motif]";
-                label += mediaSpecimen.getMediaSpecimen().getArtist()!=null?mediaSpecimen.getMediaSpecimen().getArtist()+", ":"";
+                label += mediaSpecimen.getMediaSpecimen().getTitle()!=null?mediaSpecimen.getMediaSpecimen().getTitle().getText()+separator:"[no motif]";
+                label += mediaSpecimen.getMediaSpecimen().getArtist()!=null?mediaSpecimen.getMediaSpecimen().getArtist()+separator:emptyString;
             }
             eu.etaxonomy.cdm.model.occurrence.Collection collection = mediaSpecimen.getCollection();
             if(collection!=null){
-                label += collection.getName()!=null?collection.getName()+" ":"";
-                label += collection.getCode()!=null?"("+collection.getCode()+"), ":"";
+                label += collection.getName()!=null?collection.getName()+" ":emptyString;
+                label += collection.getCode()!=null?"("+collection.getCode()+")"+separator:emptyString;
             }
-            label += mediaSpecimen.getAccessionNumber()!=null?mediaSpecimen.getAccessionNumber()+", ":"";
+            label += mediaSpecimen.getAccessionNumber()!=null?mediaSpecimen.getAccessionNumber()+separator:emptyString;
         }
-        else if(element instanceof DnaSample
-                || (element instanceof DerivedUnit
-                        && ((SpecimenOrObservationBase<?>) element).getRecordBasis()==SpecimenOrObservationType.DnaSample)){
-            DerivedUnit derivedUnit = (DerivedUnit)element;
-            Set<String> identifiers = derivedUnit.getIdentifiers(getSampleDesignationTerm());
-            if(identifiers.isEmpty()){
-                label += "[no sample designation]";
+        //TissueSample + DnaSample
+        else if(derivate instanceof DnaSample){
+            DnaSample dnaSample = (DnaSample)derivate;
+            if(((DnaSample) derivate).getRecordBasis()==SpecimenOrObservationType.DnaSample){
+                Identifier<DnaSample> currentSampleDesignation = getCurrentSampleDesignation(dnaSample);
+                if(currentSampleDesignation!=null){
+                    label += currentSampleDesignation.getIdentifier()+separator;
+                }
+                else{
+                    label += NO_SAMPLE_DESIGNATION+separator;
+                }
             }
-            else{
-                String identifier = identifiers.iterator().next();
-                label += identifier==null?"":identifier;
+            else if(((DnaSample) derivate).getRecordBasis()==SpecimenOrObservationType.TissueSample){
+                label += dnaSample.getKindOfUnit()+separator;
+                Identifier<DnaSample> currentSampleDesignation = getCurrentSampleDesignation(dnaSample);
+                if(currentSampleDesignation!=null){
+                    label += currentSampleDesignation.getIdentifier()+separator;
+                }
+                else{
+                    label += NO_SAMPLE_DESIGNATION+separator;
+                }
             }
 
         }
-        else if(element instanceof DerivedUnit){
-            DerivedUnit derivedUnit = (DerivedUnit)element;
+        //DerivedUnit + TissueSample
+        else if(derivate instanceof DerivedUnit){
+            DerivedUnit derivedUnit = (DerivedUnit)derivate;
             if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.PreservedSpecimen){
                 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();
-//                    gatheringEvent = HibernateProxyHelper.deproxy(gatheringEvent, GatheringEvent.class);
+//                  gatheringEvent = HibernateProxyHelper.deproxy(gatheringEvent, GatheringEvent.class);
                     if(gatheringEvent!=null){
-                        label += gatheringEvent.getCollector()!=null?gatheringEvent.getCollector()+", ":"";
+                        label += gatheringEvent.getCollector()!=null?gatheringEvent.getCollector()+separator:emptyString;
                     }
-                    label += fieldUnit.getFieldNumber()!=null?fieldUnit.getFieldNumber()+", ":"";
+                    label += fieldUnit.getFieldNumber()!=null?fieldUnit.getFieldNumber()+separator:emptyString;
                 }
                 eu.etaxonomy.cdm.model.occurrence.Collection collection = derivedUnit.getCollection();
                 if(collection!=null){
-                    label += collection.getName()!=null?collection.getName()+" ":"";
-                    label += collection.getCode()!=null?"("+collection.getCode()+"), ":"";
+                    label += collection.getName()!=null?collection.getName()+" ":emptyString;
+                    label += collection.getCode()!=null?"("+collection.getCode()+"), ":emptyString;
                 }
-                label += derivedUnit.getAccessionNumber()!=null?derivedUnit.getAccessionNumber()+", ":"";
-                label += derivedUnit.getBarcode()!=null?derivedUnit.getBarcode():"";
+                label += derivedUnit.getAccessionNumber()!=null?derivedUnit.getAccessionNumber()+separator:emptyString;
+                label += derivedUnit.getBarcode()!=null?derivedUnit.getBarcode():emptyString;
             }
             else if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.TissueSample){
-                //TODO: implement
-                label += "kindofTissue? + [no sample designation]";
+                label += derivedUnit.getKindOfUnit() + NO_SAMPLE_DESIGNATION;
             }
         }
-        else if(element instanceof Sequence){
-            Sequence sequence = (Sequence)element;
-            label += "[no sample designation]"+", ";
-            label += sequence.getDnaMarker()!=null?sequence.getDnaMarker():"";
+        //Sequence
+        else if(derivate instanceof Sequence){
+            Sequence sequence = (Sequence)derivate;
+            Identifier<DnaSample> currentSampleDesignation = getCurrentSampleDesignation(sequence);
+            if(currentSampleDesignation!=null){
+                label += currentSampleDesignation.getIdentifier()+separator;
+            }
+            else{
+                label += NO_SAMPLE_DESIGNATION+separator;
+            }
+            label += sequence.getDnaMarker()!=null?sequence.getDnaMarker():emptyString;
         }
-        else if(element instanceof SingleRead){
-            SingleRead singleRead = (SingleRead)element;
-            label += "[no sample designation]"+", ";
-            label += singleRead.getPrimer()!=null?singleRead.getPrimer().getLabel()+", ":"";
+        //SingleRead
+        else if(derivate instanceof SingleRead){
+            SingleRead singleRead = (SingleRead)derivate;
             if(parentNode!=null && parentNode.getValue() instanceof Sequence){
                 Sequence sequence = (Sequence) parentNode.getValue();
-                label += sequence.getDnaMarker()!=null?sequence.getDnaMarker():"";
+                Identifier<DnaSample> currentSampleDesignation = getCurrentSampleDesignation(sequence);
+                if(currentSampleDesignation!=null){
+                    label = currentSampleDesignation.getIdentifier()+separator;
+                }
+                else{
+                    label += NO_SAMPLE_DESIGNATION+separator;
+                }
+                label += singleRead.getPrimer()!=null?singleRead.getPrimer().getLabel()+separator:emptyString;
+                if(sequence!=null){
+                    label += sequence.getDnaMarker()!=null?sequence.getDnaMarker():emptyString;
+                }
             }
         }
-        else if(element instanceof SpecimenOrObservationBase){
-            SpecimenOrObservationBase<?> derivate = (SpecimenOrObservationBase<?>) element;
-            SpecimenOrObservationType type = derivate.getRecordBasis();
-            return derivate.getTitleCache() + (type!=null?" ["+type.toString()+"]":"");
+        //SOOB
+        else if(derivate instanceof SpecimenOrObservationBase){
+            SpecimenOrObservationBase<?> specimen = (SpecimenOrObservationBase<?>) derivate;
+            SpecimenOrObservationType type = specimen.getRecordBasis();
+            return specimen.getTitleCache() + (type!=null?" ["+type.toString()+"]":emptyString);
         }
         if(label.isEmpty()){
-            label = element.toString();
+            label = derivate.toString();
         }
         //remove last comma
-        else if(label.endsWith(", ")){
-            label = label.substring(0, label.length()-2);
+        else if(label.endsWith(separator)){
+            label = label.substring(0, label.length()-separator.length());
         }
         return label;
     }
@@ -300,6 +341,31 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
         return super.getImage(element);
     }
 
+    public static Identifier<DnaSample> getCurrentSampleDesignation(CdmBase entity) {
+        if(entity instanceof DnaSample){
+            DnaSample dnaSample = (DnaSample)entity;
+            for (Identifier<DnaSample> identifier : dnaSample.getIdentifiers()) {
+                if(identifier.getType()!=null && identifier.getType().equals(DerivateLabelProvider.getSampleDesignationTerm())){
+                    //first sample designation is the current
+                    return identifier;
+                }
+            }
+        }
+        else if(entity instanceof Sequence){
+            Sequence sequence = (Sequence)entity;
+            //check if sequence has its own sample designation
+//            if(sequence.getSampleDesignation()){
+//
+//            }
+//            else
+            //if not take a look at the DnaSample
+                if(sequence.getDnaSample()!=null){
+                return getCurrentSampleDesignation(sequence.getDnaSample());
+            }
+        }
+        return null;
+    }
+
     /**
      * @param multiLinkSingleReads2
      */