ref #7095 Refactor RowWrapper
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / workingSet / matrix / RowWrapper.java
index 4f2cbffe0e92802e73ede4b88efeb20fda9a9858..f3956ec2997af8ea935543672ea03b3647f66916 100644 (file)
@@ -22,12 +22,14 @@ import eu.etaxonomy.cdm.model.description.Feature;
 import eu.etaxonomy.cdm.model.description.QuantitativeData;
 import eu.etaxonomy.cdm.model.description.SpecimenDescription;
 import eu.etaxonomy.cdm.model.description.State;
+import eu.etaxonomy.cdm.model.description.WorkingSet;
 import eu.etaxonomy.cdm.model.location.NamedArea;
 import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
 import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
@@ -43,13 +45,13 @@ public class RowWrapper {
 
     private SpecimenDescription description;
 
-    private Taxon associatedTaxon;
+    private TaxonNode taxonNode;
     private FieldUnit fieldUnit;
     private String identifier;
     private NamedArea country;
     private Map<Feature, DescriptionElementBase> featureToElementMap = new HashMap<>();
 
-    public RowWrapper(SpecimenDescription description) {
+    public RowWrapper(SpecimenDescription description, WorkingSet workingSet) {
         this.description = description;
 
         IOccurrenceService occurrenceService = CdmStore.getService(IOccurrenceService.class);
@@ -59,7 +61,7 @@ public class RowWrapper {
             Collection<TaxonBase<?>> associatedTaxa = occurrenceService.listAssociatedTaxa(specimen, null, null, null, null);
             if(associatedTaxa!=null){
                 //FIXME: what about multiple associated taxa
-                associatedTaxon = (Taxon) associatedTaxa.iterator().next();
+                taxonNode = ((Taxon) associatedTaxa.iterator().next()).getTaxonNode(MatrixUtility.getClassificationForWorkingSet(workingSet));
             }
             Collection<FieldUnit> fieldUnits = occurrenceService.getFieldUnits(specimen.getUuid());
             if(fieldUnits.size()!=1){
@@ -101,8 +103,8 @@ public class RowWrapper {
         return description;
     }
 
-    public Taxon getAssociatedTaxon() {
-        return associatedTaxon;
+    public TaxonNode getTaxonNode() {
+        return taxonNode;
     }
 
     public FieldUnit getFieldUnit() {