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

Entity java classes #79

Open
wants to merge 4 commits 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
97 changes: 97 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,97 @@
package com.wellsfargo.counselor.entity;

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

@Entity
public class Client {

@Id
@GeneratedValue
private long clientId;

@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
private Advisor advisor;

protected 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 getClientId() {
return clientId;
}

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

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.ManyToOne;
import java.util.Date;

@Entity
public class Portfolio {

@Id
@GeneratedValue
private long portfolioId;

@ManyToOne
private Client client;

@Column(nullable = false)
private Date creationDate;

protected Portfolio() {
}

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

public long getPortfolioId() {
return portfolioId;
}

public Client getClient() {
return client;
}

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

public Date getCreationDate() {
return creationDate;
}

public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
}
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;
import jakarta.persistence.ManyToOne;
import java.util.Date;

@Entity
public class Security {

@Id
@GeneratedValue
private long securityId;

@ManyToOne
private Portfolio portfolio;

@Column(nullable = false)
private String name;

@Column(nullable = false)
private String category;

@Column(nullable = false)
private Date purchaseDate;

@Column(nullable = false)
private float purchasePrice;

@Column(nullable = false)
private int quantity;

protected Security() {
}

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

public long getSecurityId() {
return securityId;
}

public Portfolio getPortfolio() {
return portfolio;
}

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

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 float getPurchasePrice() {
return purchasePrice;
}

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

public int getQuantity() {
return quantity;
}

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