]> git.ktnx.net Git - mobile-ledger.git/commitdiff
machinery for loading transaction by profile and ID
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 9 Feb 2019 21:07:42 +0000 (23:07 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 9 Feb 2019 21:07:42 +0000 (23:07 +0200)
app/src/main/java/net/ktnx/mobileledger/model/LedgerTransaction.java
app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java

index 229fb9d00f827a1202981af7084b72c9382d4b34..fd2a8407dfca79910216bc3191ed692d3661f956 100644 (file)
@@ -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<LedgerTransactionAccount> getAccounts() {
         return accounts;
     }
index 40e17fbdfecf955263fd256fe5456e04f6b21d28..bb3f20a47df588610c24dc535971da63a83e51f2 100644 (file)
@@ -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;
+    }
 }