ref #7903: add comparator for taxa in cdm light configurator
[cdmlib.git] / cdmlib-io / src / main / java / eu / etaxonomy / cdm / io / cdmLight / CdmLightExportResultProcessor.java
index dfe765c299b0f856e81b6cbec332d5d599d4edc3..3899075959ebbb84d817858aeed8e199a9190754 100755 (executable)
@@ -17,12 +17,13 @@ import java.util.Map;
 
 import org.apache.commons.io.IOUtils;
 
+import eu.etaxonomy.cdm.io.common.ExportType;
 import eu.etaxonomy.cdm.model.common.ICdmBase;
 
 
 /**
  * @author k.luther
- * @date 16.03.2017
+ * @since 16.03.2017
  *
  */
 public class CdmLightExportResultProcessor {
@@ -79,6 +80,10 @@ public class CdmLightExportResultProcessor {
         }
     }
 
+    public  String[] getRecord(CdmLightExportTable table, String id){
+        return result.get(table).get(id);
+
+    }
 
     /**
      * @param table
@@ -86,7 +91,7 @@ public class CdmLightExportResultProcessor {
      * @param csvLine
      */
     public void put(CdmLightExportTable table, ICdmBase cdmBase, String[] csvLine) {
-       this.put(table, String.valueOf(cdmBase.getId()), csvLine);
+       this.put(table, cdmBase.getUuid().toString(), csvLine);
     }
 
 
@@ -96,6 +101,11 @@ public class CdmLightExportResultProcessor {
     public void createFinalResult(CdmLightExportState state) {
 
         if (!result.isEmpty() ){
+            state.setAuthorStore(new HashMap<>());
+            state.setHomotypicalGroupStore(new HashMap<>());
+            state.setReferenceStore(new HashMap<>());
+            state.setSpecimenStore(new HashMap<>());
+            state.setNodeChildrenMap(new HashMap<>());
             //Replace quotes by double quotes
             for (CdmLightExportTable table: result.keySet()){
                 //schreibe jede Tabelle in einen Stream...
@@ -125,6 +135,7 @@ public class CdmLightExportResultProcessor {
                 }
 
                 state.getResult().putExportData(table.getTableName(), exportStream.toByteArray());
+                state.getResult().setExportType(ExportType.CDM_LIGHT);
 
             }
         }