]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/db/TemplateHeader.java
methods for duplication of a template with its data
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / db / TemplateHeader.java
index 5422767f9e74d01ffbedb63059263692da8f66c7..6f8e25df384725c28569a9a56a6c54215763c1f4 100644 (file)
@@ -66,6 +66,22 @@ public class TemplateHeader extends TemplateBase {
         this.name = name;
         this.regularExpression = regularExpression;
     }
+    public TemplateHeader(TemplateHeader origin) {
+        id = origin.id;
+        name = origin.name;
+        regularExpression = origin.regularExpression;
+        testText = origin.testText;
+        transactionDescription = origin.transactionDescription;
+        transactionDescriptionMatchGroup = origin.transactionDescriptionMatchGroup;
+        transactionComment = origin.transactionComment;
+        transactionCommentMatchGroup = origin.transactionCommentMatchGroup;
+        dateYear = origin.dateYear;
+        dateYearMatchGroup = origin.dateYearMatchGroup;
+        dateMonth = origin.dateMonth;
+        dateMonthMatchGroup = origin.dateMonthMatchGroup;
+        dateDay = origin.dateDay;
+        dateDayMatchGroup = origin.dateDayMatchGroup;
+    }
     public String getTestText() {
         return testText;
     }
@@ -176,4 +192,10 @@ public class TemplateHeader extends TemplateBase {
                Misc.equalIntegers(dateYear, o.dateYear) &&
                Misc.equalIntegers(dateYearMatchGroup, o.dateYearMatchGroup);
     }
+    public TemplateHeader createDuplicate() {
+        TemplateHeader dup = new TemplateHeader(this);
+        dup.id = null;
+
+        return dup;
+    }
 }