RFQOrderProduct.java

package com.tradecloud.domain.model.requestforquote;

import com.tradecloud.common.base.PersistenceBase;
import com.tradecloud.domain.item.Product;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Objects;

@Entity
@Table(name = "RFQOrderProduct")
public class RFQOrderProduct extends PersistenceBase {
    @ManyToOne
    private Product product;
    private Integer quantity = 0;
    private Integer orderQuanity = 0;
    @ManyToOne
    private RFQOrderRegion rfqOrderRegion;

    @Column
    private BigDecimal price = BigDecimal.ZERO;

    private transient String style;

    public RFQOrderProduct() {
    }

    public RFQOrderProduct(Product product, RFQOrderRegion rfqOrderRegion) {
        this.product = product;
        this.rfqOrderRegion = rfqOrderRegion;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public Integer getQuantity() {
        return quantity;
    }

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

    public Integer getOrderQuanity() {
        return orderQuanity;
    }

    public void setOrderQuanity(Integer orderQuanity) {
        this.orderQuanity = orderQuanity;
    }

    public RFQOrderRegion getRfqOrderRegion() {
        return rfqOrderRegion;
    }

    public void setRfqOrderRegion(RFQOrderRegion rfqOrderRegion) {
        this.rfqOrderRegion = rfqOrderRegion;
    }

    @Override
    public boolean equals(Object object) {
        if (this == object) return true;
        if (object == null || getClass() != object.getClass()) return false;
        RFQOrderProduct that = (RFQOrderProduct) object;
        return Objects.equals(product, that.product) && Objects.equals(rfqOrderRegion, that.rfqOrderRegion);
    }

    @Override
    public int hashCode() {
        return Objects.hash(product, rfqOrderRegion);
    }

    public void setPrice(BigDecimal price) {
        this.price=price;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public String getStyle() {
        return style;
    }

    public void setStyle(String style) {
        this.style = style;
    }
}