]> git.ktnx.net Git - mobile-ledger.git/blob - app/src/main/java/net/ktnx/mobileledger/db/Transaction.java
f6808f9406c6f4c292ef939512a1205ba3175fee
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / db / Transaction.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.Index;
24
25 /*
26 create table transactions(profile varchar not null, id integer not null, data_hash varchar not
27 null, year integer not null, month integer not null, day integer not null, description varchar
28 collate NOCASE not null, comment varchar, generation integer default 0, primary key(profile,id));
29 create unique index un_transactions_data_hash on transactions(profile,data_hash);
30 create index idx_transaction_description on transactions(description);
31  */
32 @Entity(tableName = "transactions", primaryKeys = {"profile", "id"}, indices = {
33         @Index(name = "un_transactions_data_hash", unique = true, value = {"profile", "data_hash"}),
34         @Index(name = "idx_transaction_description", value = "description")
35 })
36 public class Transaction {
37     @ColumnInfo
38     @NonNull
39     private String profile;
40     @ColumnInfo
41     private int id;
42     @ColumnInfo(name = "data_hash")
43     @NonNull
44     private String dataHash;
45     @ColumnInfo
46     private int year;
47     @ColumnInfo
48     private int month;
49     @ColumnInfo
50     private int day;
51     @ColumnInfo(collate = ColumnInfo.NOCASE)
52     @NonNull
53     private String description;
54     @ColumnInfo
55     private String comment;
56     @ColumnInfo
57     private int generation = 0;
58     public String getProfile() {
59         return profile;
60     }
61     public void setProfile(String profile) {
62         this.profile = profile;
63     }
64     public int getId() {
65         return id;
66     }
67     public void setId(int id) {
68         this.id = id;
69     }
70     public String getDataHash() {
71         return dataHash;
72     }
73     public void setDataHash(String dataHash) {
74         this.dataHash = dataHash;
75     }
76     public int getYear() {
77         return year;
78     }
79     public void setYear(int year) {
80         this.year = year;
81     }
82     public int getMonth() {
83         return month;
84     }
85     public void setMonth(int month) {
86         this.month = month;
87     }
88     public int getDay() {
89         return day;
90     }
91     public void setDay(int day) {
92         this.day = day;
93     }
94     public String getDescription() {
95         return description;
96     }
97     public void setDescription(String description) {
98         this.description = description;
99     }
100     public String getComment() {
101         return comment;
102     }
103     public void setComment(String comment) {
104         this.comment = comment;
105     }
106     public int getGeneration() {
107         return generation;
108     }
109     public void setGeneration(int generation) {
110         this.generation = generation;
111     }
112
113 }