@Override public Motherboard update(Motherboard entity) { open(); ContentValues values = new ContentValues(); values.put(COLUMN_ID, entity.getId()); values.put(COLUMN_CODE, entity.getCode()); values.put(COLUMN_DESCRIPTION, entity.getDescription()); values.put(COLUMN_CHIPSET, entity.getChipset()); values.put(COLUMN_SATA_PORTS, entity.getSataPorts()); values.put(COLUMN_USB_2, entity.getUsb2()); values.put(COLUMN_USB_3, entity.getUsb3()); values.put(COLUMN_FORM_FACTOR, entity.getFormFactor()); values.put(COLUMN_STOCK, entity.getStock()); values.put(COLUMN_ACTIVE, entity.isActive()); db.update( TABLE_NAME, values, COLUMN_ID + " =? ", new String[] {String.valueOf(entity.getId())}); return entity; }
@Override public Motherboard save(Motherboard entity) { open(); ContentValues values = new ContentValues(); values.put(COLUMN_ID, entity.getId()); values.put(COLUMN_CODE, entity.getCode()); values.put(COLUMN_DESCRIPTION, entity.getDescription()); values.put(COLUMN_CHIPSET, entity.getChipset()); values.put(COLUMN_SATA_PORTS, entity.getSataPorts()); values.put(COLUMN_USB_2, entity.getUsb2()); values.put(COLUMN_USB_3, entity.getUsb3()); values.put(COLUMN_FORM_FACTOR, entity.getFormFactor()); values.put(COLUMN_STOCK, entity.getStock()); values.put(COLUMN_ACTIVE, entity.isActive()); long id = db.insertOrThrow(TABLE_NAME, null, values); Motherboard insertedEntity = new Motherboard.Builder().copy(entity).id(new Long(id)).build(); return insertedEntity; }
@Override public Motherboard delete(Motherboard entity) { open(); db.delete(TABLE_NAME, COLUMN_ID + " =? ", new String[] {String.valueOf(entity.getId())}); return entity; }