SaleStockPeriod.java

package com.tradecloud.domain.model.requestforquote;

import com.tradecloud.common.base.PersistenceBase;

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name = "sale_stock_period")
public class SaleStockPeriod extends PersistenceBase {

    @Column(name = "type", nullable = false)
    @Enumerated(EnumType.STRING)
    private ProductStockSaleType type; // values: "SALE" or "STOCK"

    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @JoinColumn(name = "product_stock_sale_id", nullable = false)
    private ProductStockSale productStockSale;

    @Column(name = "period_date", nullable = false)
    private Date period;

    @Column(name = "quantity", nullable = false)
    private Integer quantity;

    private String state;

    private String client;

    // Constructors
    public SaleStockPeriod() {
    }

    public SaleStockPeriod(ProductStockSale productStockSale, Date period, Integer quantity,ProductStockSaleType type) {
        this.productStockSale = productStockSale;
        this.period = period;
        this.quantity = quantity;
        this.type=type;
    }

    public ProductStockSale getProductStockSale() {
        return productStockSale;
    }

    public void setProductStockSale(ProductStockSale productStockSale) {
        this.productStockSale = productStockSale;
    }

    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;
    }

    public ProductStockSaleType getType() {
        return type;
    }

    public void setType(ProductStockSaleType type) {
        this.type = type;
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    public String getClient() {
        return client;
    }

    public void setClient(String client) {
        this.client = client;
    }
}