From a1626c1bb2d3cb1a7b3be45ffeb4ff616a93e870 Mon Sep 17 00:00:00 2001 From: JeanGarf Date: Sat, 13 Jun 2020 18:32:10 +0200 Subject: [PATCH] #876 - Rename mTransactionsAdapter into mTransactionsDbAdapter --- .../android/db/adapter/AccountsDbAdapter.java | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/org/gnucash/android/db/adapter/AccountsDbAdapter.java b/app/src/main/java/org/gnucash/android/db/adapter/AccountsDbAdapter.java index 2a67184e0..c5a950e1a 100644 --- a/app/src/main/java/org/gnucash/android/db/adapter/AccountsDbAdapter.java +++ b/app/src/main/java/org/gnucash/android/db/adapter/AccountsDbAdapter.java @@ -74,7 +74,7 @@ public class AccountsDbAdapter extends DatabaseAdapter { /** * Transactions database adapter for manipulating transactions associated with accounts */ - private final TransactionsDbAdapter mTransactionsAdapter; + private final TransactionsDbAdapter mTransactionsDbAdapter; /** * Commodities database adapter for commodity manipulation @@ -101,7 +101,7 @@ public AccountsDbAdapter(SQLiteDatabase db, TransactionsDbAdapter transactionsDb AccountEntry.COLUMN_PARENT_ACCOUNT_UID, AccountEntry.COLUMN_DEFAULT_TRANSFER_ACCOUNT_UID }); - mTransactionsAdapter = transactionsDbAdapter; + mTransactionsDbAdapter = transactionsDbAdapter; mCommoditiesDbAdapter = new CommoditiesDbAdapter(db); } @@ -129,7 +129,7 @@ public AccountsDbAdapter(SQLiteDatabase db){ AccountEntry.COLUMN_DEFAULT_TRANSFER_ACCOUNT_UID }); - mTransactionsAdapter = new TransactionsDbAdapter(db, new SplitsDbAdapter(db)); + mTransactionsDbAdapter = new TransactionsDbAdapter(db, new SplitsDbAdapter(db)); mCommoditiesDbAdapter = new CommoditiesDbAdapter(db); } @@ -150,7 +150,7 @@ public static AccountsDbAdapter getInstance(){ public void addRecord(@NonNull Account account, UpdateMethod updateMethod){ Log.d(LOG_TAG, "Replace account to db"); //in-case the account already existed, we want to update the templates based on it as well - List templateTransactions = mTransactionsAdapter.getScheduledTransactionsForAccount(account.getUID()); + List templateTransactions = mTransactionsDbAdapter.getScheduledTransactionsForAccount(account.getUID()); super.addRecord(account, updateMethod); String accountUID = account.getUID(); //now add transactions if there are any @@ -159,10 +159,10 @@ public void addRecord(@NonNull Account account, UpdateMethod updateMethod){ updateRecord(accountUID, AccountEntry.COLUMN_FULL_NAME, getFullyQualifiedAccountName(accountUID)); for (Transaction t : account.getTransactions()) { t.setCommodity(account.getCommodity()); - mTransactionsAdapter.addRecord(t, updateMethod); + mTransactionsDbAdapter.addRecord(t, updateMethod); } for (Transaction transaction : templateTransactions) { - mTransactionsAdapter.addRecord(transaction, UpdateMethod.update); + mTransactionsDbAdapter.addRecord(transaction, UpdateMethod.update); } } } @@ -187,12 +187,12 @@ public long bulkAddRecords(@NonNull List accountList, UpdateMethod upda List transactionList = new ArrayList<>(accountList.size()*2); for (Account account : accountList) { transactionList.addAll(account.getTransactions()); - transactionList.addAll(mTransactionsAdapter.getScheduledTransactionsForAccount(account.getUID())); + transactionList.addAll(mTransactionsDbAdapter.getScheduledTransactionsForAccount(account.getUID())); } long nRow = super.bulkAddRecords(accountList, updateMethod); if (nRow > 0 && !transactionList.isEmpty()){ - mTransactionsAdapter.bulkAddRecords(transactionList, updateMethod); + mTransactionsDbAdapter.bulkAddRecords(transactionList, updateMethod); } return nRow; } @@ -374,7 +374,7 @@ public boolean recursiveDeleteAccount(long accountId){ try { descendantAccountUIDs.add(accountUID); //add account to descendants list just for convenience for (String descendantAccountUID : descendantAccountUIDs) { - mTransactionsAdapter.deleteTransactionsForAccount(descendantAccountUID); + mTransactionsDbAdapter.deleteTransactionsForAccount(descendantAccountUID); } String accountUIDList = "'" + TextUtils.join("','", descendantAccountUIDs) + "'"; @@ -413,7 +413,7 @@ public boolean recursiveDeleteAccount(long accountId){ @Override public Account buildModelInstance(@NonNull final Cursor c){ Account account = buildSimpleAccountInstance(c); - account.setTransactions(mTransactionsAdapter.getAllTransactionsForAccount(account.getUID())); + account.setTransactions(mTransactionsDbAdapter.getAllTransactionsForAccount(account.getUID())); return account; } @@ -801,7 +801,7 @@ public Money getAccountBalance(AccountType accountType, long startTimestamp, lon String currencyCode = GnuCashApplication.getDefaultCurrencyCode(); Log.d(LOG_TAG, "all account list : " + accountUidList.size()); - SplitsDbAdapter splitsDbAdapter = mTransactionsAdapter.getSplitDbAdapter(); + SplitsDbAdapter splitsDbAdapter = mTransactionsDbAdapter.getSplitDbAdapter(); return (startTimestamp == -1 && endTimestamp == -1) ? splitsDbAdapter.computeSplitBalance(accountUidList, currencyCode, hasDebitNormalBalance) @@ -825,7 +825,7 @@ public Money getAccountBalance(List accountTypes, long start, long private Money computeBalance(String accountUID, long startTimestamp, long endTimestamp) { Log.d(LOG_TAG, "Computing account balance for account ID " + accountUID); - String currencyCode = mTransactionsAdapter.getAccountCurrencyCode(accountUID); + String currencyCode = mTransactionsDbAdapter.getAccountCurrencyCode(accountUID); boolean hasDebitNormalBalance = getAccountType(accountUID).hasDebitNormalBalance(); List accountsList = getDescendantAccountUIDs(accountUID, @@ -834,7 +834,7 @@ private Money computeBalance(String accountUID, long startTimestamp, long endTim accountsList.add(0, accountUID); Log.d(LOG_TAG, "all account list : " + accountsList.size()); - SplitsDbAdapter splitsDbAdapter = mTransactionsAdapter.getSplitDbAdapter(); + SplitsDbAdapter splitsDbAdapter = mTransactionsDbAdapter.getSplitDbAdapter(); return (startTimestamp == -1 && endTimestamp == -1) ? splitsDbAdapter.computeSplitBalance(accountsList, currencyCode, hasDebitNormalBalance) : splitsDbAdapter.computeSplitBalance(accountsList, currencyCode, hasDebitNormalBalance, startTimestamp, endTimestamp); @@ -858,7 +858,7 @@ public Money getAccountsBalance(@NonNull List accountUIDList, long star boolean hasDebitNormalBalance = getAccountType(accountUIDList.get(0)).hasDebitNormalBalance(); - SplitsDbAdapter splitsDbAdapter = mTransactionsAdapter.getSplitDbAdapter(); + SplitsDbAdapter splitsDbAdapter = mTransactionsDbAdapter.getSplitDbAdapter(); Money splitSum = (startTimestamp == -1 && endTimestamp == -1) ? splitsDbAdapter.computeSplitBalance(accountUIDList, currencyCode, hasDebitNormalBalance) : splitsDbAdapter.computeSplitBalance(accountUIDList, currencyCode, hasDebitNormalBalance, startTimestamp, endTimestamp); @@ -1145,7 +1145,7 @@ public List getAllOpeningBalanceTransactions(){ Cursor cursor = fetchAccounts(null, null, null); List openingTransactions = new ArrayList<>(); try { - SplitsDbAdapter splitsDbAdapter = mTransactionsAdapter.getSplitDbAdapter(); + SplitsDbAdapter splitsDbAdapter = mTransactionsDbAdapter.getSplitDbAdapter(); while (cursor.moveToNext()) { long id = cursor.getLong(cursor.getColumnIndexOrThrow(AccountEntry._ID)); String accountUID = getUID(id);