2 * Copyright © 2021 Damyan Ivanov.
3 * This file is part of MoLe.
4 * MoLe is free software: you can distribute it and/or modify it
5 * under the term of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your opinion), any later version.
9 * MoLe is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License terms for details.
14 * You should have received a copy of the GNU General Public License
15 * along with MoLe. If not, see <https://www.gnu.org/licenses/>.
18 package net.ktnx.mobileledger.db;
20 import androidx.annotation.NonNull;
21 import androidx.annotation.Nullable;
22 import androidx.room.ColumnInfo;
23 import androidx.room.Entity;
24 import androidx.room.PrimaryKey;
26 import net.ktnx.mobileledger.utils.Misc;
28 import org.jetbrains.annotations.NotNull;
30 @Entity(tableName = "templates")
31 public class TemplateHeader extends TemplateBase {
32 @PrimaryKey(autoGenerate = true)
35 @ColumnInfo(name = "name")
39 @ColumnInfo(name = "regular_expression")
40 private String regularExpression;
41 @ColumnInfo(name = "test_text")
42 private String testText;
43 @ColumnInfo(name = "transaction_description")
44 private String transactionDescription;
45 @ColumnInfo(name = "transaction_description_match_group")
46 private Integer transactionDescriptionMatchGroup;
47 @ColumnInfo(name = "transaction_comment")
48 private String transactionComment;
49 @ColumnInfo(name = "transaction_comment_match_group")
50 private Integer transactionCommentMatchGroup;
51 @ColumnInfo(name = "date_year")
52 private Integer dateYear;
53 @ColumnInfo(name = "date_year_match_group")
54 private Integer dateYearMatchGroup;
55 @ColumnInfo(name = "date_month")
56 private Integer dateMonth;
57 @ColumnInfo(name = "date_month_match_group")
58 private Integer dateMonthMatchGroup;
59 @ColumnInfo(name = "date_day")
60 private Integer dateDay;
61 @ColumnInfo(name = "date_day_match_group")
62 private Integer dateDayMatchGroup;
63 public TemplateHeader(@NotNull Long id, @NonNull String name,
64 @NonNull String regularExpression) {
67 this.regularExpression = regularExpression;
69 public String getTestText() {
72 public void setTestText(String testText) {
73 this.testText = testText;
75 public Integer getTransactionDescriptionMatchGroup() {
76 return transactionDescriptionMatchGroup;
78 public void setTransactionDescriptionMatchGroup(Integer transactionDescriptionMatchGroup) {
79 this.transactionDescriptionMatchGroup = transactionDescriptionMatchGroup;
81 public Integer getTransactionCommentMatchGroup() {
82 return transactionCommentMatchGroup;
84 public void setTransactionCommentMatchGroup(Integer transactionCommentMatchGroup) {
85 this.transactionCommentMatchGroup = transactionCommentMatchGroup;
87 public Integer getDateYear() {
90 public void setDateYear(Integer dateYear) {
91 this.dateYear = dateYear;
93 public Integer getDateMonth() {
96 public void setDateMonth(Integer dateMonth) {
97 this.dateMonth = dateMonth;
99 public Integer getDateDay() {
102 public void setDateDay(Integer dateDay) {
103 this.dateDay = dateDay;
106 public Long getId() {
109 public void setId(@NonNull Long id) {
113 public String getName() {
116 public void setName(@NonNull String name) {
120 public String getRegularExpression() {
121 return regularExpression;
123 public void setRegularExpression(@NonNull String regularExpression) {
124 this.regularExpression = regularExpression;
126 public String getTransactionDescription() {
127 return transactionDescription;
129 public void setTransactionDescription(String transactionDescription) {
130 this.transactionDescription = transactionDescription;
132 public String getTransactionComment() {
133 return transactionComment;
135 public void setTransactionComment(String transactionComment) {
136 this.transactionComment = transactionComment;
138 public Integer getDateYearMatchGroup() {
139 return dateYearMatchGroup;
141 public void setDateYearMatchGroup(Integer dateYearMatchGroup) {
142 this.dateYearMatchGroup = dateYearMatchGroup;
144 public Integer getDateMonthMatchGroup() {
145 return dateMonthMatchGroup;
147 public void setDateMonthMatchGroup(Integer dateMonthMatchGroup) {
148 this.dateMonthMatchGroup = dateMonthMatchGroup;
150 public Integer getDateDayMatchGroup() {
151 return dateDayMatchGroup;
153 public void setDateDayMatchGroup(Integer dateDayMatchGroup) {
154 this.dateDayMatchGroup = dateDayMatchGroup;
157 public boolean equals(@Nullable Object obj) {
160 if (!(obj instanceof TemplateHeader))
163 TemplateHeader o = (TemplateHeader) obj;
165 return Misc.equalLongs(id, o.id) && Misc.equalStrings(name, o.name) &&
166 Misc.equalStrings(regularExpression, o.regularExpression) &&
167 Misc.equalStrings(transactionDescription, o.transactionDescription) &&
168 Misc.equalStrings(transactionComment, o.transactionComment) &&
169 Misc.equalIntegers(transactionDescriptionMatchGroup,
170 o.transactionDescriptionMatchGroup) &&
171 Misc.equalIntegers(transactionCommentMatchGroup, o.transactionCommentMatchGroup) &&
172 Misc.equalIntegers(dateDay, o.dateDay) &&
173 Misc.equalIntegers(dateDayMatchGroup, o.dateDayMatchGroup) &&
174 Misc.equalIntegers(dateMonth, o.dateMonth) &&
175 Misc.equalIntegers(dateMonthMatchGroup, o.dateMonthMatchGroup) &&
176 Misc.equalIntegers(dateYear, o.dateYear) &&
177 Misc.equalIntegers(dateYearMatchGroup, o.dateYearMatchGroup);