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 229fb9d..fd2a840 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 40e17fb..bb3f20a 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;
+    }
 }