CreditorBillingTransactionSearch.java

package com.tradecloud.dto.creditorbilling;

import com.tradecloud.domain.base.utils.DateRange;
import com.tradecloud.domain.common.Incoterm;
import com.tradecloud.domain.container.ContainerType;
import com.tradecloud.domain.creditorbilling.transaction.CreditorBillingTransactionState;
import com.tradecloud.domain.creditorbilling.transaction.CreditorBillingTransactionType;
import com.tradecloud.domain.dto.base.SearchBase;
import com.tradecloud.domain.party.ServiceProvider;
import com.tradecloud.domain.party.ServiceProviderType;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import java.io.Serializable;

@Component
@Scope("view")
public class CreditorBillingTransactionSearch extends SearchBase implements Serializable {

    private ServiceProvider carrier;
    private ServiceProvider freightForwarder;
    private ServiceProviderType counterPartyType;
    private String billNumber;
    private String containerReference;
    private String turnInDepotName;
    private CreditorBillingTransactionType transactionType;
    private DateRange createdDateRange = new DateRange();
    private DateRange signedOffDateRange = new DateRange();
    private DateRange settledDateRange = new DateRange();
    private DateRange deletedDateRange = new DateRange();

    private Incoterm incoterm;
    private ContainerType containerType;

    /*Freight Bills*/
    private DateRange actualDepartureDateRange = new DateRange();
    private DateRange billOfLadingDateRange = new DateRange();
    private boolean reversal;

    private CreditorBillingTransactionState status;

    public ServiceProvider getCarrier() {
        return carrier;
    }

    public void setCarrier(ServiceProvider carrier) {
        this.carrier = carrier;
    }

    public ServiceProvider getFreightForwarder() {
        return freightForwarder;
    }

    public void setFreightForwarder(ServiceProvider freightForwarder) {
        this.freightForwarder = freightForwarder;
    }

    public String getBillNumber() {
        return billNumber;
    }

    public void setBillNumber(String billNumber) {
        this.billNumber = billNumber;
    }

    public String getContainerReference() {
        return containerReference;
    }

    public void setContainerReference(String containerReference) {
        this.containerReference = containerReference;
    }

    public String getTurnInDepot() {
        return turnInDepotName;
    }

    public void setTurnInDepot(String turnInDepot) {
        this.turnInDepotName = turnInDepot;
    }

    public DateRange getCreatedDateRange() {
        return createdDateRange;
    }

    public void setCreatedDateRange(DateRange createdDateRange) {
        this.createdDateRange = createdDateRange;
    }

    public DateRange getSignedOffDateRange() {
        return signedOffDateRange;
    }

    public void setSignedOffDateRange(DateRange signedOffDateRange) {
        this.signedOffDateRange = signedOffDateRange;
    }

    public DateRange getSettledDateRange() {
        return settledDateRange;
    }

    public void setSettledDateRange(DateRange settledDateRange) {
        this.settledDateRange = settledDateRange;
    }

    public DateRange getActualDepartureDateRange() {
        return actualDepartureDateRange;
    }

    public void setActualDepartureDateRange(DateRange actualDepartureDateRange) {
        this.actualDepartureDateRange = actualDepartureDateRange;
    }

    public DateRange getBillOfLadingDateRange() {
        return billOfLadingDateRange;
    }

    public void setBillOfLadingDateRange(DateRange billOfLadingDateRange) {
        this.billOfLadingDateRange = billOfLadingDateRange;
    }

    public CreditorBillingTransactionState getStatus() {
        return status;
    }

    public void setStatus(CreditorBillingTransactionState status) {
        this.status = status;
    }

    public boolean isReversal() {
        return reversal;
    }

    public void setReversal(boolean reversal) {
        this.reversal = reversal;
    }

    public ServiceProviderType getCounterPartyType() {
        return counterPartyType;
    }

    public void setCounterPartyType(ServiceProviderType counterPartyType) {
        this.counterPartyType = counterPartyType;
    }

    public String getTurnInDepotName() {
        return turnInDepotName;
    }

    public void setTurnInDepotName(String turnInDepotName) {
        this.turnInDepotName = turnInDepotName;
    }

    public CreditorBillingTransactionType getTransactionType() {
        return transactionType;
    }

    public void setTransactionType(CreditorBillingTransactionType transactionType) {
        this.transactionType = transactionType;
    }

    public DateRange getDeletedDateRange() {
        return deletedDateRange;
    }

    public void setDeletedDateRange(DateRange deletedDateRange) {
        this.deletedDateRange = deletedDateRange;
    }

    public Incoterm getIncoterm() {
        return incoterm;
    }

