@Test public void shouldDeleteSyncError() throws Exception { saveRnRFormError(); Integer deletedSize = syncErrorsRepository.deleteBySyncTypeAndObjectId(SyncType.RnRForm, 1l); assertThat(deletedSize, is(2)); }
public Integer deleteBySyncTypeAndObjectId(final SyncType syncType, final long syncObjectId) { try { return dbUtil.withDao(SyncError.class, dao -> dao.delete(dao.queryBuilder() .orderBy("id", false) .where().eq("syncType", syncType) .and().eq("syncObjectId", syncObjectId).query())); } catch (LMISException e) { new LMISException(e,"SyncErrorsRepository.deleteBy").reportToFabric(); return null; } }
SyncErrorsRepository { public Integer deleteBySyncTypeAndObjectId(final SyncType syncType, final long syncObjectId) { try { return dbUtil.withDao(SyncError.class, dao -> dao.delete(dao.queryBuilder() .orderBy("id", false) .where().eq("syncType", syncType) .and().eq("syncObjectId", syncObjectId).query())); } catch (LMISException e) { new LMISException(e,"SyncErrorsRepository.deleteBy").reportToFabric(); return null; } } }
SyncErrorsRepository { public Integer deleteBySyncTypeAndObjectId(final SyncType syncType, final long syncObjectId) { try { return dbUtil.withDao(SyncError.class, dao -> dao.delete(dao.queryBuilder() .orderBy("id", false) .where().eq("syncType", syncType) .and().eq("syncObjectId", syncObjectId).query())); } catch (LMISException e) { new LMISException(e,"SyncErrorsRepository.deleteBy").reportToFabric(); return null; } } @Inject  SyncErrorsRepository(Context context); }
SyncErrorsRepository { public Integer deleteBySyncTypeAndObjectId(final SyncType syncType, final long syncObjectId) { try { return dbUtil.withDao(SyncError.class, dao -> dao.delete(dao.queryBuilder() .orderBy("id", false) .where().eq("syncType", syncType) .and().eq("syncObjectId", syncObjectId).query())); } catch (LMISException e) { new LMISException(e,"SyncErrorsRepository.deleteBy").reportToFabric(); return null; } } @Inject  SyncErrorsRepository(Context context); void save(final SyncError syncError); void delete(SyncError syncError); List<SyncError> getBySyncTypeAndObjectId(final SyncType syncType, final long syncObjectId); Integer deleteBySyncTypeAndObjectId(final SyncType syncType, final long syncObjectId); boolean hasSyncErrorOf(final SyncType syncType); }
SyncErrorsRepository { public Integer deleteBySyncTypeAndObjectId(final SyncType syncType, final long syncObjectId) { try { return dbUtil.withDao(SyncError.class, dao -> dao.delete(dao.queryBuilder() .orderBy("id", false) .where().eq("syncType", syncType) .and().eq("syncObjectId", syncObjectId).query())); } catch (LMISException e) { new LMISException(e,"SyncErrorsRepository.deleteBy").reportToFabric(); return null; } } @Inject  SyncErrorsRepository(Context context); void save(final SyncError syncError); void delete(SyncError syncError); List<SyncError> getBySyncTypeAndObjectId(final SyncType syncType, final long syncObjectId); Integer deleteBySyncTypeAndObjectId(final SyncType syncType, final long syncObjectId); boolean hasSyncErrorOf(final SyncType syncType);  }