]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/db/Transaction.java
Transaction: when copying, use proper descriptionUpper member
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / db / Transaction.java
index 05e63d8c0e92dd05c3db2aa48603a65159d5cd6e..8b98f923b65f1d698525f7f088f8a04a2b501499 100644 (file)
@@ -61,10 +61,20 @@ public class Transaction {
     @ColumnInfo(collate = ColumnInfo.NOCASE)
     @NonNull
     private String description;
+    @ColumnInfo(name = "description_uc")
+    @NonNull
+    private String descriptionUpper;
     @ColumnInfo
     private String comment;
     @ColumnInfo
-    private int generation = 0;
+    private long generation = 0;
+    @NonNull
+    public String getDescriptionUpper() {
+        return descriptionUpper;
+    }
+    public void setDescriptionUpper(@NonNull String descriptionUpper) {
+        this.descriptionUpper = descriptionUpper;
+    }
     public long getLedgerId() {
         return ledgerId;
     }
@@ -112,6 +122,7 @@ public class Transaction {
     }
     public void setDescription(String description) {
         this.description = description;
+        setDescriptionUpper(description.toUpperCase());
     }
     public String getComment() {
         return comment;
@@ -119,11 +130,24 @@ public class Transaction {
     public void setComment(String comment) {
         this.comment = comment;
     }
-    public int getGeneration() {
+    public long getGeneration() {
         return generation;
     }
-    public void setGeneration(int generation) {
+    public void setGeneration(long generation) {
         this.generation = generation;
     }
 
+    public void copyDataFrom(Transaction o) {
+        // id = o.id;
+        ledgerId = o.ledgerId;
+        profileId = o.profileId;
+        dataHash = o.dataHash;
+        year = o.year;
+        month = o.month;
+        day = o.day;
+        description = o.description;
+        descriptionUpper = o.description.toUpperCase();
+        comment = o.comment;
+        generation = o.generation;
+    }
 }