private AlarmModel getValues(LinkedHashMap<String, Column> m) { AlarmModel entry = new AlarmModel(); entry.setId((Integer) m.get(KEY).getData()); entry.setAlarmID((Integer) m.get(ALARM_ID).getData()); entry.setType((String) m.get(TYPE).getData()); entry.setTrigger((String) m.get(TRIGGER).getData()); entry.setLevel((String) m.get(LEVEL).getData()); entry.setExtraParameter((String) m.get(EXTRA_PARAMETER).getData()); entry.setExtraValue((String) m.get(EXTRA_VALUE).getData()); entry.setAlarmTime((String) m.get(ALARM_TIME).getData()); entry.setAlarmDate((String) m.get(ALARM_DATE).getData()); return entry; }
private List<Column> putValues(AlarmModel entry) { List<Column> newList = new ArrayList<>(); newList.add(withValue(KEY, entry.getId())); newList.add(withValue(ALARM_ID, entry.getAlarmID())); newList.add(withValue(TYPE, entry.getType())); newList.add(withValue(TRIGGER, entry.getTrigger())); newList.add(withValue(LEVEL, entry.getLevel())); newList.add(withValue(EXTRA_PARAMETER, entry.getExtraParameter())); newList.add(withValue(EXTRA_VALUE, entry.getExtraValue())); newList.add(withValue(ALARM_TIME, entry.getAlarmTime())); newList.add(withValue(ALARM_DATE, entry.getAlarmDate())); return newList; }
// Deleting single entry public void delete(AlarmModel entry) { alarmTable.delete(KEY, entry.getId()); database.closeDatabase(); }