From: Damyan Ivanov Date: Sat, 9 Feb 2019 21:07:42 +0000 (+0200) Subject: machinery for loading transaction by profile and ID X-Git-Tag: v0.6~5 X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=commitdiff_plain;h=00a1049ca910c976363fd1c2f6304d4512cfcedb machinery for loading transaction by profile and ID --- diff --git a/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransaction.java b/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransaction.java index 229fb9d0..fd2a8407 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransaction.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/LedgerTransaction.java @@ -70,6 +70,15 @@ public class LedgerTransaction { public LedgerTransaction(int id) { this(id, (Date) null, null); } + public LedgerTransaction(int id, String profileUUID) { + this.profile = profileUUID; + this.id = id; + this.date = null; + this.description = null; + this.accounts = new ArrayList<>(); + this.dataHash = null; + this.dataLoaded = false; + } public ArrayList getAccounts() { return accounts; } diff --git a/app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java b/app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java index 40e17fbd..bb3f20a4 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java @@ -277,4 +277,10 @@ public final class MobileLedgerProfile { return null; } + public LedgerTransaction loadTransaction(int transactionId) { + LedgerTransaction tr = new LedgerTransaction(transactionId, this.uuid); + tr.loadData(MLDB.getReadableDatabase()); + + return tr; + } }