    public void setIncoterm(Incoterm incoterm) {
        this.incoterm = incoterm;
    }

    public ContainerType getContainerType() {
        return containerType;
    }

    public void setContainerType(ContainerType containerType) {
        this.containerType = containerType;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        CreditorBillingTransactionSearch search = (CreditorBillingTransactionSearch) o;

        if (reversal != search.reversal) return false;
        if (carrier != null ? !carrier.equals(search.carrier) : search.carrier != null) return false;
        if (freightForwarder != null ? !freightForwarder.equals(search.freightForwarder) : search.freightForwarder != null) return false;
        if (counterPartyType != search.counterPartyType) return false;
        if (billNumber != null ? !billNumber.equals(search.billNumber) : search.billNumber != null) return false;
        if (containerReference != null ? !containerReference.equals(search.containerReference) : search.containerReference != null) return false;
        if (turnInDepotName != null ? !turnInDepotName.equals(search.turnInDepotName) : search.turnInDepotName != null) return false;
        if (transactionType != search.transactionType) return false;
        if (createdDateRange != null ? !createdDateRange.equals(search.createdDateRange) : search.createdDateRange != null) return false;
        if (signedOffDateRange != null ? !signedOffDateRange.equals(search.signedOffDateRange) : search.signedOffDateRange != null) return false;
        if (settledDateRange != null ? !settledDateRange.equals(search.settledDateRange) : search.settledDateRange != null) return false;
        if (deletedDateRange != null ? !deletedDateRange.equals(search.deletedDateRange) : search.deletedDateRange != null) return false;
        if (incoterm != null ? !incoterm.equals(search.incoterm) : search.incoterm != null) return false;
        if (containerType != null ? !containerType.equals(search.containerType) : search.containerType != null) return false;
        if (actualDepartureDateRange != null ? !actualDepartureDateRange.equals(search.actualDepartureDateRange) :
                search.actualDepartureDateRange != null)
            return false;
        if (billOfLadingDateRange != null ? !billOfLadingDateRange.equals(search.billOfLadingDateRange) : search.billOfLadingDateRange != null)
            return false;
        return status == search.status;

    }

    @Override
    public int hashCode() {
        int result = carrier != null ? carrier.hashCode() : 0;
        result = 31 * result + (freightForwarder != null ? freightForwarder.hashCode() : 0);
        result = 31 * result + (counterPartyType != null ? counterPartyType.hashCode() : 0);
        result = 31 * result + (billNumber != null ? billNumber.hashCode() : 0);
        result = 31 * result + (containerReference != null ? containerReference.hashCode() : 0);
        result = 31 * result + (turnInDepotName != null ? turnInDepotName.hashCode() : 0);
        result = 31 * result + (transactionType != null ? transactionType.hashCode() : 0);
        result = 31 * result + (createdDateRange != null ? createdDateRange.hashCode() : 0);
        result = 31 * result + (signedOffDateRange != null ? signedOffDateRange.hashCode() : 0);
        result = 31 * result + (settledDateRange != null ? settledDateRange.hashCode() : 0);
        result = 31 * result + (deletedDateRange != null ? deletedDateRange.hashCode() : 0);
        result = 31 * result + (incoterm != null ? incoterm.hashCode() : 0);
        result = 31 * result + (containerType != null ? containerType.hashCode() : 0);
        result = 31 * result + (actualDepartureDateRange != null ? actualDepartureDateRange.hashCode() : 0);
        result = 31 * result + (billOfLadingDateRange != null ? billOfLadingDateRange.hashCode() : 0);
        result = 31 * result + (reversal ? 1 : 0);
        result = 31 * result + (status != null ? status.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "CreditorBillingTransactionSearch{" +
                "carrier=" + carrier +
                ", freightForwarder=" + freightForwarder +
                ", counterPartyType=" + counterPartyType +
                ", billNumber='" + billNumber + '\'' +
                ", containerReference='" + containerReference + '\'' +
                ", turnInDepotName='" + turnInDepotName + '\'' +
                ", transactionType=" + transactionType +
                ", createdDateRange=" + createdDateRange +
                ", signedOffDateRange=" + signedOffDateRange +
                ", settledDateRange=" + settledDateRange +
                ", deletedDateRange=" + deletedDateRange +
                ", incoterm=" + incoterm +
                ", containerType=" + containerType +
                ", actualDepartureDateRange=" + actualDepartureDateRange +
                ", billOfLadingDateRange=" + billOfLadingDateRange +
                ", reversal=" + reversal +
                ", status=" + status +
                '}';
    }

    @Override
    public String getTableName() {
        return "CreditorBillingTransaction";
    }
}