ExportRateSearch.java

package com.tradecloud.dto.rate;

import com.tradecloud.domain.export.ExportParty;
import com.tradecloud.domain.model.shipment.ShippingMode;
import com.tradecloud.domain.place.Depot;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

@Component
@Scope("view")
@Getter
@Setter
public class ExportRateSearch extends RateSearch {

    private ExportParty exportParty;

    private Depot depot;

    private ShippingMode shippingMode;
    private ShippingMode multiModalShippingMode;

    public ExportRateSearch() {

    }

    public ExportRateSearch(ExportRateSearch rateSearch) {
        super(rateSearch);
        this.exportParty = rateSearch.getExportParty();
        this.depot = rateSearch.getDepot();
        this.organisationalUnit = rateSearch.getOrganisationalUnit();
        this.shippingMode = rateSearch.getShippingMode();
        this.multiModalShippingMode = rateSearch.getMultiModalShippingMode();
    }

    public ExportParty getExportParty() {
        return exportParty;
    }

    public void setExportParty(ExportParty exportParty) {
        this.exportParty = exportParty;
    }

    public Depot getDepot() {
        return depot;
    }

    public void setDepot(Depot depot) {
        this.depot = depot;
    }

    public ShippingMode getShippingMode() {
        return shippingMode;
    }

    public void setShippingMode(ShippingMode shippingMode) {
        this.shippingMode = shippingMode;
    }

    public void reset() {
        super.reset();
        this.exportParty = null;
        this.depot = null;
        this.organisationalUnit = null;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        ExportRateSearch that = (ExportRateSearch) o;
        return new EqualsBuilder().append(exportParty, that.getExportParty()).append(depot, that.getDepot())
                .append(multiModalShippingMode, that.multiModalShippingMode)
                .isEquals();
    }

    @Override
    public int hashCode() {
        return generate(getCostingType(),
                getCostLine(), getCurrency(), getEffectiveDateLower(), getEffectiveDateUpper(), getOrganisationalUnit(), getPriorityConfig(),
                getExportParty(), getDepot(), getShippingMode(), getSearchMetaParams(), getRateUnit(), getMultiModalShippingMode());

    }
}