package oracle.byop.maf.data.entities;

import oracle.adfmf.java.beans.PropertyChangeListener;
import oracle.adfmf.java.beans.PropertyChangeSupport;

/**
 *
 * Title:   Bring Your Own Project (BYOP): Hackathon
 * Schema:  ADF Summit
 * Type:    Entity
 *
 * @author Frank Nimphius - August, 2014
 *  */
public class OrderItem {
    
    private Integer ordId = null;
    private Integer itemId = null;
    private Integer productId = null;
    private Double price = null;
    private Integer quantity = null;
    private Integer quantityShipped = null;
    private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);


    public OrderItem() {
        super();
    }

    public OrderItem(Integer ordId, Integer itemId, Integer productId, Double price, 
                    Integer quantity, Integer quantityShipped) {
        super();
        
        this.ordId = ordId;
        this.itemId = itemId;
        this.productId = productId;
        this.price = price;
        this.quantity = quantity;
        this.quantityShipped = quantityShipped;
    }


    public void setOrdId(Integer ordId) {
        Integer oldOrdId = this.ordId;
        this.ordId = ordId;
        propertyChangeSupport.firePropertyChange("ordId", oldOrdId, ordId);
    }

    public Integer getOrdId() {
        return ordId;
    }

    public void setItemId(Integer itemId) {
        Integer oldItemId = this.itemId;
        this.itemId = itemId;
        propertyChangeSupport.firePropertyChange("itemId", oldItemId, itemId);
    }

    public Integer getItemId() {
        return itemId;
    }

    public void setProductId(Integer productId) {
        Integer oldProductId = this.productId;
        this.productId = productId;
        propertyChangeSupport.firePropertyChange("productId", oldProductId, productId);
    }

    public Integer getProductId() {
        return productId;
    }

    public void setPrice(Double price) {
        Double oldPrice = this.price;
        this.price = price;
        propertyChangeSupport.firePropertyChange("price", oldPrice, price);
    }

    public Double getPrice() {
        return price;
    }

    public void setQuantity(Integer quantity) {
        Integer oldQuantity = this.quantity;
        this.quantity = quantity;
        propertyChangeSupport.firePropertyChange("quantity", oldQuantity, quantity);
    }

    public Integer getQuantity() {
        return quantity;
    }

    public void setQuantityShipped(Integer quantityShipped) {
        Integer oldQuantityShipped = this.quantityShipped;
        this.quantityShipped = quantityShipped;
        propertyChangeSupport.firePropertyChange("quantityShipped", oldQuantityShipped, quantityShipped);
    }

    public Integer getQuantityShipped() {
        return quantityShipped;
    }

    public void addPropertyChangeListener(PropertyChangeListener l) {
        propertyChangeSupport.addPropertyChangeListener(l);
    }

    public void removePropertyChangeListener(PropertyChangeListener l) {
        propertyChangeSupport.removePropertyChangeListener(l);
    }
}
