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.
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.
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/>.
18 package net.ktnx.mobileledger.db;
20 import androidx.annotation.NonNull;
21 import androidx.room.ColumnInfo;
22 import androidx.room.Entity;
23 import androidx.room.ForeignKey;
25 @Entity(tableName = "transaction_accounts", primaryKeys = {"profile", "transaction_id", "order_no"},
26 foreignKeys = {@ForeignKey(entity = Transaction.class, parentColumns = {"profile", "id"},
27 childColumns = {"profile", "transaction_id"},
28 onDelete = ForeignKey.CASCADE, onUpdate = ForeignKey.RESTRICT),
29 @ForeignKey(entity = Account.class, parentColumns = {"profile", "name"},
30 childColumns = {"profile", "account_name"},
31 onDelete = ForeignKey.CASCADE, onUpdate = ForeignKey.RESTRICT)
33 public class TransactionAccount {
36 private String profile;
37 @ColumnInfo(name = "transaction_id")
38 private int transactionId;
39 @ColumnInfo(name = "order_no")
41 @ColumnInfo(name = "account_name")
43 private String accountName;
44 @ColumnInfo(defaultValue = "")
46 private String currency = "";
50 private String comment;
51 @ColumnInfo(defaultValue = "0")
52 private int generation = 0;
54 public String getProfile() {
57 public void setProfile(@NonNull String profile) {
58 this.profile = profile;
60 public int getTransactionId() {
63 public void setTransactionId(int transactionId) {
64 this.transactionId = transactionId;
66 public int getOrderNo() {
69 public void setOrderNo(int orderNo) {
70 this.orderNo = orderNo;
73 public String getAccountName() {
76 public void setAccountName(@NonNull String accountName) {
77 this.accountName = accountName;
80 public String getCurrency() {
83 public void setCurrency(@NonNull String currency) {
84 this.currency = currency;
86 public float getAmount() {
89 public void setAmount(float amount) {
92 public String getComment() {
95 public void setComment(String comment) {
96 this.comment = comment;
98 public int getGeneration() {
101 public void setGeneration(int generation) {
102 this.generation = generation;