From: Damyan Ivanov Date: Fri, 23 Apr 2021 04:59:53 +0000 (+0000) Subject: put all the annotated abstract DAO methods in the beginning X-Git-Tag: v0.18.0~44 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=d3a26723c8dd18dc6a27084c227e652d6cb78424;p=mobile-ledger.git put all the annotated abstract DAO methods in the beginning --- diff --git a/app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java b/app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java index 9012d489..31319f34 100644 --- a/app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java +++ b/app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java @@ -114,13 +114,6 @@ public abstract class TransactionDAO extends BaseDAO { public abstract List getAllWithAccountsFilteredSync(long profileId, String accountName); - public long getGenerationSync(long profileId) { - TransactionGenerationContainer result = getGenerationPOJOSync(profileId); - - if (result == null) - return 0; - return result.generation; - } @Query("DELETE FROM transactions WHERE profile_id = :profileId AND generation <> " + ":currentGeneration") public abstract int purgeOldTransactionsSync(long profileId, long currentGeneration); @@ -129,6 +122,19 @@ public abstract class TransactionDAO extends BaseDAO { ".id=transaction_accounts.transaction_id AND tr.profile_id=:profileId) AND generation " + "<> :currentGeneration") public abstract int purgeOldTransactionAccountsSync(long profileId, long currentGeneration); + + @Query("DELETE FROM transactions WHERE profile_id = :profileId") + public abstract int deleteAllSync(long profileId); + + @Query("SELECT * FROM transactions where profile_id = :profileId AND ledger_id = :ledgerId") + public abstract Transaction getByLedgerId(long profileId, long ledgerId); + public long getGenerationSync(long profileId) { + TransactionGenerationContainer result = getGenerationPOJOSync(profileId); + + if (result == null) + return 0; + return result.generation; + } public void storeTransactionsSync(List list, long profileId) { long generation = getGenerationSync(profileId) + 1; @@ -147,8 +153,6 @@ public abstract class TransactionDAO extends BaseDAO { Logger.debug("Transaction", String.format(Locale.ROOT, "Purged %d transaction accounts", removed)); } - @Query("DELETE FROM transactions WHERE profile_id = :profileId") - public abstract int deleteAllSync(long profileId); private void storeSync(TransactionWithAccounts rec) { TransactionAccountDAO trAccDao = DB.get() .getTransactionAccountDAO(); @@ -176,8 +180,6 @@ public abstract class TransactionDAO extends BaseDAO { trAcc.setId(trAccDao.insertSync(trAcc)); } } - @Query("SELECT * FROM transactions where profile_id = :profileId AND ledger_id = :ledgerId") - public abstract Transaction getByLedgerId(long profileId, long ledgerId); static class TransactionGenerationContainer { @ColumnInfo long generation;