org.hwo.pulscounter/src/org/hwo/pulscounter/ui/BatchRunner.java

58 lines
1.3 KiB
Java
Raw Normal View History

2016-09-06 16:49:11 +02:00
package org.hwo.pulscounter.ui;
import org.hwo.pulscounter.ExportSetting;
2016-09-08 18:47:31 +02:00
import org.hwo.pulscounter.PulsCounterApplication;
2016-09-06 16:49:11 +02:00
import org.hwo.pulscounter.PulsCounterApplicationListener;
import org.hwo.servicelink.ServiceLinkException;
2016-10-26 19:21:57 +02:00
import static org.hwo.logging.Logging.*;
import static org.hwo.logging.LogLevel.*;
2016-09-06 16:49:11 +02:00
public class BatchRunner implements PulsCounterApplicationListener{
2016-09-08 18:47:31 +02:00
private PulsCounterApplication pulsCounterApplication;
2016-09-06 16:49:11 +02:00
2016-09-08 18:47:31 +02:00
public BatchRunner(PulsCounterApplication pulsCounterApplication){
this.pulsCounterApplication = pulsCounterApplication;
pulsCounterApplication.addPulsCounterApplicationListener(this);
2016-10-26 19:21:57 +02:00
try {
run();
} catch (Exception e){
log(e);
}
2016-09-06 16:49:11 +02:00
2016-10-26 19:21:57 +02:00
pulsCounterApplication.notifyUiIsFinished(true);
2016-09-06 16:49:11 +02:00
}
public void run(){
2016-10-26 19:21:57 +02:00
PulsCounterApplication.getApplication().checkForSnapShots();
for (ExportSetting es: PulsCounterApplication.getApplication().getExportSettings()){
if (es.getAutostart()){
es.export();
2016-09-06 16:49:11 +02:00
}
}
2016-10-26 19:21:57 +02:00
2016-09-08 18:47:31 +02:00
pulsCounterApplication.notifyUiIsFinished(false);
2016-09-06 16:49:11 +02:00
}
@Override
public void messageArrived(String message) {
}
2016-09-08 18:47:31 +02:00
@Override
public void interfaceClassesChanged(PulsCounterApplication pulsCounterApplication) {
}
@Override
public void interfacesChanged(PulsCounterApplication pulsCounterApplication) {
}
2016-09-06 16:49:11 +02:00
}