CostLineOverride.java

package com.tradecloud.domain.item;

import com.tradecloud.domain.common.Currency;
import com.tradecloud.domain.costing.CostLineTemplate;

import java.math.BigDecimal;
import java.util.Objects;

/**
 * use for integration override to avoid double costing costing.
 */

public class CostLineOverride {

    private CostLineTemplate costLineTemplate;
    //can be used as percentage for percentage costline
    private BigDecimal amount;
    private BigDecimal percentAmount;
    private Currency currency;

    public CostLineOverride(CostLineTemplate costLineTemplate, BigDecimal amount, Currency currency, BigDecimal percentAmount) {
        this.costLineTemplate = costLineTemplate;
        this.amount = amount;
        this.currency = currency;
        this.percentAmount = percentAmount;
    }

    public CostLineTemplate getCostLineTemplate() {
        return costLineTemplate;
    }

    public void setCostLineTemplate(CostLineTemplate costLineTemplate) {
        this.costLineTemplate = costLineTemplate;
    }

    public BigDecimal getAmount() {
        return amount;
    }

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

    public Currency getCurrency() {
        return currency;
    }

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

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        CostLineOverride that = (CostLineOverride) o;
        return Objects.equals(costLineTemplate, that.costLineTemplate);
    }

    @Override
    public int hashCode() {
        return Objects.hash(costLineTemplate);
    }

    public BigDecimal getPercentAmount() {
        return percentAmount;
    }

    public void setPercentAmount(BigDecimal percentAmount) {
        this.percentAmount = percentAmount;
    }
}