]> git.ktnx.net Git - mobile-ledger.git/blob - app/src/main/java/net/ktnx/mobileledger/db/PatternAccount.java
061379d0be4a80966c496ea2f1fe8becd7334132
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / db / PatternAccount.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", unique = false,
32                           value = "pattern_id"),
33                    @Index(name = "fk_pattern_accounts_currency", unique = false, value = "currency")
34         }, foreignKeys = {@ForeignKey(childColumns = "pattern_id", parentColumns = "id",
35                                       entity = PatternHeader.class),
36                           @ForeignKey(childColumns = "currency", parentColumns = "id",
37                                       entity = Currency.class)
38 })
39 public class PatternAccount extends PatternBase {
40     @NonNull
41     @ColumnInfo(name = "pattern_id")
42     private Long patternId;
43     @PrimaryKey(autoGenerate = true)
44     @NotNull
45     private Long id;
46     @ColumnInfo(name = "acc")
47     private String accountName;
48     @ColumnInfo(name = "position")
49     @NonNull
50     private Long position;
51     @ColumnInfo(name = "acc_match_group")
52     private Integer accountNameMatchGroup;
53     @ColumnInfo(name = "currency")
54     private Integer currency;
55     @ColumnInfo(name = "currency_match_group")
56     private Integer currencyMatchGroup;
57     @ColumnInfo(name = "amount")
58     private Float amount;
59     @ColumnInfo(name = "amount_match_group")
60     private Integer amountMatchGroup;
61     @ColumnInfo(name = "comment")
62     private String accountComment;
63     @ColumnInfo(name = "comment_match_group")
64     private Integer accountCommentMatchGroup;
65     public PatternAccount(@NotNull Long id, @NonNull Long patternId, @NonNull Long position) {
66         this.id = id;
67         this.patternId = patternId;
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 @NotNull Long getPatternId() {
77         return patternId;
78     }
79     public void setPatternId(@NonNull Long patternId) {
80         this.patternId = patternId;
81     }
82     @NonNull
83     public String getAccountName() {
84         return accountName;
85     }
86     public void setAccountName(@NonNull String accountName) {
87         this.accountName = accountName;
88     }
89     @NonNull
90     public Long getPosition() {
91         return position;
92     }
93     public void setPosition(@NonNull Long position) {
94         this.position = position;
95     }
96     public void setPosition(int position) {
97         this.position = (long) position;
98     }
99     public Integer getAccountNameMatchGroup() {
100         return accountNameMatchGroup;
101     }
102     public void setAccountNameMatchGroup(Integer accountNameMatchGroup) {
103         this.accountNameMatchGroup = accountNameMatchGroup;
104     }
105     public Integer getCurrency() {
106         return currency;
107     }
108     public void setCurrency(Integer currency) {
109         this.currency = currency;
110     }
111     public Integer getCurrencyMatchGroup() {
112         return currencyMatchGroup;
113     }
114     public void setCurrencyMatchGroup(Integer currencyMatchGroup) {
115         this.currencyMatchGroup = currencyMatchGroup;
116     }
117     public Float getAmount() {
118         return amount;
119     }
120     public void setAmount(Float amount) {
121         this.amount = amount;
122     }
123     public Integer getAmountMatchGroup() {
124         return amountMatchGroup;
125     }
126     public void setAmountMatchGroup(Integer amountMatchGroup) {
127         this.amountMatchGroup = amountMatchGroup;
128     }
129     public String getAccountComment() {
130         return accountComment;
131     }
132     public void setAccountComment(String accountComment) {
133         this.accountComment = accountComment;
134     }
135     public Integer getAccountCommentMatchGroup() {
136         return accountCommentMatchGroup;
137     }
138     public void setAccountCommentMatchGroup(Integer accountCommentMatchGroup) {
139         this.accountCommentMatchGroup = accountCommentMatchGroup;
140     }
141 }