OrderSearch.java
package com.tradecloud.dto.order;
import com.tradecloud.domain.base.utils.DateRange;
import com.tradecloud.domain.base.utils.ObjectUtil;
import com.tradecloud.domain.common.Currency;
import com.tradecloud.domain.common.Incoterm;
import com.tradecloud.domain.dto.base.SearchBase;
import com.tradecloud.domain.event.OrderEventType;
import com.tradecloud.domain.model.ordermanagement.BusinessState;
import com.tradecloud.domain.model.ordermanagement.ConsignmentState;
import com.tradecloud.domain.model.ordermanagement.OrderLcState;
import com.tradecloud.domain.model.ordermanagement.OrderState;
import com.tradecloud.domain.model.organisationalunit.OrganisationalUnit;
import com.tradecloud.domain.model.payment.PaymentMethod;
import com.tradecloud.domain.model.payment.PaymentTerm;
import com.tradecloud.domain.model.shipment.ShippingMode;
import com.tradecloud.domain.party.ServiceProvider;
import com.tradecloud.domain.party.base.Contact;
import com.tradecloud.domain.place.FinalDestination;
import com.tradecloud.domain.place.PlaceOfDischarge;
import com.tradecloud.domain.place.PlaceOfLoading;
import com.tradecloud.domain.search.OrgUnitFilter;
import lombok.Getter;
import lombok.Setter;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import java.io.Serializable;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
@Component
@Scope("view")
@Getter
@Setter
public abstract class OrderSearch extends SearchBase implements Serializable, OrgUnitFilter {
private static final long serialVersionUID = 1L;
protected String orderNumber;
protected String orderReference;
protected OrganisationalUnit organisationalUnit;
protected Collection<OrganisationalUnit> organisationalUnits;
protected Currency currency;
protected Date fromDate;
protected Date toDate;
protected PlaceOfLoading placeOfLoading;
protected PlaceOfDischarge placeOfDischarge;
protected ShippingMode shippingMode;
protected ShippingMode multiModalShippingMode;
protected Incoterm incoterm;
protected ServiceProvider freightForwarder;
protected OrderLcState lcState;
protected OrderState state;
protected BusinessState businessState;
protected List<OrderState> states = new ArrayList<>();
protected List<BusinessState> businessStates = new ArrayList<>();
private String proFormaReference;
private String shippingReference;
private Date orderDateFrom;
private Date orderDateTo;
private DateRange availabilityDateRange = new DateRange();
private DateRange requiredOnSiteDateRange = new DateRange();
private DateRange latestShipmentDateRange = new DateRange();
private DateRange earliestShipmentDateRange = new DateRange();
private DateRange estimatedArrivalDateRange = new DateRange();
private ConsignmentState consignmentState;
private PaymentMethod paymentMethod;
private PaymentTerm paymentTerm;
private boolean selectAll = false;
private String styleReference;
private String styleDescription;
private DateRange signedOffDateRange = new DateRange();
private List<OrderEventType> orderEventTypeList;
private DateRange grvDate = new DateRange();
private boolean elc = false;
private Contact supplierContact;
private DateRange eventDateRange;
private FinalDestination finalDestination;
private BigInteger businessDaysNotSignedOff;
private BigInteger businessDaysNotCosted;
private Date awaitingCostingDateEnd;
private Date finalisationEndDate;
private String vesselOrFlight;
private String bolOrAirwayBill;
private String containerReference;
private String itemDescription;
private String itemReference;
public OrderSearch() {
}
public String getOrderNumber() {
return orderNumber;
}
public void setOrderNumber(String orderNumber) {
this.orderNumber = orderNumber;
}
public String getOrderReference() {
return orderReference;
}
public void setOrderReference(String orderReference) {
this.orderReference = orderReference;
}
public OrganisationalUnit getOrganisationalUnit() {
return organisationalUnit;
}
public void setOrganisationalUnit(OrganisationalUnit organisationalUnit) {
this.organisationalUnit = organisationalUnit;
}
public Currency getCurrency() {
return currency;
}
public void setCurrency(Currency currency) {
this.currency = currency;
}
public Date getFromDate() {
return fromDate;
}
public void setFromDate(Date fromDate) {
this.fromDate = fromDate;
}
public Date getToDate() {
return toDate;
}
public void setToDate(Date toDate) {
this.toDate = toDate;
}
public PlaceOfLoading getPlaceOfLoading() {
return placeOfLoading;
}
public void setPlaceOfLoading(PlaceOfLoading placeOfLoading) {
this.placeOfLoading = placeOfLoading;
}
public PlaceOfDischarge getPlaceOfDischarge() {
return placeOfDischarge;
}
public void setPlaceOfDischarge(PlaceOfDischarge placeOfDischarge) {
this.placeOfDischarge = placeOfDischarge;
}
public ShippingMode getShippingMode() {
return shippingMode;
}
public void setShippingMode(ShippingMode shippingMode) {
this.shippingMode = shippingMode;
}
public Incoterm getIncoterm() {
return incoterm;
}
public void setIncoterm(Incoterm incoterm) {
this.incoterm = incoterm;
}
public ServiceProvider getFreightForwarder() {
return freightForwarder;
}
public void setFreightForwarder(ServiceProvider freightForwarder) {
this.freightForwarder = freightForwarder;
}
public DateRange getAvailabilityDateRange() {
return availabilityDateRange;
}
public void setAvailabilityDateRange(DateRange availabilityDateRange) {
this.availabilityDateRange = availabilityDateRange;
}
public DateRange getRequiredOnSiteDateRange() {
return requiredOnSiteDateRange;
}
public void setRequiredOnSiteDateRange(DateRange requiredOnSiteDateRange) {
this.requiredOnSiteDateRange = requiredOnSiteDateRange;
}
public DateRange getLatestShipmentDateRange() {
return latestShipmentDateRange;
}
public void setLatestShipmentDateRange(DateRange latestShipmentDateRange) {
this.latestShipmentDateRange = latestShipmentDateRange;
}
public OrderState getState() {
return state;
}
public void setState(OrderState state) {
this.state = state;
}
public BusinessState getBusinessState() {
return businessState;
}
public void setBusinessState(BusinessState businessState) {
this.businessState = businessState;
}
public String getProFormaReference() {
return proFormaReference;
}
public void setProFormaReference(String proFormaReference) {
this.proFormaReference = proFormaReference;
}
public String getShippingReference() {
return shippingReference;
}
public void setShippingReference(String shippingReference) {
this.shippingReference = shippingReference;
}
public Date getOrderDateFrom() {
return this.orderDateFrom;
}
public void setOrderDateFrom(Date date) {
this.orderDateFrom = date;
}
public Date getOrderDateTo() {
return this.orderDateTo;
}
public void setOrderDateTo(Date date) {
this.orderDateTo = date;
}
public ConsignmentState getConsignmentState() {
return consignmentState;
}
public void setConsignmentState(ConsignmentState consignmentState) {
this.consignmentState = consignmentState;
}
public OrderLcState getLcState() {
return lcState;
}
public void setLcState(OrderLcState lcState) {
this.lcState = lcState;
}
public boolean isPurchaseOrder() {
return false;
}
public PaymentMethod getPaymentMethod() {
return paymentMethod;
}
public void setPaymentMethod(PaymentMethod paymentMethod) {
this.paymentMethod = paymentMethod;
}
public PaymentTerm getPaymentTerm() {
return paymentTerm;
}
public void setPaymentTerm(PaymentTerm paymentTerm) {
this.paymentTerm = paymentTerm;
}
public boolean isSelectAll() {
return selectAll;
}
public void setSelectAll(boolean selectAll) {
this.selectAll = selectAll;
}
public Collection<OrganisationalUnit> getOrganisationalUnits() {
return organisationalUnits;
}
public void setOrganisationalUnits(Collection<OrganisationalUnit> organisationalUnits) {
this.organisationalUnits = organisationalUnits;
}
public List<OrderEventType> getOrderEventTypeList() {
return orderEventTypeList;
}
public void setOrderEventTypeList(List<OrderEventType> orderEventTypeList) {
this.orderEventTypeList = orderEventTypeList;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
OrderSearch that = (OrderSearch) o;
if (selectAll != that.selectAll) return false;
if (orderNumber != null ? !orderNumber.equals(that.orderNumber) : that.orderNumber != null) return false;
if (orderReference != null ? !orderReference.equals(that.orderReference) : that.orderReference != null)
return false;
if (organisationalUnit != null ? !organisationalUnit.equals(that.organisationalUnit) : that.organisationalUnit != null)
return false;
if (organisationalUnits != null ? !organisationalUnits.equals(that.organisationalUnits) : that.organisationalUnits != null)
return false;
if (currency != null ? !currency.equals(that.currency) : that.currency != null) return false;
if (fromDate != null ? !fromDate.equals(that.fromDate) : that.fromDate != null) return false;
if (toDate != null ? !toDate.equals(that.toDate) : that.toDate != null) return false;
if (placeOfLoading != null ? !placeOfLoading.equals(that.placeOfLoading) : that.placeOfLoading != null)
return false;
if (placeOfDischarge != null ? !placeOfDischarge.equals(that.placeOfDischarge) : that.placeOfDischarge != null)
return false;
if (shippingMode != that.shippingMode) return false;
if (incoterm != null ? !incoterm.equals(that.incoterm) : that.incoterm != null) return false;
if (freightForwarder != null ? !freightForwarder.equals(that.freightForwarder) : that.freightForwarder != null)
return false;
if (lcState != that.lcState) return false;
if (state != that.state) return false;
if (proFormaReference != null ? !proFormaReference.equals(that.proFormaReference) : that.proFormaReference != null)
return false;
if (shippingReference != null ? !shippingReference.equals(that.shippingReference) : that.shippingReference != null)
return false;
if (orderDateFrom != null ? !orderDateFrom.equals(that.orderDateFrom) : that.orderDateFrom != null)
return false;
if (orderDateTo != null ? !orderDateTo.equals(that.orderDateTo) : that.orderDateTo != null) return false;
if (availabilityDateRange != null ? !availabilityDateRange.equals(that.availabilityDateRange) : that.availabilityDateRange != null)
return false;
if (requiredOnSiteDateRange != null ? !requiredOnSiteDateRange.equals(that.requiredOnSiteDateRange) : that.requiredOnSiteDateRange != null)
return false;
if (latestShipmentDateRange != null ? !latestShipmentDateRange.equals(that.latestShipmentDateRange) : that.latestShipmentDateRange != null)
return false;
if (consignmentState != that.consignmentState) return false;
if (paymentMethod != null ? !paymentMethod.equals(that.paymentMethod) : that.paymentMethod != null)
return false;
if (paymentTerm != null ? !paymentTerm.equals(that.paymentTerm) : that.paymentTerm != null) return false;
if (styleReference != null ? !styleReference.equals(that.styleReference) : that.styleReference != null)
return false;
if (styleDescription != null ? !styleDescription.equals(that.styleDescription) : that.styleDescription != null)
return false;
return signedOffDateRange != null ? signedOffDateRange.equals(that.signedOffDateRange) : that.signedOffDateRange == null;
}
@Override
public int hashCode() {
int result = orderNumber != null ? orderNumber.hashCode() : 0;
result = 31 * result + (orderReference != null ? orderReference.hashCode() : 0);
result = 31 * result + (organisationalUnit != null ? organisationalUnit.hashCode() : 0);
result = 31 * result + (organisationalUnits != null ? organisationalUnits.hashCode() : 0);
result = 31 * result + (currency != null ? currency.hashCode() : 0);
result = 31 * result + (fromDate != null ? fromDate.hashCode() : 0);
result = 31 * result + (toDate != null ? toDate.hashCode() : 0);
result = 31 * result + (placeOfLoading != null ? placeOfLoading.hashCode() : 0);
result = 31 * result + (placeOfDischarge != null ? placeOfDischarge.hashCode() : 0);
result = 31 * result + (shippingMode != null ? shippingMode.hashCode() : 0);
result = 31 * result + (incoterm != null ? incoterm.hashCode() : 0);
result = 31 * result + (freightForwarder != null ? freightForwarder.hashCode() : 0);
result = 31 * result + (lcState != null ? lcState.hashCode() : 0);
result = 31 * result + (state != null ? state.hashCode() : 0);
result = 31 * result + (proFormaReference != null ? proFormaReference.hashCode() : 0);
result = 31 * result + (shippingReference != null ? shippingReference.hashCode() : 0);
result = 31 * result + (orderDateFrom != null ? orderDateFrom.hashCode() : 0);
result = 31 * result + (orderDateTo != null ? orderDateTo.hashCode() : 0);
result = 31 * result + (availabilityDateRange != null ? availabilityDateRange.hashCode() : 0);
result = 31 * result + (requiredOnSiteDateRange != null ? requiredOnSiteDateRange.hashCode() : 0);
result = 31 * result + (latestShipmentDateRange != null ? latestShipmentDateRange.hashCode() : 0);
result = 31 * result + (consignmentState != null ? consignmentState.hashCode() : 0);
result = 31 * result + (paymentMethod != null ? paymentMethod.hashCode() : 0);
result = 31 * result + (paymentTerm != null ? paymentTerm.hashCode() : 0);
result = 31 * result + (selectAll ? 1 : 0);
result = 31 * result + (styleReference != null ? styleReference.hashCode() : 0);
result = 31 * result + (styleDescription != null ? styleDescription.hashCode() : 0);
result = 31 * result + (signedOffDateRange != null ? signedOffDateRange.hashCode() : 0);
return result;
}
@Override
public String toString() {
return "OrderSearch{" +
"orderNumber='" + orderNumber + '\'' +
", orderReference='" + orderReference + '\'' +
", organisationalUnit=" + organisationalUnit +
", organisationalUnits=" + organisationalUnits +
", currency=" + currency +
", fromDate=" + fromDate +
", toDate=" + toDate +
", placeOfLoading=" + placeOfLoading +
", placeOfDischarge=" + placeOfDischarge +
", shippingMode=" + shippingMode +
", incoterm=" + incoterm +
", freightForwarder=" + freightForwarder +
", lcState=" + lcState +
", state=" + state +
", proFormaReference='" + proFormaReference + '\'' +
", shippingReference='" + shippingReference + '\'' +
", orderDateFrom=" + orderDateFrom +
", orderDateTo=" + orderDateTo +
", availabilityDateRange=" + availabilityDateRange +
", requiredOnSiteDateRange=" + requiredOnSiteDateRange +
", latestShipmentDateRange=" + latestShipmentDateRange +
", consignmentState=" + consignmentState +
", paymentMethod=" + paymentMethod +
", paymentTerm=" + paymentTerm +
", selectAll=" + selectAll +
", styleReference='" + styleReference + '\'' +
", styleDescription='" + styleDescription + '\'' +
", signedOffDateRange=" + signedOffDateRange +
'}';
}
public String getStyleDescription() {
return styleDescription;
}
public void setStyleDescription(String styleDescription) {
this.styleDescription = styleDescription;
}
public String getStyleReference() {
return styleReference;
}
public void setStyleReference(String styleReference) {
this.styleReference = styleReference;
}
public DateRange getSignedOffDateRange() {
return signedOffDateRange;
}
public void setSignedOffDateRange(DateRange signedOffDateRange) {
this.signedOffDateRange = signedOffDateRange;
}
public DateRange getEarliestShipmentDateRange() {
return earliestShipmentDateRange;
}
public void setEarliestShipmentDateRange(DateRange earliestShipmentDateRange) {
this.earliestShipmentDateRange = earliestShipmentDateRange;
}
public DateRange getEventDateRange() {
return eventDateRange;
}
public void setEventDateRange(DateRange eventDateRange) {
this.eventDateRange = eventDateRange;
}
public List<OrderState> getStates() {
return states;
}
public void setStates(List<OrderState> states) {
this.states = states;
}
public List<BusinessState> getBusinessStates() {
return businessStates;
}
public void setBusinessStates(List<BusinessState> businessStates) {
this.businessStates = businessStates;
}
public DateRange getGrvDate() {
return grvDate;
}
public void setGrvDate(DateRange grvDate) {
this.grvDate = grvDate;
}
public boolean isElc() {
return elc;
}
public void setElc(boolean elc) {
this.elc = elc;
}
@Override
public boolean noSelectedOrgUnit() {
return ObjectUtil.allNull(organisationalUnit, organisationalUnits);
}
public Contact getSupplierContact() {
return supplierContact;
}
public void setSupplierContact(Contact supplierContact) {
this.supplierContact = supplierContact;
}
public FinalDestination getFinalDestination() {
return finalDestination;
}
public void setFinalDestination(FinalDestination finalDestination) {
this.finalDestination = finalDestination;
}
public BigInteger getBusinessDaysNotSignedOff() {
return businessDaysNotSignedOff;
}
public void setBusinessDaysNotSignedOff(BigInteger businessDaysNotSignedOff) {
this.businessDaysNotSignedOff = businessDaysNotSignedOff;
}
public BigInteger getBusinessDaysNotCosted() {
return businessDaysNotCosted;
}
public void setBusinessDaysNotCosted(BigInteger businessDaysNotCosted) {
this.businessDaysNotCosted = businessDaysNotCosted;
}
public Date getAwaitingCostingDateEnd() {
return awaitingCostingDateEnd;
}
public void setAwaitingCostingDateEnd(Date awaitingCostingDateEnd) {
this.awaitingCostingDateEnd = awaitingCostingDateEnd;
}
public Date getFinalisationEndDate() {
return finalisationEndDate;
}
public void setFinalisationEndDate(Date finalisationEndDate) {
this.finalisationEndDate = finalisationEndDate;
}
public DateRange getEstimatedArrivalDateRange() {
return estimatedArrivalDateRange;
}
public void setEstimatedArrivalDateRange(DateRange estimatedArrivalDateRange) {
this.estimatedArrivalDateRange = estimatedArrivalDateRange;
}
public String getVesselOrFlight() {
return vesselOrFlight;
}
public void setVesselOrFlight(String vesselOrFlight) {
this.vesselOrFlight = vesselOrFlight;
}
public String getBolOrAirwayBill() {
return bolOrAirwayBill;
}
public void setBolOrAirwayBill(String bolOrAirwayBill) {
this.bolOrAirwayBill = bolOrAirwayBill;
}
public String getContainerReference() {
return containerReference;
}
public void setContainerReference(String containerReference) {
this.containerReference = containerReference;
}
public String getItemDescription() {
return itemDescription;
}
public void setItemDescription(String itemDescription) {
this.itemDescription = itemDescription;
}
public String getItemReference() {
return itemReference;
}
public void setItemReference(String itemReference) {
this.itemReference = itemReference;
}
}