package ie.dcu.spca.model.bean;
import ie.dcu.spca.model.Bean;
import ie.dcu.spca.model.dao.CategoryDao;
import java.util.Date;
public class Product extends Bean {
private String name;
private double price;
private String barcode;
private int unit_id;
private int category_id;
public Product(int id, String name, double price, String barcode,
int unit_id, int category_id, Date creat_at, Date update_at,
Date delete_at) {
super();
this.id = id;
this.name = name;
this.price = price;
this.barcode = barcode;
this.unit_id = unit_id;
this.category_id = category_id;
this.create_at = creat_at;
this.update_at = update_at;
this.delete_at = delete_at;
}
public Product(int id, String name, double price, String barcode,
int unit_id, int category_id, long creat_at, long update_at,
long delete_at) {
super();
this.id = id;
this.name = name;
this.price = price;
this.barcode = barcode;
this.unit_id = unit_id;
this.category_id = category_id;
this.create_at = new Date(creat_at);
this.update_at = new Date(update_at);
this.delete_at = new Date(delete_at);
}
public Category getCategory() {
CategoryDao cd = new CategoryDao();
return (Category) cd.selectById(this.category_id);
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public String getBarcode() {
return barcode;
}
public void setBarcode(String barcode) {
this.barcode = barcode;
}
public int getUnit_id() {
return unit_id;
}
public void setUnit_id(int unit_id) {
this.unit_id = unit_id;
}
public int getCategory_id() {
return category_id;
}
public void setCategory_id(int category_id) {
this.category_id = category_id;
}
public Date getCreate_at() {
return create_at;
}
public void setCreate_at(Date creat_at) {
this.create_at = creat_at;
}
public Date getUpdate_at() {
return update_at;
}
public void setUpdate_at(Date update_at) {
this.update_at = update_at;
}
public Date getDelete_at() {
return delete_at;
}
public void setDelete_at(Date delete_at) {
this.delete_at = delete_at;
}
}
|