]> git.ktnx.net Git - mobile-ledger.git/blob - app/src/main/java/net/ktnx/mobileledger/db/AccountValue.java
more pronounced day/month delimiters in the transaction list
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / db / AccountValue.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
28 @Entity(tableName = "account_values", indices = {
29         @Index(name = "un_account_values", unique = true, value = {"account_id", "currency"}),
30         @Index(name = "fk_account_value_acc", value = "account_id")
31 }, foreignKeys = {
32         @ForeignKey(entity = Account.class, parentColumns = "id", childColumns = "account_id",
33                     onDelete = ForeignKey.CASCADE, onUpdate = ForeignKey.RESTRICT)
34 })
35 public class AccountValue {
36     @ColumnInfo
37     @PrimaryKey(autoGenerate = true)
38     long id;
39     @ColumnInfo(name = "account_id")
40     private long accountId;
41     @NonNull
42     @ColumnInfo(defaultValue = "")
43     private String currency = "";
44     @ColumnInfo
45     private float value;
46     @ColumnInfo(defaultValue = "0")
47     private long generation = 0;
48     public long getId() {
49         return id;
50     }
51     public void setId(long id) {
52         this.id = id;
53     }
54     public long getAccountId() {
55         return accountId;
56     }
57     public void setAccountId(long accountId) {
58         this.accountId = accountId;
59     }
60     @NonNull
61     public String getCurrency() {
62         return currency;
63     }
64     public void setCurrency(@NonNull String currency) {
65         this.currency = currency;
66     }
67     public float getValue() {
68         return value;
69     }
70     public void setValue(float value) {
71         this.value = value;
72     }
73     public long getGeneration() {
74         return generation;
75     }
76     public void setGeneration(long generation) {
77         this.generation = generation;
78     }
79 }