StockLevelPeriod.java
package com.tradecloud.domain.model.requestforquote;
import com.tradecloud.common.base.PersistenceBase;
import javax.persistence.*;
import java.util.Date;
import java.util.Objects;
@Entity
@Table(name = "StockLevelPeriod")
@Access(AccessType.FIELD)
public class StockLevelPeriod extends PersistenceBase {
@Column(name = "type", nullable = false)
@Enumerated(EnumType.STRING)
private ProductStockSaleType type; // values: "SALE" or "STOCK"
@Column(name = "period_date", nullable = false)
private Date period;
@Column(name = "quantity", nullable = false)
private Integer quantity;
public StockLevelPeriod() {
}
public StockLevelPeriod(ProductStockSaleType type, Date period, Integer quantity) {
this.type = type;
this.period = period;
this.quantity = quantity;
}
public ProductStockSaleType getType() {
return type;
}
public void setType(ProductStockSaleType type) {
this.type = type;
}
public Date getPeriod() {
return period;
}
public void setPeriod(Date period) {
this.period = period;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
StockLevelPeriod that = (StockLevelPeriod) o;
return Objects.equals(period, that.period);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), period);
}
}