]> 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 = "pattern_accounts",
30         indices = {@Index(name = "un_pattern_accounts", unique = true, value = "id"),
31                    @Index(name = "fk_pattern_accounts_pattern", value = "pattern_id"),
32                    @Index(name = "fk_pattern_accounts_currency", value = "currency")
33         }, foreignKeys = {@ForeignKey(childColumns = "pattern_id", parentColumns = "id",
34                                       entity = TemplateHeader.class),
35                           @ForeignKey(childColumns = "currency", parentColumns = "id",
36                                       entity = Currency.class)
37 })
38 public class TemplateAccount extends TemplateBase {
39     @NonNull
40     @ColumnInfo(name = "pattern_id")
41     private Long patternId;
42     @PrimaryKey(autoGenerate = true)
43     @NotNull
44     private Long id;
45     @ColumnInfo(name = "acc")
46     private String accountName;
47     @ColumnInfo(name = "position")
48     @NonNull
49     private Long position;
50     @ColumnInfo(name = "acc_match_group")
51     private Integer accountNameMatchGroup;
52     @ColumnInfo(name = "currency")
53     private Integer currency;
54     @ColumnInfo(name = "currency_match_group")
55     private Integer currencyMatchGroup;
56     @ColumnInfo(name = "amount")
57     private Float amount;
58     @ColumnInfo(name = "amount_match_group")
59     private Integer amountMatchGroup;
60     @ColumnInfo(name = "comment")
61     private String accountComment;
62     @ColumnInfo(name = "comment_match_group")
63     private Integer accountCommentMatchGroup;
64     @ColumnInfo(name = "negate_amount")
65     private Boolean negateAmount;
66     public TemplateAccount(@NotNull Long id, @NonNull Long patternId, @NonNull Long position) {
67         this.id = id;
68         this.patternId = patternId;
69         this.position = position;
70     }
71     public Long getId() {
72         return id;
73     }
74     public void setId(Long id) {
75         this.id = id;
76     }
77     public Boolean getNegateAmount() {
78         return negateAmount;
79     }
80     public void setNegateAmount(Boolean negateAmount) {
81         this.negateAmount = negateAmount;
82     }
83     public @NotNull Long getPatternId() {
84         return patternId;
85     }
86     public void setPatternId(@NonNull Long patternId) {
87         this.patternId = patternId;
88     }
89     @NonNull
90     public String getAccountName() {
91         return accountName;
92     }
93     public void setAccountName(@NonNull String accountName) {
94         this.accountName = accountName;
95     }
96     @NonNull
97     public Long getPosition() {
98         return position;
99     }
100     public void setPosition(@NonNull Long position) {
101         this.position = position;
102     }
103     public void setPosition(int position) {
104         this.position = (long) position;
105     }
106     public Integer getAccountNameMatchGroup() {
107         return accountNameMatchGroup;
108     }
109     public void setAccountNameMatchGroup(Integer accountNameMatchGroup) {
110         this.accountNameMatchGroup = accountNameMatchGroup;
111     }
112     public Integer getCurrency() {
113         return currency;
114     }
115     public void setCurrency(Integer currency) {
116         this.currency = currency;
117     }
118     public Integer getCurrencyMatchGroup() {
119         return currencyMatchGroup;
120     }
121     public void setCurrencyMatchGroup(Integer currencyMatchGroup) {
122         this.currencyMatchGroup = currencyMatchGroup;
123     }
124     public Float getAmount() {
125         return amount;
126     }
127     public void setAmount(Float amount) {
128         this.amount = amount;
129     }
130     public Integer getAmountMatchGroup() {
131         return amountMatchGroup;
132     }
133     public void setAmountMatchGroup(Integer amountMatchGroup) {
134         this.amountMatchGroup = amountMatchGroup;
135     }
136     public String getAccountComment() {
137         return accountComment;
138     }
139     public void setAccountComment(String accountComment) {
140         this.accountComment = accountComment;
141     }
142     public Integer getAccountCommentMatchGroup() {
143         return accountCommentMatchGroup;
144     }
145     public void setAccountCommentMatchGroup(Integer accountCommentMatchGroup) {
146         this.accountCommentMatchGroup = accountCommentMatchGroup;
147     }
148 }