OrderSearchResult.java

package com.tradecloud.dto.order;

import com.tradecloud.domain.model.ordermanagement.OrderType;
import com.tradecloud.domain.model.organisationalunit.OrganisationalUnit;
import com.tradecloud.domain.party.Employee;
import com.tradecloud.domain.supplier.OrganisationalUnitSupplier;

import javax.xml.bind.annotation.*;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.Date;

/**
 * This is the abstract base class for results returned for various order
 * searches, mostly related to reports. It is a DTO class rather than passing
 * back orders because there are often calculated fields, amongst other reasons.
 * The same class is sent through to the report tool in xml format.
 * 
 * Have added id/reference pairs for consignment and line item here too. They are quite commonly used. Should maybe have a SearchResult base class
 * that has id/reference pairs. Not much point in trying to have seperate base classes for each type (order, consignment, etc) as generally the 
 * whole chain is displayed in the results, so there would be lots of overlap, and way too complicated for a DTO class.
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
public abstract class OrderSearchResult {

    @XmlTransient
    private long orderId;

    private OrderType orderType;

    @XmlAttribute
    private String orderReference;

    @XmlAttribute
    private String shippingReference;

    @XmlAttribute
    private String purchaseOrderNumber;

    @XmlTransient
    private long itemId;

    @XmlAttribute
    private String itemReference;

    @XmlTransient
    protected Long consignmentId;

    @XmlAttribute
    private String consignmentReference;

    @XmlAttribute
    private String proFormaReference;

    //@XmlAttribute
    @XmlJavaTypeAdapter(value=XmlAdapterDate.class,type=java.util.Date.class)
    private Date latestShipmentDate;

    @XmlJavaTypeAdapter(value=XmlAdapterDate.class,type=java.util.Date.class)
    private Date earliestShipmentDate;

    @XmlElement(name = "Supplier")
    private OrganisationalUnitSupplier supplier;

    @XmlElement(name = "Buyer")
    private Employee buyer;

    @XmlElement(name = "OrganisationalUnit")
    private OrganisationalUnit organisationalUnit;

    public long getOrderId() {
        return orderId;
    }

    public void setOrderId(long orderId) {
        this.orderId = orderId;
    }

    public String getOrderReference() {
        return orderReference;
    }

    public void setOrderReference(String orderReference) {
        this.orderReference = orderReference;
    }

    public String getShippingReference() {
        return shippingReference;
    }

    public void setShippingReference(String shippingReference) {
        this.shippingReference = shippingReference;
    }

    public String getPurchaseOrderNumber() {
        return purchaseOrderNumber;
    }

    public void setPurchaseOrderNumber(String purchaseOrderNumber) {
        this.purchaseOrderNumber = purchaseOrderNumber;
    }

    public Long getConsignmentId() {
        return consignmentId;
    }

    public void setConsignmentId(Long consignmentId) {
        this.consignmentId = consignmentId;
    }

    public String getConsignmentReference() {
        return consignmentReference;
    }

    public void setConsignmentReference(String consignmentReference) {
        this.consignmentReference = consignmentReference;
    }

    public String getItemReference() {
        return itemReference;
    }

    public void setItemReference(String itemReference) {
        this.itemReference = itemReference;
    }

    public long getItemId() {
        return itemId;
    }

    public void setItemId(long itemId) {
        this.itemId = itemId;
    }

    public OrganisationalUnitSupplier getSupplier() {
        return supplier;
    }

    public void setSupplier(OrganisationalUnitSupplier supplier) {
        this.supplier = supplier;
    }

    public Employee getBuyer() {
        return buyer;
    }

    public void setBuyer(Employee buyer) {
        this.buyer = buyer;
    }

    public OrganisationalUnit getOrganisationalUnit() {
        return organisationalUnit;
    }

    public void setOrganisationalUnit(OrganisationalUnit organisationalUnit) {
        this.organisationalUnit = organisationalUnit;
    }

    public String getProFormaReference() {
        return proFormaReference;
    }

    public void setProFormaReference(String proFormaReference) {
        this.proFormaReference = proFormaReference;
    }

    public OrderType getOrderType() {
        return orderType;
    }

    public void setOrderType(OrderType orderType) {
        this.orderType = orderType;
    }

    public Date getLatestShipmentDate() {
        return latestShipmentDate;
    }

    public void setLatestShipmentDate(Date latestShipmentDate) {
        this.latestShipmentDate = latestShipmentDate;
    }

    public Date getEarliestShipmentDate() {
        return earliestShipmentDate;
    }

    public void setEarliestShipmentDate(Date earliestShipmentDate) {
        this.earliestShipmentDate = earliestShipmentDate;
    }
}