From 00a1049ca910c976363fd1c2f6304d4512cfcedb Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sat, 9 Feb 2019 23:07:42 +0200 Subject: [PATCH] machinery for loading transaction by profile and ID --- .../net/ktnx/mobileledger/model/LedgerTransaction.java | 9 +++++++++ .../net/ktnx/mobileledger/model/MobileLedgerProfile.java | 6 ++++++ 2 files changed, 15 insertions(+) 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; + } } -- 2.39.2