PlannedSettlementSearch.java

package com.tradecloud.dto.plannedsettlement;

import com.tradecloud.domain.base.utils.ObjectUtil;
import com.tradecloud.domain.common.Currency;
import com.tradecloud.domain.document.PaymentState;
import com.tradecloud.domain.dto.base.SearchBase;
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.party.Employee;
import com.tradecloud.domain.supplier.OrganisationalUnitSupplier;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import java.util.List;

/**
 * Created by ds on 2017/06/05.
 */
@Component
@Scope("view")
public class PlannedSettlementSearch extends SearchBase implements Serializable {

    private OrganisationalUnit organisationalUnit;
    private Collection<OrganisationalUnit> organisationalUnits;
    private OrganisationalUnitSupplier supplier;
    private String orderReference;
    private String invoiceReference;
    private String shipmentReference;
    private Currency currency;
    private Date settlementDateFrom;
    private Date settlementDateTo;
    private PaymentState paymentState;
    private List<PaymentState> paymentStates;
    private Employee buyer;
    private OrderState state;
    private List<String> shippingReferences;
    private String shippingReference;
    private List<String> orderReferences;
    private boolean ordersOnly;
    private String paymentPercentage;
    private Date paymentDateFrom;
    private Date paymentDateTo;
    private String paymentReference;
    private PaymentTerm paymentTerm;
    private PaymentMethod paymentMethod;
    private String settledInFull;
    private boolean paging;
    private Long plannedSettlementIdToExclude;

    private Date createdDateFrom;

    private Date createdDateTo;

    public OrganisationalUnit getOrganisationalUnit() {
        return organisationalUnit;
    }

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

    public OrganisationalUnitSupplier getSupplier() {
        return supplier;
    }

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

    public String getOrderReference() {
        return orderReference;
    }

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

    public String getInvoiceReference() {
        return invoiceReference;
    }

    public void setInvoiceReference(String invoiceReference) {
        this.invoiceReference = invoiceReference;
    }

    public String getShipmentReference() {
        return shipmentReference;
    }

    public void setShipmentReference(String shipmentReference) {
        this.shipmentReference = shipmentReference;
    }

    public Currency getCurrency() {
        return currency;
    }

    public void setCurrency(Currency currency) {
        this.currency = currency;
    }

    public Date getSettlementDateFrom() {
        return settlementDateFrom;
    }

    public void setSettlementDateFrom(Date settlementDateFrom) {
        this.settlementDateFrom = settlementDateFrom;
    }

    public Date getSettlementDateTo() {
        return settlementDateTo;
    }

    public void setSettlementDateTo(Date settlementDateTo) {
        this.settlementDateTo = settlementDateTo;
    }

    public PaymentState getPaymentState() {
        return paymentState;
    }

    public void setPaymentState(PaymentState paymentState) {
        this.paymentState = paymentState;
    }

    public Employee getBuyer() {
        return buyer;
    }

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

    public Collection<OrganisationalUnit> getOrganisationalUnits() {
        return organisationalUnits;
    }

    public void setOrganisationalUnits(Collection<OrganisationalUnit> organisationalUnits) {
        this.organisationalUnits = organisationalUnits;
    }

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

    @Override
    public String toString() {
        return new ToStringBuilder(this).append("organisationalUnit", organisationalUnit).append("supplier", supplier).
                append("orderReference", orderReference).append("invoiceReference", invoiceReference)
                .append("currency", currency).append("settlementDateFrom", settlementDateFrom)
                .append("settlementDateTo", settlementDateTo).append("paymentState", paymentState).
                        append("buyer", buyer).toString();

    }

    @Override
    public boolean noSelectedOrgUnit() {
        return ObjectUtil.allNull(organisationalUnit, organisationalUnits);
    }

    public OrderState getState() {
        return state;
    }

    public void setState(OrderState state) {
        this.state = state;
    }

    public void setShippingReference() {
    }

    public List<String> getShippingReferences() {
        return shippingReferences;
    }

    public void setShippingReferences(List<String> shippingReferences) {
        this.shippingReferences = shippingReferences;
    }

    public List<String> getOrderReferences() {
        return orderReferences;
    }

    public void setOrderReferences(List<String> orderReferences) {
        this.orderReferences = orderReferences;
    }

    public boolean isOrdersOnly() {
        return ordersOnly;
    }

    public void setOrdersOnly(boolean ordersOnly) {
        this.ordersOnly = ordersOnly;
    }

    public String getPaymentPercentage() {
        return paymentPercentage;
    }

    public void setPaymentPercentage(String paymentPercentage) {
        this.paymentPercentage = paymentPercentage;
    }

    public Date getPaymentDateFrom() {
        return paymentDateFrom;
    }

    public void setPaymentDateFrom(Date paymentDateFrom) {
        this.paymentDateFrom = paymentDateFrom;
    }

    public Date getPaymentDateTo() {
        return paymentDateTo;
    }

    public void setPaymentDateTo(Date paymentDateTo) {
        this.paymentDateTo = paymentDateTo;
    }

    public String getPaymentReference() {
        return paymentReference;
    }

    public void setPaymentReference(String paymentReference) {
        this.paymentReference = paymentReference;
    }

    public String getShippingReference() {
        return shippingReference;
    }

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

    public PaymentTerm getPaymentTerm() {
        return paymentTerm;
    }

    public void setPaymentTerm(PaymentTerm paymentTerm) {
        this.paymentTerm = paymentTerm;
    }

    public PaymentMethod getPaymentMethod() {
        return paymentMethod;
    }

    public void setPaymentMethod(PaymentMethod paymentMethod) {
        this.paymentMethod = paymentMethod;
    }

    public String getSettledInFull() {

        return settledInFull;
    }

    public void setSettledInFull(String settledInFull) {
        if(settledInFull==null){
            paymentState=null;
        }else if(settledInFull.equalsIgnoreCase("NO")){
            paymentState=PaymentState.UNSETTLED;
        }else if(settledInFull.equalsIgnoreCase("YES")){
            paymentState=PaymentState.SETTLED;
        }

        this.settledInFull = settledInFull;
    }

    public boolean isPaging() {
        return paging;
    }

    public void setPaging(boolean paging) {
        this.paging = paging;
    }

    public Long getPlannedSettlementIdToExclude() {
        return plannedSettlementIdToExclude;
    }

    public void setPlannedSettlementIdToExclude(Long plannedSettlementIdToExclude) {
        this.plannedSettlementIdToExclude = plannedSettlementIdToExclude;
    }

    public Date getCreatedDateFrom() {
        return createdDateFrom;
    }

    public void setCreatedDateFrom(Date createdDateFrom) {
        this.createdDateFrom = createdDateFrom;
    }

    public Date getCreatedDateTo() {
        return createdDateTo;
    }

    public void setCreatedDateTo(Date createdDateTo) {
        this.createdDateTo = createdDateTo;
    }

    public List<PaymentState> getPaymentStates() {
        return paymentStates;
    }

    public void setPaymentStates(List<PaymentState> paymentStates) {
        this.paymentStates = paymentStates;
    }
}