ValueDeterminationNumber.java

package com.tradecloud.domain.item;

import com.tradecloud.common.base.PersistenceBase;
import com.tradecloud.domain.costing.CostLineTemplate;

import javax.persistence.*;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import java.math.BigDecimal;
import java.util.LinkedHashSet;
import java.util.Set;

@Entity
@Table(name = "ValueDeterminationNumber")
@Access(AccessType.FIELD)
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "ValueDeterminationNumber")
public class ValueDeterminationNumber extends PersistenceBase {
    private String number;
    private BigDecimal discount;
    private BigDecimal margin;
    @ManyToMany
    @XmlTransient
    private Set<CostLineTemplate> costLineTemplates = new LinkedHashSet<>();//dutiable costline template will be stored

    public ValueDeterminationNumber() {
    }

    public ValueDeterminationNumber(ValueDeterminationNumber vdn) {
        if (vdn != null) {
            this.number = vdn.getNumber();
            this.discount = vdn.getDiscount();
            this.margin = vdn.getMargin();
            costLineTemplates.addAll(vdn.costLineTemplates);
        }
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public BigDecimal getDiscount() {
        return discount;
    }

    public void setDiscount(BigDecimal discount) {
        this.discount = discount;
    }

    public BigDecimal getMargin() {
        return margin;
    }

    public void setMargin(BigDecimal margin) {
        this.margin = margin;
    }

    public Set<CostLineTemplate> getCostLineTemplates() {
        return costLineTemplates;
    }

    public void setCostLineTemplates(Set<CostLineTemplate> costLineTemplates) {
        this.costLineTemplates = costLineTemplates;
    }
}