forked from ZipCodeCore/FinalGroupProjects-Java
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAccount.java
More file actions
142 lines (107 loc) · 3.29 KB
/
Account.java
File metadata and controls
142 lines (107 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
package runner.entities;
import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonView;
import runner.enums.AccountType;
import runner.views.Views;
import javax.persistence.*;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@Entity
public class Account {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@JsonView(Views.AccountNumber.class)
private String accountNumber;
@JsonView(Views.AccountDetails.class)
private String routingNumber = "091000022";
@JsonView(Views.AccountType.class)
@Enumerated(EnumType.STRING)
private AccountType accountType; //enum
@JsonView(Views.AccountActions.class)
private Double balance;
@JsonView(Views.AccountDetails.class)
private LocalDate dateOfOpening;
@JsonView(Views.AccountDetails.class)
private Double interestRate;
@JsonView(Views.AllAccounts.class) //delete this later in production
private String encryptedUrl;
@JsonView(Views.AccountSpecific.class)
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(
name = "account_transaction",
joinColumns = @JoinColumn(name = "account_id"),
inverseJoinColumns = @JoinColumn(name = "transaction_id"))
private Set<Transaction> transactions = new HashSet<>();
@ManyToOne
@JoinColumn(name = "customer_id")
private Customer customer;
public Account() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public void addToTransactionsList(Transaction transaction){
transactions.add(transaction);
}
public String getAccountNumber() {
return accountNumber;
}
public void setAccountNumber(String accountNumber) {
this.accountNumber = accountNumber;
}
public String getRoutingNumber() {
return routingNumber;
}
public void setRoutingNumber(String routingNumber) {
this.routingNumber = routingNumber;
}
public AccountType getAccountType() {
return accountType;
}
public void setAccountType(AccountType accountType) {
this.accountType = accountType;
}
public Double getBalance() {
return balance;
}
public void setBalance(Double balance) {
this.balance = balance;
}
public LocalDate getDateOfOpening() {
return dateOfOpening;
}
public void setDateOfOpening(LocalDate dateOfOpening) {
this.dateOfOpening = dateOfOpening;
}
public Double getInterestRate() {
return interestRate;
}
public void setInterestRate(Double interestRate) {
this.interestRate = interestRate;
}
public Set<Transaction> getTransactions() {
return transactions;
}
public void setTransactions(Set<Transaction> transactionsList) {
this.transactions = transactionsList;
}
public String getEncryptedUrl() {
return encryptedUrl;
}
public void setEncryptedUrl(String encryptedURL) {
this.encryptedUrl = encryptedURL;
}
public Customer getCustomer() {
return customer;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
}