AgentDTO.java

package com.tradecloud.dto.api.agent;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.tradecloud.domain.agent.AgentType;
import com.tradecloud.dto.address.AddressDTO;
import com.tradecloud.schema.ISOCurrencyCodeType;
import com.tradecloud.dto.address.Addressed;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.persistence.Access;
import javax.persistence.AccessType;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by ds on 2017/12/21.
 */
@Access(AccessType.FIELD)
@JsonRootName(value = "agentDTO")
@ApiModel(value = "AgentDTO", description = "This is Agent Model for Create/Update/View")
public class AgentDTO implements Addressed {

    @JsonProperty(required = true)
    @JsonPropertyDescription(value = "The agent name.")
    @ApiModelProperty(value = "agent name")
    private String name;

    @JsonProperty(required = false)
    @JsonPropertyDescription(value = "")
    @ApiModelProperty(value = "agent email", required = true)
    private String email;

    @JsonProperty(required = false)
    @JsonPropertyDescription(value = "")
    private String phone;

    @JsonProperty(required = true)
    @JsonPropertyDescription(value = "")
    @ApiModelProperty(required = true)
    private String organisation;

    @JsonProperty(required = true)
    @JsonPropertyDescription(value = "The agent reference/code.")
    @ApiModelProperty(value = "agent code", required = true)
    private String code;

    @JsonProperty(required = true)
    @JsonPropertyDescription(value = "")
    private String paymentTerm;

    @JsonProperty(required = false)
    @JsonPropertyDescription(value = "The payment method for the agent.")
    private String paymentMethod;

    @JsonProperty(required = true)
    @JsonPropertyDescription(value = "")
    private String paymentBasis;

    @JsonProperty(required = false)
    @JsonPropertyDescription(value = "")
    private List<AddressDTO> addresses;

    @JsonProperty(required = true)
    @JsonPropertyDescription(value = "")
    private ISOCurrencyCodeType currency;

    @JsonProperty(required = true)
    @JsonPropertyDescription(value = "")
    private BigDecimal rate;

    @JsonProperty(required = true)
    @JsonPropertyDescription(value = "")
    private Date effectiveDate;

    @JsonProperty(required = false)
    @JsonPropertyDescription(value = "")
    private String supplier;

    @JsonProperty(required = false)
    @JsonPropertyDescription(value = "")
    private List<ContactDTO> contacts;

    @JsonProperty(required = true)
    @JsonPropertyDescription(value = "")
    private String costApplicationBasis;

    @JsonProperty(required = true)
    @JsonPropertyDescription(value = "")
    private AgentType agentType;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getOrganisation() {
        return organisation;
    }

    public void setOrganisation(String organisation) {
        this.organisation = organisation;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getPaymentTerm() {
        return paymentTerm;
    }

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

    public String getPaymentMethod() {
        return paymentMethod;
    }

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

    public String getPaymentBasis() {
        return paymentBasis;
    }

    public void setPaymentBasis(String paymentBasis) {
        this.paymentBasis = paymentBasis;
    }

    @Override
    public List<AddressDTO> getAddresses() {
        return addresses;
    }

    public void setAddresses(List<AddressDTO> addresses) {
        this.addresses = addresses;
    }

    public ISOCurrencyCodeType getCurrency() {
        return currency;
    }

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

    public BigDecimal getRate() {
        return rate;
    }

    public void setRate(BigDecimal rate) {
        this.rate = rate;
    }

    public Date getEffectiveDate() {
        return effectiveDate;
    }

    public void setEffectiveDate(Date effectiveDate) {
        this.effectiveDate = effectiveDate;
    }

    public String getSupplier() {
        return supplier;
    }

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

    public List<ContactDTO> getContacts() {
        if (contacts == null) {
            contacts = new ArrayList<>();
        }
        return contacts;
    }

    public void setContacts(List<ContactDTO> contacts) {
        this.contacts = contacts;
    }

    public String getCostApplicationBasis() {
        return costApplicationBasis;
    }

    public void setCostApplicationBasis(String costApplicationBasis) {
        this.costApplicationBasis = costApplicationBasis;
    }

    public AgentType getAgentType() {
        return agentType;
    }

    public void setAgentType(AgentType agentType) {
        this.agentType = agentType;
    }
}