SupplierDTO.java
package com.tradecloud.dto.api.supplier;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.tradecloud.domain.model.shipment.ShippingMode;
import com.tradecloud.dto.address.AddressDTO;
import com.tradecloud.dto.address.Addressed;
import com.tradecloud.dto.api.agent.ContactDTO;
import com.tradecloud.dto.api.currency.CurrencyDTO;
import com.tradecloud.schema.ISOCurrencyCodeType;
import com.tradecloud.schema.Incoterm;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.xml.bind.annotation.XmlTransient;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* Created by ds on 2017/12/21.
*/
@JsonRootName(value = "supplierDTO")
@JsonIgnoreProperties(ignoreUnknown = true)
@XmlTransient
public class SupplierDTO implements Addressed {
@NotNull
@JsonProperty(required = true)
@JsonPropertyDescription(value = "The name of the supplier.")
private String name;
@NotNull
@JsonProperty(required = true)
@JsonPropertyDescription(value = "The supplier code (A code or shortname to uniquely identify a supplier).")
private String code;
@JsonProperty(required = true)
@JsonPropertyDescription(value = "")
private String paymentTerm;
private String paymentTermDays;
@JsonProperty(required = false)
@JsonPropertyDescription(value = "")
private String paymentMethod;
private String nominatedBank;
@JsonProperty(required = true)
@JsonPropertyDescription(value = "The Incoterm specified on the contract with the supplier.")
private Incoterm incoterm;
@JsonProperty(required = true)
@JsonPropertyDescription(value = "The email address of the contact person at the supplier.")
@Pattern(regexp = "^[\\w-_\\.+]*([\\.\\w])+[\\w]+@([\\w\\-]+\\.)+[a-zA-Z]{2,4}$", message = "Email format is not valid")
private String email;
@JsonProperty
private List<AddressDTO> addresses;
private String organisation;
@XmlTransient
private ISOCurrencyCodeType currency;
private String estimatePaymentBasis1;
@NotNull
private String estimatePaymentBasis2;
private BigDecimal paymentBasisPercentage;
@NotNull
private BigDecimal paymentBasis2Percentage;
private String actualPaymentBasis;
private String salesTaxRegistrationNumber;
private String companyRegistrationNumber;
private String warehouseCode;
private String vatRegistrationNumber;
private String status;
private String placeOfLoading;
private boolean splitPayment;
private BigDecimal lcToleranceAbove;
private BigDecimal lcToleranceBelow;
private String unitPricePerItem;
private boolean allowTranShipment;
private boolean allowPartShipment;
private String clearingAgent;
private Integer presentationDays;
private String advisingBank;
private ShippingMode shippingMode;
private String freightForwarder;
private String transporter;
private String placeOfExpiry;
private List<ContactDTO> contacts;
private List<BankAccountDTO> bankAccounts;
@JsonProperty
private List<CurrencyDTO> allowedCurrencies;
@JsonProperty
private Type type;
private boolean active;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPaymentTerm() {
return paymentTerm;
}
public void setPaymentTerm(String paymentTerm) {
this.paymentTerm = paymentTerm;
}
public String getPaymentTermDays() {
return paymentTermDays;
}
public void setPaymentTermDays(String paymentTermDays) {
this.paymentTermDays = paymentTermDays;
}
public String getPaymentMethod() {
return paymentMethod;
}
public void setPaymentMethod(String paymentMethod) {
this.paymentMethod = paymentMethod;
}
public Incoterm getIncoterm() {
return incoterm;
}
public void setIncoterm(Incoterm incoterm) {
this.incoterm = incoterm;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public com.tradecloud.schema.ISOCurrencyCodeType getCurrency() {
return currency;
}
public void setCurrency(ISOCurrencyCodeType currency) {
this.currency = currency;
}
public String getEstimatePaymentBasis1() {
return estimatePaymentBasis1;
}
public void setEstimatePaymentBasis1(String estimatePaymentBasis1) {
this.estimatePaymentBasis1 = estimatePaymentBasis1;
}
public String getEstimatePaymentBasis2() {
return estimatePaymentBasis2;
}
public void setEstimatePaymentBasis2(String estimatePaymentBasis2) {
this.estimatePaymentBasis2 = estimatePaymentBasis2;
}
public BigDecimal getPaymentBasisPercentage() {
return paymentBasisPercentage;
}
public void setPaymentBasisPercentage(BigDecimal paymentBasisPercentage) {
this.paymentBasisPercentage = paymentBasisPercentage;
}
public BigDecimal getPaymentBasis2Percentage() {
return paymentBasis2Percentage;
}
public void setPaymentBasis2Percentage(BigDecimal paymentBasis2Percentage) {
this.paymentBasis2Percentage = paymentBasis2Percentage;
}
public String getOrganisation() {
return organisation;
}
public void setOrganisation(String organisation) {
this.organisation = organisation;
}
public String getNominatedBank() {
return nominatedBank;
}
public void setNominatedBank(String nominatedBank) {
this.nominatedBank = nominatedBank;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof SupplierDTO)) return false;
SupplierDTO that = (SupplierDTO) o;
return new EqualsBuilder()
.append(getName(), that.getName())
.append(getCode(), that.getCode())
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(getName())
.append(getCode())
.toHashCode();
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getPlaceOfLoading() {
return placeOfLoading;
}
public void setPlaceOfLoading(String placeOfLoading) {
this.placeOfLoading = placeOfLoading;
}
public boolean getSplitPayment() {
return splitPayment;
}
public void setSplitPayment(boolean splitPayment) {
this.splitPayment = splitPayment;
}
public BigDecimal getLcToleranceAbove() {
return lcToleranceAbove;
}
public void setLcToleranceAbove(BigDecimal lcToleranceAbove) {
this.lcToleranceAbove = lcToleranceAbove;
}
public BigDecimal getLcToleranceBelow() {
return lcToleranceBelow;
}
public void setLcToleranceBelow(BigDecimal lcToleranceBelow) {
this.lcToleranceBelow = lcToleranceBelow;
}
public String getUnitPricePerItem() {
return unitPricePerItem;
}
public void setUnitPricePerItem(String unitPricePerItem) {
this.unitPricePerItem = unitPricePerItem;
}
public boolean getAllowTranShipment() {
return allowTranShipment;
}
public void setAllowTranShipment(boolean allowTranShipment) {
this.allowTranShipment = allowTranShipment;
}
public boolean getAllowPartShipment() {
return allowPartShipment;
}
public void setAllowPartShipment(boolean allowPartShipment) {
this.allowPartShipment = allowPartShipment;
}
public String getClearingAgent() {
return clearingAgent;
}
public void setClearingAgent(String clearingAgent) {
this.clearingAgent = clearingAgent;
}
public Integer getPresentationDays() {
return presentationDays;
}
public void setPresentationDays(Integer presentationDays) {
this.presentationDays = presentationDays;
}
public String getAdvisingBank() {
return advisingBank;
}
public void setAdvisingBank(String advisingBank) {
this.advisingBank = advisingBank;
}
public ShippingMode getShippingMode() {
return shippingMode;
}
public void setShippingMode(ShippingMode shippingMode) {
this.shippingMode = shippingMode;
}
public String getFreightForwarder() {
return freightForwarder;
}
public void setFreightForwarder(String freightForwarder) {
this.freightForwarder = freightForwarder;
}
public String getTransporter() {
return transporter;
}
public void setTransporter(String transporter) {
this.transporter = transporter;
}
public String getPlaceOfExpiry() {
return placeOfExpiry;
}
public void setPlaceOfExpiry(String placeOfExpiry) {
this.placeOfExpiry = placeOfExpiry;
}
public List<ContactDTO> getContacts() {
if (contacts == null) {
contacts = new ArrayList<>();
}
return contacts;
}
public void setContacts(List<ContactDTO> contacts) {
this.contacts = contacts;
}
public List<AddressDTO> getAddresses() {
if (addresses == null) {
addresses = new ArrayList<>();
}
return addresses;
}
public void setAddresses(List<AddressDTO> addresses) {
this.addresses = addresses;
}
public String getActualPaymentBasis() {
return actualPaymentBasis;
}
public void setActualPaymentBasis(String actualPaymentBasis) {
this.actualPaymentBasis = actualPaymentBasis;
}
public String getSalesTaxRegistrationNumber() {
return salesTaxRegistrationNumber;
}
public void setSalesTaxRegistrationNumber(String salesTaxRegistrationNumber) {
this.salesTaxRegistrationNumber = salesTaxRegistrationNumber;
}
public String getCompanyRegistrationNumber() {
return companyRegistrationNumber;
}
public void setCompanyRegistrationNumber(String companyRegistrationNumber) {
this.companyRegistrationNumber = companyRegistrationNumber;
}
public String getWarehouseCode() {
return warehouseCode;
}
public void setWarehouseCode(String warehouseCode) {
this.warehouseCode = warehouseCode;
}
public String getVatRegistrationNumber() {
return vatRegistrationNumber;
}
public void setVatRegistrationNumber(String vatRegistrationNumber) {
this.vatRegistrationNumber = vatRegistrationNumber;
}
public boolean isSplitPayment() {
return splitPayment;
}
public boolean isAllowTranShipment() {
return allowTranShipment;
}
public boolean isAllowPartShipment() {
return allowPartShipment;
}
public List<BankAccountDTO> getBankAccounts() {
if (bankAccounts == null) {
bankAccounts = new ArrayList<>();
}
return bankAccounts;
}
public void setBankAccounts(List<BankAccountDTO> bankAccounts) {
this.bankAccounts = bankAccounts;
}
public Type getType() {
return type;
}
public void setType(Type type) {
this.type = type;
}
public boolean isActive() {
return active;
}
public void setActive(boolean active) {
this.active = active;
}
public List<CurrencyDTO> getAllowedCurrencies() {
return allowedCurrencies;
}
public void setAllowedCurrencies(List<CurrencyDTO> allowedCurrencies) {
this.allowedCurrencies = allowedCurrencies;
}
}