ProductHistory.java
package com.tradecloud.domain.item;
import com.tradecloud.common.base.PersistenceBase;
import com.tradecloud.domain.model.ordermanagement.PurchaseOrder;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlTransient;
import java.math.BigDecimal;
import java.util.Date;
@Entity
@Table(name = "producthistory")
@Access(AccessType.FIELD)
@NamedQueries({
@NamedQuery(name = "ProductHistory.findByCodeAndOrgId",
query = "from ProductHistory p where p.item_reference= :item_reference and " +
"p.countryoforigin_code = :countryoforigin_code and p.supplier_id = :supplier_id and " +
"p.organisationalunit_id = :organisationalunit_id order by created desc,p.id desc")
})
public class ProductHistory extends PersistenceBase {
public enum Type {LAST_GRN, LAST_LC}
private String item_reference;
@XmlTransient
@Enumerated(EnumType.STRING)
private Type type;
private Date grnDate;
private BigDecimal llcAmount;
@ManyToOne(fetch = FetchType.LAZY)
private PurchaseOrder order;
private long supplier_id;
private long organisationalunit_id;
private String countryoforigin_code;
private Date dateAdded;
public ProductHistory() {
}
public ProductHistory(String item_reference, Type type, Date grnDate, BigDecimal llcAmount, PurchaseOrder order, long supplier_id,
long organisationalunit_id, String countryoforigin_code) {
this.item_reference = item_reference;
this.type = type;
this.grnDate = grnDate;
this.llcAmount = llcAmount;
this.order = order;
this.supplier_id = supplier_id;
this.organisationalunit_id = organisationalunit_id;
this.countryoforigin_code = countryoforigin_code;
}
public Type getType() {
return type;
}
public void setType(Type type) {
this.type = type;
}
public Date getGrnDate() {
return grnDate;
}
public void setGrnDate(Date grnDate) {
this.grnDate = grnDate;
}
public BigDecimal getLlcAmount() {
return llcAmount;
}
public void setLlcAmount(BigDecimal llcAmount) {
this.llcAmount = llcAmount;
}
public PurchaseOrder getOrder() {
return order;
}
public void setOrder(PurchaseOrder order) {
this.order = order;
}
public Date getDateAdded() {
return dateAdded;
}
public void setDateAdded(Date dateAdded) {
this.dateAdded = dateAdded;
}
public String getItem_reference() {
return item_reference;
}
public void setItem_reference(String item_reference) {
this.item_reference = item_reference;
}
public long getSupplier_id() {
return supplier_id;
}
public void setSupplier_id(long supplier_id) {
this.supplier_id = supplier_id;
}
public long getOrganisationalunit_id() {
return organisationalunit_id;
}
public void setOrganisationalunit_id(long organisationalunit_id) {
this.organisationalunit_id = organisationalunit_id;
}
public String getCountryoforigin_code() {
return countryoforigin_code;
}
public void setCountryoforigin_code(String countryoforigin_code) {
this.countryoforigin_code = countryoforigin_code;
}
}