]> git.ktnx.net Git - mobile-ledger.git/blob - app/src/main/java/net/ktnx/mobileledger/db/TemplateAccount.java
rename Patterns to Templates
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / db / TemplateAccount.java
1 /*
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.
8  *
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.
13  *
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/>.
16  */
17
18 package net.ktnx.mobileledger.db;
19
20 import androidx.annotation.NonNull;
21 import androidx.room.ColumnInfo;
22 import androidx.room.Entity;
23 import androidx.room.ForeignKey;
24 import androidx.room.Index;
25 import androidx.room.PrimaryKey;
26
27 import org.jetbrains.annotations.NotNull;
28
29 @Entity(tableName = "template_accounts",
30         indices = {@Index(name = "fk_template_accounts_template", value = "template_id"),
31                    @Index(name = "fk_template_accounts_currency", value = "currency")
32         }, foreignKeys = {@ForeignKey(childColumns = "template_id", parentColumns = "id",
33                                       entity = TemplateHeader.class),
34                           @ForeignKey(childColumns = "currency", parentColumns = "id",
35                                       entity = Currency.class)
36 })
37 public class TemplateAccount extends TemplateBase {
38     @PrimaryKey(autoGenerate = true)
39     @NotNull
40     private Long id;
41     @NonNull
42     @ColumnInfo(name = "template_id")
43     private Long templateId;
44     @ColumnInfo(name = "acc")
45     private String accountName;
46     @ColumnInfo(name = "position")
47     @NonNull
48     private Long position;
49     @ColumnInfo(name = "acc_match_group")
50     private Integer accountNameMatchGroup;
51     @ColumnInfo(name = "currency")
52     private Integer currency;
53     @ColumnInfo(name = "currency_match_group")
54     private Integer currencyMatchGroup;
55     @ColumnInfo(name = "amount")
56     private Float amount;
57     @ColumnInfo(name = "amount_match_group")
58     private Integer amountMatchGroup;
59     @ColumnInfo(name = "comment")
60     private String accountComment;
61     @ColumnInfo(name = "comment_match_group")
62     private Integer accountCommentMatchGroup;
63     @ColumnInfo(name = "negate_amount")
64     private Boolean negateAmount;
65     public TemplateAccount(@NotNull Long id, @NonNull Long templateId, @NonNull Long position) {
66         this.id = id;
67         this.templateId = templateId;
68         this.position = position;
69     }
70     public Long getId() {
71         return id;
72     }
73     public void setId(Long id) {
74         this.id = id;
75     }
76     public Boolean getNegateAmount() {
77         return negateAmount;
78     }
79     public void setNegateAmount(Boolean negateAmount) {
80         this.negateAmount = negateAmount;
81     }
82     public @NotNull Long getTemplateId() {
83         return templateId;
84     }
85     public void setTemplateId(@NonNull Long templateId) {
86         this.templateId = templateId;
87     }
88     @NonNull
89     public String getAccountName() {
90         return accountName;
91     }
92     public void setAccountName(@NonNull String accountName) {
93         this.accountName = accountName;
94     }
95     @NonNull
96     public Long getPosition() {
97         return position;
98     }
99     public void setPosition(@NonNull Long position) {
100         this.position = position;
101     }
102     public void setPosition(int position) {
103         this.position = (long) position;
104     }
105     public Integer getAccountNameMatchGroup() {
106         return accountNameMatchGroup;
107     }
108     public void setAccountNameMatchGroup(Integer accountNameMatchGroup) {
109         this.accountNameMatchGroup = accountNameMatchGroup;
110     }
111     public Integer getCurrency() {
112         return currency;
113     }
114     public void setCurrency(Integer currency) {
115         this.currency = currency;
116     }
117     public Integer getCurrencyMatchGroup() {
118         return currencyMatchGroup;
119     }
120     public void setCurrencyMatchGroup(Integer currencyMatchGroup) {
121         this.currencyMatchGroup = currencyMatchGroup;
122     }
123     public Float getAmount() {
124         return amount;
125     }
126     public void setAmount(Float amount) {
127         this.amount = amount;
128     }
129     public Integer getAmountMatchGroup() {
130         return amountMatchGroup;
131     }
132     public void setAmountMatchGroup(Integer amountMatchGroup) {
133         this.amountMatchGroup = amountMatchGroup;
134     }
135     public String getAccountComment() {
136         return accountComment;
137     }
138     public void setAccountComment(String accountComment) {
139         this.accountComment = accountComment;
140     }
141     public Integer getAccountCommentMatchGroup() {
142         return accountCommentMatchGroup;
143     }
144     public void setAccountCommentMatchGroup(Integer accountCommentMatchGroup) {
145         this.accountCommentMatchGroup = accountCommentMatchGroup;
146     }
147 }