Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create class for each entity #67

Open
wants to merge 1 commit into
base: flow
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions src/main/java/com/wellsfargo/counselor/entity/Client.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
package com.wellsfargo.counselor.entity;

import jakarta.persistence.*;

import java.util.List;

@Entity
public class Client {
@Id
@GeneratedValue
private long client_id;

@Column(nullable = false)
private String firstName;

@Column(nullable = false)
private String lastName;

@Column(nullable = false)
private String email;

@Column(nullable = false)
private String phone;

@Column(nullable = false)
private String address;

@ManyToOne
@JoinColumn(name = "advisorId")
private Advisor advisor;

@OneToMany(mappedBy = "client")
private List<Portifolio> portifolios;

public Client() {
}

public Client(String firstName, String lastName, String email, String phone, String address, Advisor advisor) {
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
this.phone = phone;
this.address = address;
this.advisor = advisor;
}

public long getClient_id() {
return client_id;
}

public void setClient_id(long client_id) {
this.client_id = client_id;
}

public String getFirstName() {
return firstName;
}

public void setFirstName(String firstName) {
this.firstName = firstName;
}

public String getLastName() {
return lastName;
}

public void setLastName(String lastName) {
this.lastName = lastName;
}

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

public String getPhone() {
return phone;
}

public void setPhone(String phone) {
this.phone = phone;
}

public String getAddress() {
return address;
}

public void setAddress(String address) {
this.address = address;
}

public Advisor getAdvisor() {
return advisor;
}

public void setAdvisor(Advisor advisor) {
this.advisor = advisor;
}
}
63 changes: 63 additions & 0 deletions src/main/java/com/wellsfargo/counselor/entity/Portifolio.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package com.wellsfargo.counselor.entity;

import jakarta.persistence.*;

import java.util.Date;
import java.util.List;

@Entity
public class Portifolio {
@Id
@GeneratedValue
private Long portifolio_id;

@Column(nullable = false)
private Date creationDate;

@ManyToOne
@JoinColumn(name = "client_id")
private Client client;

@OneToMany(mappedBy = "portifolio")
private List<Security> securities;

public Portifolio() {
}

public Portifolio(Client client, Date creationDate) {
this.client = client;
this.creationDate = creationDate;
}

public Long getPortifolio_id() {
return portifolio_id;
}

public void setPortifolio_id(Long portifolio_id) {
this.portifolio_id = portifolio_id;
}

public Date getCreationDate() {
return creationDate;
}

public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}

public Client getClient() {
return client;
}

public void setClient(Client client) {
this.client = client;
}

public List<Security> getSecurities() {
return securities;
}

public void setSecurities(List<Security> securities) {
this.securities = securities;
}
}
100 changes: 100 additions & 0 deletions src/main/java/com/wellsfargo/counselor/entity/Security.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package com.wellsfargo.counselor.entity;

import jakarta.persistence.*;

import java.math.BigDecimal;
import java.util.Date;

@Entity
public class Security {
@Id
@GeneratedValue
private Long security_id;

@Column(nullable = false)
private String name;

@Column(nullable = false)
private String category;

@Column(nullable = false)
private Date purchaseDate;

@Column(nullable = false)
private BigDecimal purchasePrice;

@Column(nullable = false)
private int quantity;

@ManyToOne
@JoinColumn(name = "portifolio_id")
private Portifolio portifolio;

public Security() {
}

public Security(Portifolio portifolio, String name, String category, Date purchaseDate, BigDecimal purchasePrice, int quantity) {
this.name = name;
this.category = category;
this.purchaseDate = purchaseDate;
this.purchasePrice = purchasePrice;
this.quantity = quantity;
this.portifolio = portifolio;
}

public Long getSecurity_id() {
return security_id;
}

public void setSecurity_id(Long security_id) {
this.security_id = security_id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getCategory() {
return category;
}

public void setCategory(String category) {
this.category = category;
}

public Date getPurchaseDate() {
return purchaseDate;
}

public void setPurchaseDate(Date purchaseDate) {
this.purchaseDate = purchaseDate;
}

public BigDecimal getPurchasePrice() {
return purchasePrice;
}

public void setPurchasePrice(BigDecimal purchasePrice) {
this.purchasePrice = purchasePrice;
}

public int getQuantity() {
return quantity;
}

public void setQuantity(int quantity) {
this.quantity = quantity;
}

public Portifolio getPortifolio() {
return portifolio;
}

public void setPortifolio(Portifolio portifolio) {
this.portifolio = portifolio;
}
}