LetterOfCreditTenor.java

package com.tradecloud.domain.letterofcredit;

import com.tradecloud.common.base.PersistenceBase;
import com.tradecloud.domain.model.Money;
import com.tradecloud.domain.model.payment.PaymentMethod;
import com.tradecloud.domain.model.payment.PaymentTerm;
import org.hibernate.annotations.ForeignKey;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * https://connect.devstream.net/display/Dev/Create+Letter+of+Credit.
 */
@Entity
@Table(name = "letterofcredittenor")
@Access(AccessType.FIELD)
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Tenor")
public class LetterOfCreditTenor extends PersistenceBase implements Serializable {

    @Embedded
    @AttributeOverrides({
            @AttributeOverride(name = "currency", column = @Column(name = "amount_currency", nullable = false)),
            @AttributeOverride(name = "value", column = @Column(name = "amount_value", nullable = false))})
    private Money amount;

    @NotNull
    @ManyToOne
    @ForeignKey(name = "fk_paymentmethod")
    private PaymentMethod tenor;

    @NotNull
    @ManyToOne
    @ForeignKey(name = "fk_paymentterm")
    private PaymentTerm days;

    @Enumerated(EnumType.STRING)
    private LetterOfCreditTenorTerms tenorTerms;

    private String drawnOn;

    @Enumerated(EnumType.STRING)
    private LetterOfCreditAmountSpecification amountSpecification;

    private boolean draftsRequired;

    @NotNull
    private BigDecimal toleranceAbove;

    @NotNull
    private BigDecimal toleranceBelow;

    public boolean isDraftsRequired() {
        return draftsRequired;
    }

    public void setDraftsRequired(boolean draftsRequired) {
        this.draftsRequired = draftsRequired;
    }

    public String getDrawnOn() {
        return drawnOn;
    }

    public void setDrawnOn(String drawnOn) {
        this.drawnOn = drawnOn;
    }

    public Money getAmount() {
        return amount;
    }

    public void setAmount(Money amount) {
        this.amount = amount;
    }

    public PaymentMethod getTenor() {
        return tenor;
    }

    public void setTenor(PaymentMethod tenor) {
        this.tenor = tenor;
    }

    public PaymentTerm getDays() {
        return days;
    }

    public void setDays(PaymentTerm days) {
        this.days = days;
    }

    public LetterOfCreditTenorTerms getTenorTerms() {
        return tenorTerms;
    }

    public void setTenorTerms(LetterOfCreditTenorTerms tenorTerms) {
        this.tenorTerms = tenorTerms;
    }

    public BigDecimal getToleranceAbove() {
        return toleranceAbove;
    }

    public void setToleranceAbove(BigDecimal toleranceAbove) {
        this.toleranceAbove = toleranceAbove;
    }

    public BigDecimal getToleranceBelow() {
        return toleranceBelow;
    }

    public void setToleranceBelow(BigDecimal toleranceBelow) {
        this.toleranceBelow = toleranceBelow;
    }

    public LetterOfCreditAmountSpecification getAmountSpecification() {
        return amountSpecification;
    }

    public void setAmountSpecification(LetterOfCreditAmountSpecification amountSpecification) {
        this.amountSpecification = amountSpecification;
    }

}