1 package net.ktnx.mobileledger.db;
3 import androidx.annotation.NonNull;
4 import androidx.room.ColumnInfo;
5 import androidx.room.Entity;
6 import androidx.room.ForeignKey;
7 import androidx.room.Index;
8 import androidx.room.PrimaryKey;
10 import org.jetbrains.annotations.NotNull;
12 @Entity(tableName = "pattern_accounts",
13 indices = {@Index(name = "un_pattern_accounts", unique = true, value = "id")},
14 foreignKeys = {@ForeignKey(childColumns = "pattern_id", parentColumns = "id",
15 entity = PatternHeader.class),
16 @ForeignKey(childColumns = "currency", parentColumns = "id",
17 entity = Currency.class)
19 public class PatternAccount extends PatternBase {
21 @ColumnInfo(name = "pattern_id")
22 private Long patternId;
23 @PrimaryKey(autoGenerate = true)
26 @ColumnInfo(name = "acc")
27 private String accountName;
28 @ColumnInfo(name = "position")
30 private Long position;
31 @ColumnInfo(name = "acc_match_group")
32 private Integer accountNameMatchGroup;
33 @ColumnInfo(name = "currency")
34 private Integer currency;
35 @ColumnInfo(name = "currency_match_group")
36 private Integer currencyMatchGroup;
37 @ColumnInfo(name = "amount")
39 @ColumnInfo(name = "amount_match_group")
40 private Integer amountMatchGroup;
41 @ColumnInfo(name = "comment")
42 private String accountComment;
43 @ColumnInfo(name = "comment_match_group")
44 private Integer accountCommentMatchGroup;
45 public PatternAccount(@NotNull Long id, @NonNull Long patternId, @NonNull Long position) {
47 this.patternId = patternId;
48 this.position = position;
53 public void setId(Long id) {
56 public @NotNull Long getPatternId() {
59 public void setPatternId(@NonNull Long patternId) {
60 this.patternId = patternId;
63 public String getAccountName() {
66 public void setAccountName(@NonNull String accountName) {
67 this.accountName = accountName;
70 public Long getPosition() {
73 public void setPosition(@NonNull Long position) {
74 this.position = position;
76 public void setPosition(int position) {
77 this.position = (long) position;
79 public Integer getAccountNameMatchGroup() {
80 return accountNameMatchGroup;
82 public void setAccountNameMatchGroup(Integer accountNameMatchGroup) {
83 this.accountNameMatchGroup = accountNameMatchGroup;
85 public Integer getCurrency() {
88 public void setCurrency(Integer currency) {
89 this.currency = currency;
91 public Integer getCurrencyMatchGroup() {
92 return currencyMatchGroup;
94 public void setCurrencyMatchGroup(Integer currencyMatchGroup) {
95 this.currencyMatchGroup = currencyMatchGroup;
97 public Float getAmount() {
100 public void setAmount(Float amount) {
101 this.amount = amount;
103 public Integer getAmountMatchGroup() {
104 return amountMatchGroup;
106 public void setAmountMatchGroup(Integer amountMatchGroup) {
107 this.amountMatchGroup = amountMatchGroup;
109 public String getAccountComment() {
110 return accountComment;
112 public void setAccountComment(String accountComment) {
113 this.accountComment = accountComment;
115 public Integer getAccountCommentMatchGroup() {
116 return accountCommentMatchGroup;
118 public void setAccountCommentMatchGroup(Integer accountCommentMatchGroup) {
119 this.accountCommentMatchGroup = accountCommentMatchGroup;