StockLevelStyleProduct.java
package com.tradecloud.domain.model.requestforquote;
import com.tradecloud.domain.place.FinalDestination;
import javax.persistence.*;
import java.util.Objects;
@Entity
@Table(name = "stockLevelStyleProduct")
@Access(AccessType.FIELD)
public class StockLevelStyleProduct extends StockLevelRow {
@Column(name = "productCode", nullable = false)
private String productCode;
@Column(name = "productDescription", nullable = false)
private String productDescription;
@Column(name = "product_id", nullable = false)
private Long productId;
// @ManyToOne
// private StockLevelStyle stockLevelStyle;
@ManyToOne
private FinalDestination finalDestination;
@ManyToOne
private StockLevelRegion stockLevelRegion;
public StockLevelStyleProduct() {
}
public StockLevelStyleProduct(String productCode, Long productId, StockLevelRegion stockLevelRegion) {
this.productCode = productCode;
this.productId = productId;
this.stockLevelRegion = stockLevelRegion;
}
public StockLevelStyleProduct(String productDescription, String productCode, Long productId) {
this.productDescription = productDescription;
this.productCode = productCode;
this.productId = productId;
}
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductDescription() {
return productDescription;
}
public void setProductDescription(String productDescription) {
this.productDescription = productDescription;
}
public Long getProductId() {
return productId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public StockLevelStyle getStockLevelStyle() {
return stockLevelRegion.getStockLevelStyle();
}
public void setStockLevelStyle(StockLevelStyle stockLevelStyle) {
// this.stockLevelStyle = stockLevelStyle;
}
public StockLevelRegion getStockLevelRegion() {
return stockLevelRegion;
}
public void setStockLevelRegion(StockLevelRegion stockLevelRegion) {
this.stockLevelRegion = stockLevelRegion;
}
@Override
public boolean equals(Object object) {
if (this == object) return true;
if (object == null || getClass() != object.getClass()) return false;
if (!super.equals(object)) return false;
StockLevelStyleProduct that = (StockLevelStyleProduct) object;
return Objects.equals(productId, that.productId) && Objects.equals(stockLevelRegion, that.stockLevelRegion);
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), productId, stockLevelRegion);
}
@Override
public String getCode(){
return productCode;
}
@Override
public String getDescription(){
return productDescription;
}
@Override
public FinalDestination getFinalDestination() {
return finalDestination;
}
public void setFinalDestination(FinalDestination finalDestination) {
this.finalDestination = finalDestination;
}
@Override
public boolean isProduct(){
return true;
}
@Override
public String getStyle(){
return finalDestination.getName();
}
}