]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/db/TemplateAccount.java
methods for duplication of a template with its data
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / db / TemplateAccount.java
index 8651e3fee09ba66ac857788e30a62e0e04894e84..b17250917cac753d482d758f4b8c5abc13b9b336 100644 (file)
@@ -69,6 +69,20 @@ public class TemplateAccount extends TemplateBase {
         this.templateId = templateId;
         this.position = position;
     }
+    public TemplateAccount(TemplateAccount o) {
+        id = o.id;
+        templateId = o.templateId;
+        accountName = o.accountName;
+        position = o.position;
+        accountNameMatchGroup = o.accountNameMatchGroup;
+        currency = o.currency;
+        currencyMatchGroup = o.currencyMatchGroup;
+        amount = o.amount;
+        amountMatchGroup = o.amountMatchGroup;
+        accountComment = o.accountComment;
+        accountCommentMatchGroup = o.accountCommentMatchGroup;
+        negateAmount = o.negateAmount;
+    }
     public Long getId() {
         return id;
     }
@@ -146,4 +160,11 @@ public class TemplateAccount extends TemplateBase {
     public void setAccountCommentMatchGroup(Integer accountCommentMatchGroup) {
         this.accountCommentMatchGroup = accountCommentMatchGroup;
     }
+    public TemplateAccount createDuplicate() {
+        TemplateAccount dup = new TemplateAccount(this);
+        dup.id = null;
+        dup.templateId = null;
+
+        return dup;
+    }
 }