Commit 76204594 authored by R.W.Majeed's avatar R.W.Majeed

time zone support for export

parent 76ba58c6
......@@ -2,6 +2,7 @@ package de.sekmi.histream.export;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
......@@ -35,6 +36,7 @@ public class TableExport {
private ExportErrorHandler errorHandler;
private int patientCount;
private int visitCount;
private ZoneId zoneId;
public TableExport(ExportDescriptor desc){
this.desc = desc;
......@@ -61,6 +63,13 @@ public class TableExport {
return xpath;
}
/**
* Set the zone id to use for timestamps
* @param zone
*/
public void setZoneId(ZoneId zoneId){
this.zoneId = zoneId;
}
/**
* Make sure, that any intersection between groups are empty.
* Overlapping group means concepts would get multiple classes
......@@ -126,6 +135,7 @@ public class TableExport {
FragmentExporter fe = null;
try{
fe = new FragmentExporter(createXPath(), desc, writer);
fe.setZoneId(zoneId);
fe.setErrorHandler(new ExportErrorHandler());
Streams.transfer(supplier, fe);
} catch (XMLStreamException | ParserConfigurationException e) {
......
......@@ -2,6 +2,7 @@ package de.sekmi.histream.export;
import java.io.IOException;
import java.io.InputStream;
import java.time.ZoneId;
import org.junit.Assert;
import org.junit.Before;
......@@ -35,7 +36,9 @@ public class TestExport {
FileObservationProviderTest t = new FileObservationProviderTest();
t.initializeObservationFactory();
try( ObservationSupplier s = t.getExampleSupplier() ){
export.setZoneId(ZoneId.of("Asia/Shanghai"));
export.export(s, m);
export.setZoneId(null);
}
// verify class lookup
Assert.assertEquals("T:type:str", m.get(MemoryExportWriter.VISIT_TABLE, "byclass", 0));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment