BOEReportLine.java

package com.tradecloud.domain.shipment.clearing;

import com.tradecloud.common.base.PersistenceBase;
import com.tradecloud.domain.duties.RulesOfOrigin;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.xml.bind.annotation.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Objects;

@XmlRootElement(name = "APDPSearchResult")
@XmlAccessorType(XmlAccessType.FIELD)
@Entity
@Getter
@Setter
public class BOEReportLine extends PersistenceBase {

    @ManyToOne(fetch = FetchType.LAZY)
    private BOEReport boeReport;

    @XmlAttribute
    private String number;
    @XmlElement(name = "itemReference")
    private String itemReference = "";
    @XmlElement(name = "supplierCode")
    private String supplierCode = "";
    @XmlElement(name = "supplierName")
    private String supplierName = "";
    @XmlElement(name = "finalDestination")
    private String finalDestination = "";
    @XmlElement(name = "incoTerm")
    private String incoTerm = "";
    @XmlElement(name = "dutyPercentage")
    private BigDecimal dutyPercentage = new BigDecimal(0.0);
    @XmlElement(name = "mrn")
    private String mrn = "";
    @XmlElement(name = "placeOfEntry")
    private String placeOfEntry = "";
    private Date boeDate = new Date();
    @XmlElement(name = "boeNumber")
    private String boeNumber = "";
    @XmlElement(name = "lineNumber")
    private String lineNumber = "";
    @XmlElement(name = "masterBill")
    private String masterBill = "";
    @XmlElement(name = "houseBill")
    private String houseBill = "";
    @XmlElement(name = "lrnNumber")
    private String lrnNumber = "";
    @XmlElement(name = "cpcCode")
    private String cpcCode = "";
    @XmlElement(name = "countryOfOrigin")
    private String countryOfOrigin = "";
    @XmlElement(name = "costingQty")
    private BigDecimal costingQty = BigDecimal.ZERO;
    @XmlElement(name = "currency")
    private String currency;
    @XmlElement(name = "basicCost")
    private BigDecimal basicCost = new BigDecimal(0.0);
    @XmlElement(name = "unitForeignValue")
    private BigDecimal unitForeignValue = new BigDecimal(0.0);
    @XmlElement(name = "rateInverted")
    private BigDecimal rateInverted = new BigDecimal(0.0);
    @XmlElement(name = "zarFobHd")
    private BigDecimal zarFobHd = new BigDecimal(0.0);
    @XmlElement(name = "shipmentReference")
    private String shipmentReference = "";
    @XmlElement(name = "tariff")
    private String tariff = "";
    @XmlElement(name = "duty")
    private BigDecimal duty = new BigDecimal(0.0);
    @XmlElement(name = "vat")
    private BigDecimal vat = new BigDecimal(0.0);
    @XmlElement(name = "previousMRN")
    private String previousMRN = "";
    @XmlElement(name = "agentReference")
    private String agentReference = "";
    @XmlElement(name = "customsQty")
    private BigDecimal customsQty = new BigDecimal(0.0);
    @XmlElement(name = "customsUQ")
    private BigDecimal customsUQ = new BigDecimal(0.0);
    @XmlElement(name = "grossWeight")
    private BigDecimal grossWeight = new BigDecimal(0.0);
    @XmlElement(name = "boePurposeCode")
    private String boePurposeCode = "";
    @XmlElement(name = "invoiceNumber")
    private String invoiceNumber = "";
    @XmlElement(name = "customsStatus")
    private String customsStatus = "";
    @XmlElement(name = "customsStatusDate")
    private Date customsStatusDate;
    @XmlElement(name = "division")
    private String division = "";
    @XmlElement(name = "clearingAgent")
    private String clearingAgent = "";
    @XmlElement(name = "deliveryNoteNumber")
    private String deliveryNoteNumber = "";
    @XmlAttribute
    private String rulesOfOrigin = "";
    @XmlAttribute
    private String freightForwarder;
    @XmlAttribute
    private String tradeStatistics;
    private String customsUnit;

    private String invoiceLineNumber;
    private BigDecimal additionalQuantity;
    private String additionalQuantityUOM;
    private Date assessmentDate;
    private BigDecimal atvAmount;
    private String containerMode;
    private Date ccdCreatedDate;
    private Date dischargeDate;
    private Date rateOfExchangeDate;
    private String flightVoyageNumber;
    private String goodsDescription;
    private String grossWeightUOM;
    private String importerCode;
    private String importerName;
    private BigDecimal invoiceExchangeRate;
    private BigDecimal invoiceUQ;
    private Date masterBillIssueDate;
    private String portOfDischarge;
    private String portOfLoading;
    private String previousMRNLine;
    private String rebateCode;
    private BigDecimal rebateValue;
    private BigDecimal freightAmount;
    private String relationshipIndicator;
    private String shipmentType = "IMP";
    private String taxOrFree;
    private String tradeAgreementROO;
    private String shippingMode;
    private String valuationCode;
    private String pccCode;
    private String paymentMethod;
    private String customsFinancialAccountOwner;
    private String schedule1P2A;
    private String schedule1P2B;
    private String schedule1P3E;
    private String schedule1P7;

