Commit c27abafc authored by Marco Descher's avatar Marco Descher
Browse files

wip

parent db11ec29
......@@ -10,6 +10,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
import org.slf4j.Logger;
import ch.elexis.core.model.IOrganization;
......@@ -24,6 +25,9 @@ public class MediportInsurerImporter implements MisthiosTask {
public MisthiosTaskResult run(Map<String, Object> context) {
IModelService coreModelService = (IModelService) context.get("coreModelService");
Logger logger = (Logger) context.get("logger");
IProgressMonitor monitor = (IProgressMonitor) context.get("monitor");
monitor.beginTask("Importiere MediData Versichererliste", IProgressMonitor.UNKNOWN);
URL sourceFile;
try {
......@@ -32,12 +36,12 @@ public class MediportInsurerImporter implements MisthiosTask {
return MisthiosTaskResult.ERROR(e1);
}
try (InputStream is = sourceFile.openStream()) {
importCSVFromStream(coreModelService, logger, is);
importCSVFromStream(coreModelService, logger, monitor, is);
monitor.done();
return MisthiosTaskResult.OK();
} catch (IOException e) {
return MisthiosTaskResult.ERROR(e);
}
return null;
}
private static final String SEPARATOR = ";";
......@@ -61,7 +65,7 @@ public class MediportInsurerImporter implements MisthiosTask {
private static final int IDX_MEDIPORT_SUPPORT = 15;
public static List<IOrganization> importCSVFromStream(IModelService coreModelService, Logger logger,
InputStream csvInStream) {
IProgressMonitor monitor, InputStream csvInStream) {
List<IOrganization> insurerList = new ArrayList<IOrganization>();
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(csvInStream));
......@@ -131,6 +135,7 @@ public class MediportInsurerImporter implements MisthiosTask {
// insurer.setSupportsMediport(MEDIPORT_CONNECTED.equalsIgnoreCase(mediport));
insurerList.add(insurer);
monitor.worked(1);
}
reader.close();
} catch (Exception e) {
......
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