package info.nightscout.androidaps.db; import com.j256.ormlite.dao.CloseableIterator; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.sql.SQLException; import java.util.List; import javax.inject.Inject; import javax.inject.Singleton; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.interfaces.DatabaseHelperInterface; @Singleton public class DatabaseHelperProvider implements DatabaseHelperInterface { @Inject DatabaseHelperProvider() { } @NotNull @Override public List getAllBgreadingsDataFromTime(long mills, boolean ascending) { return MainApp.getDbHelper().getAllBgreadingsDataFromTime(mills, ascending); } @Override public void createOrUpdate(@NotNull CareportalEvent careportalEvent) { MainApp.getDbHelper().createOrUpdate(careportalEvent); } @Override public void createOrUpdate(@NotNull DanaRHistoryRecord record) { MainApp.getDbHelper().createOrUpdate(record); } @Override public void createOrUpdate(@NotNull OmnipodHistoryRecord record) { MainApp.getDbHelper().createOrUpdate(record); } @NotNull @Override public List getDanaRHistoryRecordsByType(byte type) { return MainApp.getDbHelper().getDanaRHistoryRecordsByType(type); } @NotNull @Override public List getTDDs() { return MainApp.getDbHelper().getTDDs(); } @Override public long size(@NotNull String table) { return MainApp.getDbHelper().size(table); } @Override public void create(@NotNull DbRequest record) { try { MainApp.getDbHelper().create(record); } catch (SQLException e) { e.printStackTrace(); } } @Override public void deleteAllDbRequests() { MainApp.getDbHelper().deleteAllDbRequests(); } @Override public int deleteDbRequest(@NotNull String id) { return MainApp.getDbHelper().deleteDbRequest(id); } @Override public void deleteDbRequestbyMongoId(@NotNull String action, @NotNull String _id) { MainApp.getDbHelper().deleteDbRequestbyMongoId(action, _id); } @NotNull @Override public CloseableIterator getDbRequestInterator() { return MainApp.getDbHelper().getDbRequestInterator(); } @Override public long roundDateToSec(long date) { return MainApp.getDbHelper().roundDateToSec(date); } @Override public void createOrUpdateTDD(@NotNull TDD record) { MainApp.getDbHelper().createOrUpdateTDD(record); } @Override public void createOrUpdate(@NotNull TemporaryBasal tempBasal) { MainApp.getDbHelper().createOrUpdate(tempBasal); } @NotNull @Override public TemporaryBasal findTempBasalByPumpId(long id) { return MainApp.getDbHelper().findTempBasalByPumpId(id); } @NotNull @Override public List getTemporaryBasalsDataFromTime(long mills, boolean ascending) { return MainApp.getDbHelper().getTemporaryBasalsDataFromTime(mills, ascending); } @Override public CareportalEvent getCareportalEventFromTimestamp(long timestamp) { return MainApp.getDbHelper().getCareportalEventFromTimestamp(timestamp); } @NotNull @Override public List getAllOmnipodHistoryRecordsFromTimestamp(long timestamp, boolean ascending) { return MainApp.getDbHelper().getAllOmnipodHistoryRecordsFromTimeStamp(timestamp, ascending); } @Nullable @Override public OmnipodHistoryRecord findOmnipodHistoryRecordByPumpId(long pumpId) { return MainApp.getDbHelper().findOmnipodHistoryRecordByPumpId(pumpId); } @NotNull @Override public List getTDDsForLastXDays(int days) { return MainApp.getDbHelper().getTDDsForLastXDays(days); } @NotNull @Override public List getProfileSwitchData(long from, boolean ascending) { return MainApp.getDbHelper().getProfileSwitchData(from, ascending); } }