package data;
import java.util.*;
import data.*;
public class PurchaseOrder implements java.io.Serializable {
public PurchaseOrder() {
}
public PurchaseOrder(Integer id) {
setId(id);
}
public PurchaseOrder(PurchaseOrder o) {
setId(o.getId());
setNumber(o.getNumber());
setReceived(o.getReceived());
setPrice(o.getPrice());
setCustomer(o.getCustomer());
}
public PurchaseOrder(Integer id, String number, Date received, Double price, Customer customer) {
setId(id);
setNumber(number);
setReceived(received);
setPrice(price);
setCustomer(customer);
}
public void setData(PurchaseOrder o) {
setNumber(o.getNumber());
setReceived(o.getReceived());
setPrice(o.getPrice());
setCustomer(o.getCustomer());
}
protected Integer id;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
protected String number;
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
protected Date received;
public Date getReceived() {
return received;
}
public void setReceived(Date received) {
this.received = received;
}
protected Double price;
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
protected Customer customer;
public Customer getCustomer() {
return customer;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
public String toString() {
StringBuffer sb = new StringBuffer(super.toString());
sb.append("[");
sb.append(id);
sb.append(", ");
sb.append(number);
sb.append(", ");
sb.append(received);
sb.append(", ");
sb.append(price);
sb.append("]");
return sb.toString();
}
public String toDisplayString() {
StringBuffer sb = new StringBuffer();
sb.append(number == null ? "" : number.toString());
return sb.toString();
}
public boolean equals(Object other) {
if (this == other) return true;
if (!(other instanceof PurchaseOrder)) return false;
if(!super.equals(other)) return false;
final PurchaseOrder o = (PurchaseOrder) other;
if(o.getNumber() == null) {
if (getNumber() != null) return false;
}
else if (!o.getNumber().equals(getNumber()))
return false;
if(o.getReceived() == null) {
if (getReceived() != null) return false;
}
else if (!o.getReceived().equals(getReceived()))
return false;
if(o.getPrice() == null) {
if (getPrice() != null) return false;
}
else if (!o.getPrice().equals(getPrice()))
return false;
return true;
}
public int hashCode() {
int res = 0;
if(getNumber() != null)
res = 29 * res + getNumber().hashCode();
if(getReceived() != null)
res = 29 * res + getReceived().hashCode();
if(getPrice() != null)
res = 29 * res + getPrice().hashCode();
return res;
}
}