    public String getRulesOfOrigin() {
        if (rulesOfOrigin == null || rulesOfOrigin.trim().isEmpty())
            return RulesOfOrigin.NODOO.value();
        return rulesOfOrigin;
    }

    @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;
        BOEReportLine that = (BOEReportLine) o;
        return Objects.equals(getItemReference(), that.getItemReference()) && Objects.equals(getSupplierCode(),
                that.getSupplierCode()) && Objects.equals(getSupplierName(), that.getSupplierName()) &&
                Objects.equals(getFinalDestination(), that.getFinalDestination()) &&
                Objects.equals(getIncoTerm(), that.getIncoTerm()) && Objects.equals(getDutyPercentage(), that.getDutyPercentage()) &&
                Objects.equals(getMrn(), that.getMrn()) && Objects.equals(getPlaceOfEntry(), that.getPlaceOfEntry()) &&
                Objects.equals(getBoeDate(), that.getBoeDate()) && Objects.equals(getBoeNumber(), that.getBoeNumber()) &&
                Objects.equals(getLineNumber(), that.getLineNumber()) && Objects.equals(getCpcCode(), that.getCpcCode()) &&
                Objects.equals(getCountryOfOrigin(), that.getCountryOfOrigin()) && Objects.equals(getCostingQty(), that.getCostingQty()) &&
                Objects.equals(getCurrency(), that.getCurrency()) && Objects.equals(getBasicCost(), that.getBasicCost()) &&
                Objects.equals(getUnitForeignValue(), that.getUnitForeignValue()) && Objects.equals(getRateInverted(),
                that.getRateInverted()) && Objects.equals(getZarFobHd(), that.getZarFobHd()) && Objects.equals(getShipmentReference(),
                that.getShipmentReference()) && Objects.equals(getTariff(), that.getTariff()) && Objects.equals(getDuty(),
                that.getDuty()) && Objects.equals(getVat(), that.getVat()) && Objects.equals(getPreviousMRN(),
                that.getPreviousMRN()) && Objects.equals(getAgentReference(), that.getAgentReference()) &&
                Objects.equals(getCustomsQty(), that.getCustomsQty()) && Objects.equals(getCustomsUQ(), that.getCustomsUQ()) &&
                Objects.equals(getGrossWeight(), that.getGrossWeight()) && Objects.equals(getBoePurposeCode(), that.getBoePurposeCode()) &&
                Objects.equals(getInvoiceNumber(), that.getInvoiceNumber()) && Objects.equals(getCustomsStatus(),
                that.getCustomsStatus()) && Objects.equals(getDivision(), that.getDivision()) && Objects.equals(getClearingAgent(),
                that.getClearingAgent())
                && Objects.equals(getDeliveryNoteNumber(), that.getDeliveryNoteNumber()) && Objects.equals(getRulesOfOrigin(),
                that.getRulesOfOrigin());
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), getItemReference(), getSupplierCode(), getSupplierName(), getMrn(),
                getPlaceOfEntry(), getBoeDate(), getBoeNumber(), getLineNumber(), getCpcCode(), getCountryOfOrigin(),
                getCostingQty(), getCurrency(), getBasicCost(), getUnitForeignValue(), getRateInverted(), getZarFobHd(),
                getShipmentReference(), getTariff(), getDuty(), getVat(), getPreviousMRN(), getAgentReference(), getCustomsQty(),
                getCustomsUQ(), getGrossWeight(), getBoePurposeCode(), getInvoiceNumber(), getCustomsStatus(), getDivision(),
                getClearingAgent(), getDeliveryNoteNumber(), getRulesOfOrigin());
    }

    public void setSchedule1P2A(String schedule1P2A) {
        this.schedule1P2A = schedule1P2A;
    }

    public String getSchedule1P2A() {
        return schedule1P2A;
    }

    public void setSchedule1P2B(String schedule1P2B) {
        this.schedule1P2B = schedule1P2B;
    }

    public String getSchedule1P2B() {
        return schedule1P2B;
    }

    public void setSchedule1P3E(String schedule1P3E) {
        this.schedule1P3E = schedule1P3E;
    }

    public String getSchedule1P3E() {
        return schedule1P3E;
    }

    public void setSchedule1P7(String schedule1P7) {
        this.schedule1P7 = schedule1P7;
    }

    public String getSchedule1P7() {
        return schedule1P7;
    }
}