ItacConfig.java

package com.tradecloud.domain.configuration;

import com.tradecloud.common.base.PersistenceBase;
import com.tradecloud.converter.CpcLinkTypesConverter;
import com.tradecloud.domain.configuration.clearing.za.PurposeCode;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import java.util.HashSet;
import java.util.Set;

@Entity
@Table(name = "itac_config")
@Access(AccessType.FIELD)
@XmlAccessorType(XmlAccessType.FIELD)
@Getter
@Setter
public class ItacConfig extends PersistenceBase {

    //TFG-5301 Configuration Summate ITAC Permit forecasts and utilization by Order
    private boolean utiliseByItem = true;
    private boolean useCommercialInvoice = true;
    private boolean defaultVolume = true;
    private Boolean active = true;
    private Integer forecastCleanup;

    //TFG-5304 Change trigger for forecast as a config, either order finalised (past the point of tariffing) or shipment creation
    @Enumerated(EnumType.STRING)
    private ForeCastPoint foreCastPoint = ForeCastPoint.ORDER_FINALISED;

    //TFG-5303 Config to Link specific CPC codes to ITAC permits for Utilisation and forecast.
    @Convert(converter = CpcLinkTypesConverter.class)
    private Set<PurposeCode> rebateForeCastTypes = new HashSet<>();

    @Convert(converter = CpcLinkTypesConverter.class)
    private Set<PurposeCode> rebateUtilisationTypes = new HashSet<>();

    @Convert(converter = CpcLinkTypesConverter.class)
    private Set<PurposeCode> finishedGoodsForeCastTypes = new HashSet<>();

    @Convert(converter = CpcLinkTypesConverter.class)
    private Set<PurposeCode> finishedGoodsUtilisationTypes = new HashSet<>();

    @Override
    public Boolean getActive() {
        if (active == null) {
            return false;
        }
        return active;
    }

    public void setActive(Boolean active) {
        this.active = active;
    }
}