package org.hwo.pulscounter.ui; import org.hwo.pulscounter.ExportSetting; import org.hwo.pulscounter.PulsCounterApplication; import org.hwo.pulscounter.PulsCounterApplicationListener; import org.hwo.servicelink.ServiceLinkException; import static org.hwo.logging.Logging.*; import static org.hwo.logging.LogLevel.*; public class BatchRunner implements PulsCounterApplicationListener{ private PulsCounterApplication pulsCounterApplication; public BatchRunner(PulsCounterApplication pulsCounterApplication){ this.pulsCounterApplication = pulsCounterApplication; pulsCounterApplication.addPulsCounterApplicationListener(this); try { run(); } catch (Exception e){ log(e); } pulsCounterApplication.notifyUiIsFinished(true); } public void run(){ PulsCounterApplication.getApplication().checkForSnapShots(); for (ExportSetting es: PulsCounterApplication.getApplication().getExportSettings()){ if (es.getAutostart()){ es.export(); } } pulsCounterApplication.notifyUiIsFinished(false); } @Override public void messageArrived(String message) { } @Override public void interfaceClassesChanged(PulsCounterApplication pulsCounterApplication) { } @Override public void interfacesChanged(PulsCounterApplication pulsCounterApplication) { } }