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

added entity classes #52

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
62 changes: 26 additions & 36 deletions src/main/java/com/wellsfargo/counselor/entity/Advisor.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,73 +7,54 @@
import jakarta.persistence.Id;

@Entity
public class Advisor {
public class FinancialAdvisor {

@Id
@GeneratedValue()
private long advisorId;

@Column(nullable = false)
private String firstName;
private String Name;

@Column(nullable = false)
private String lastName;
private String email;

@Column(nullable = false)
private String address;
private String phoneNo;

@Column(nullable = false)
private String phone;
@OneToMany(mappedBy = "advisor")
private Set<Client> clients;

@Column(nullable = false)
private String email;

protected Advisor() {
protected FinancialAdvisor() {

}

public Advisor(String firstName, String lastName, String address, String phone, String email) {
this.firstName = firstName;
this.lastName = lastName;
this.address = address;
this.phone = phone;
public FinancialAdvisor(String Name, String phoneNo, String email) {
this.Name = Name;
this.phoneNo = phoneNo;
this.email = email;
}

public Long getAdvisorId() {
return advisorId;
}

public String getFirstName() {
return firstName;
}

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

public String getLastName() {
return lastName;
public String getName() {
return Name;
}

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

public String getAddress() {
return address;
}

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

public String getPhone() {
return phone;
return phoneNo;
}

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

public String getEmail() {
Expand All @@ -83,4 +64,13 @@ public String getEmail() {
public void setEmail(String email) {
this.email = email;
}

public Set<Client> getClients() {
return clients;
}

public void setClients(Set<Client> clients) {
this.clients = clients;
}

}
84 changes: 84 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,84 @@
package com.wellsfargo.counselor.entity;


import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;

@Entity
public class Client {

@Id
@GeneratedValue()
private Long clientId;

@Column(nullable = false)
private String name;

@Column(nullable = false, unique = true)
private String email;

@Column(nullable = false)
private String phoneNo;

@ManyToOne
@JoinColumn(name = "advisor_id")
private FinancialAdvisor advisor;

@OneToMany(mappedBy = "client")
private Set<Portfolio> portfolios;

// Constructor
public Client(String name, String email, String phoneNo, FinancialAdvisor advisor) {
this.name = name;
this.email = email;
this.phoneNo = phoneNo;
this.advisor = advisor;
}

// Getters and Setters
public Long getClientId() {
return clientId;
}

public String getName() {
return name;
}

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

public String getEmail() {
return email;
}

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

public String getPhoneNo() {
return phoneNo;
}

public void setPhoneNo(String phoneNo) {
this.phoneNo = phoneNo;
}

public FinancialAdvisor getAdvisor() {
return advisor;
}

public void setAdvisor(FinancialAdvisor advisor) {
this.advisor = advisor;
}

public Set<Portfolio> getPortfolios() {
return portfolios;
}

public void setPortfolios(Set<Portfolio> portfolios) {
this.portfolios = portfolios;
}
}
48 changes: 48 additions & 0 deletions src/main/java/com/wellsfargo/counselor/entity/portfolio.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.wellsfargo.counselor.entity;


import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;

@Entity
public class Portfolio {

@Id
@GeneratedValue()
private Long portfolioId;

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

@OneToMany(mappedBy = "portfolio")
private Set<Security> securities;

// Constructor
public Portfolio(Client client) {
this.client = client;
}

// Getters and Setters
public Long getPortfolioId() {
return portfolioId;
}

public Client getClient() {
return client;
}

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

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

public void setSecurities(Set<Security> securities) {
this.securities = securities;
}
}
98 changes: 98 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,98 @@
package com.wellsfargo.counselor.entity;


import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;

@Entity
public class Security {

@Id
@GeneratedValue()
private Long securityId;

@Column(nullable = false)
private String name;

@Column(nullable = false)
private String category;

@ManyToOne
@JoinColumn(name = "portfolio_id")
private Portfolio portfolio;

@Column(nullable = false)
private int quantity;

@Column(nullable = false)
@Temporal(TemporalType.DATE)
private Date purchaseDate;

@Column(nullable = false)
private double purchasePrice;

// Constructor
public Security(String name, String category, Portfolio portfolio, int quantity, Date purchaseDate, double purchasePrice) {
this.name = name;
this.category = category;
this.portfolio = portfolio;
this.quantity = quantity;
this.purchaseDate = purchaseDate;
this.purchasePrice = purchasePrice;
}

// Getters and Setters
public Long getSecurityId() {
return securityId;
}

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 Portfolio getPortfolio() {
return portfolio;
}

public void setPortfolio(Portfolio portfolio) {
this.portfolio = portfolio;
}

public int getQuantity() {
return quantity;
}

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

public Date getPurchaseDate() {
return purchaseDate;
}

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

public double getPurchasePrice() {
return purchasePrice;
}

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