ForexSearch.java

package com.tradecloud.dto.forex;

import com.tradecloud.domain.common.Currency;
import com.tradecloud.domain.costing.CostLinePayerType;
import com.tradecloud.domain.dto.base.SearchBase;
import com.tradecloud.domain.model.organisationalunit.OrganisationalUnit;
import com.tradecloud.domain.rate.RateSourceType;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

import java.util.Date;

/**
 * Created by ds on 2016/10/26.
 */
public class ForexSearch extends SearchBase {

    private Currency transactionCurrency;
    private Date maturityDate;
    private Date dealDate;
    private OrganisationalUnit orgUnit;
    private Currency costingCurrency;
    RateSourceType rateSourceType;
    private CostLinePayerType costLinePayerType;


    public ForexSearch(Currency transactionCurrency, Date maturityDate, OrganisationalUnit orgUnit, Currency costingCurrency) {
        this.transactionCurrency = transactionCurrency;
        this.maturityDate = maturityDate;
        this.orgUnit = orgUnit;
        this.costingCurrency = costingCurrency;
    }

    public ForexSearch(Currency transactionCurrency, Date maturityDate, Currency costingCurrency) {
        this.transactionCurrency = transactionCurrency;
        this.maturityDate = maturityDate;
        this.costingCurrency = costingCurrency;
    }

    public ForexSearch(Currency transactionCurrency, Date maturityDate, Currency costingCurrency, CostLinePayerType costLinePayerType) {
        this.transactionCurrency = transactionCurrency;
        this.maturityDate = maturityDate;
        this.costingCurrency = costingCurrency;
        this.costLinePayerType=costLinePayerType;
    }

    public ForexSearch(Currency transactionCurrency, Currency costingCurrency) {
        this.transactionCurrency = transactionCurrency;
        this.costingCurrency = costingCurrency;
    }

    public ForexSearch(Currency transactionCurrency, Currency costingCurrency, CostLinePayerType costLinePayerType) {
        this.transactionCurrency = transactionCurrency;
        this.costingCurrency = costingCurrency;
        this.costLinePayerType = costLinePayerType;
        this.costLinePayerType=costLinePayerType;
    }

    public ForexSearch() {
    }

    public Currency getTransactionCurrency() {
        return transactionCurrency;
    }

    public void setTransactionCurrency(Currency transactionCurrency) {
        this.transactionCurrency = transactionCurrency;
    }

    public Date getMaturityDate() {
        return maturityDate;
    }

    public void setMaturityDate(Date maturityDate) {
        this.maturityDate = maturityDate;
    }

    public OrganisationalUnit getOrgUnit() {
        return orgUnit;
    }

    public void setOrgUnit(OrganisationalUnit orgUnit) {
        this.orgUnit = orgUnit;
    }

    public Currency getCostingCurrency() {
        return costingCurrency;
    }

    public void setCostingCurrency(Currency costingCurrency) {
        this.costingCurrency = costingCurrency;
    }

    public Date getDealDate() {
        return dealDate;
    }

    public void setDealDate(Date dealDate) {
        this.dealDate = dealDate;
    }

    public RateSourceType getRateSourceType() {
        return rateSourceType;
    }

    public void setRateSourceType(RateSourceType rateSourceType) {
        this.rateSourceType = rateSourceType;
    }

    public CostLinePayerType getCostLinePayerType() {
        return costLinePayerType;
    }

    public void setCostLinePayerType(CostLinePayerType costLinePayerType) {
        this.costLinePayerType = costLinePayerType;
    }

    @Override
    public String getTableName() {
        return null;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ForexSearch that = (ForexSearch) o;
        return new EqualsBuilder().append(transactionCurrency,that.transactionCurrency).append(maturityDate,that.maturityDate).
                append(dealDate,that.dealDate).append(orgUnit,that.orgUnit).append(costingCurrency,that.costingCurrency).
                append(rateSourceType,that.rateSourceType).append(costLinePayerType,that.costLinePayerType).isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder().append(transactionCurrency).append(maturityDate).append(dealDate).
                append(orgUnit).append(costingCurrency).append(rateSourceType).append(costLinePayerType).toHashCode();
    }
}