ShipmentClientConfig.java

package com.tradecloud.domain.configuration;

import com.tradecloud.common.base.PersistenceBase;
import com.tradecloud.domain.model.shipment.ShipmentState;
import com.tradecloud.domain.party.ServiceProvider;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.ForeignKey;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * A holder for shipment client configuration values.
 */
@Entity
@Table(name = "shipmentclientconfig")
@Access(AccessType.FIELD)
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "ShipmentClientConfig")
@Getter
@Setter
public class ShipmentClientConfig extends PersistenceBase {

    private static final long serialVersionUID = 1L;

    /**
     * Defaults to true.
     */
    @XmlAttribute
    @NotNull
    private boolean forceUnsignOffReason;

    @XmlAttribute
    @NotNull
    private boolean createPartShipmentOnCommercialInvoiceSignOff;

    /**
     * Defaults to false.
     */
    @XmlAttribute
    @NotNull
    private boolean allowDifferentShippingModeLinking;

    @XmlAttribute
    @NotNull
    private boolean allowShipmentUpdateWithInvoice;

    @XmlAttribute
    @NotNull
    private boolean allowCarrierUpdate;

    @XmlAttribute
    @NotNull
    private boolean allowVoyagerNumberUpdate;
    @XmlAttribute
    @NotNull
    private boolean allowVesselNameUpdate;

    @XmlAttribute
    @NotNull
    private boolean allowContainerUpdate;

    /**
     * Defaults to Zero.
     */
    @XmlAttribute
    @NotNull
    private int customEntryDueDateDays;

    /**
     * Defaults to Zero.
     */
    @XmlAttribute
    @NotNull
    private int documentsReceivedDueDateDays;

    /**
     * Defaults to false.
     */
    @XmlAttribute
    @NotNull
    private boolean allowPartShipmentOnIntegratedOrders;
    private boolean showTranShipment;

    @ElementCollection
    @CollectionTable(name = "shipmentclientconfig_unsignoffreasons", joinColumns = {@JoinColumn(name = "config_id", unique = false)})
    @Column(name = "reason", unique = true)
    @ForeignKey(name = "fk_shipmentclientconfig", inverseName = "fk_unsignedoffreason")
    @XmlElementWrapper(name = "UnsignOffReasons")
    @XmlElement(name = "UnsignOffReason")
    private Set<String> unsignOffReasons = new HashSet<String>();

    @OneToMany(cascade = CascadeType.ALL)
    @JoinTable(name = "shipmentclientconfig_serviceprovider", joinColumns = {@JoinColumn(name = "shipmentclientconfig_id", unique = false)},
            inverseJoinColumns = {@JoinColumn(name = "serviceprovider_id", unique = false)})
    private Set<ServiceProvider> serviceProviders = new HashSet<ServiceProvider>();


    @ElementCollection(fetch = FetchType.EAGER)
    @Column(name = "shipmentstatetocomplete")
    @Fetch(FetchMode.SELECT)
    @Enumerated(EnumType.STRING)
    private List<ShipmentState> shipmentStateToComplete = new ArrayList<ShipmentState>();

    private boolean createOverstayAndStorageDemurrageTransaction;

    @XmlAttribute
    @NotNull
    private boolean automaticallyCloseQuantityBalancePerOrderAtCISignOff;

    @XmlAttribute
    @NotNull
    private boolean allowPartShipment;

    private boolean createTurnInDemurrageTransaction;

    private Integer turnInPreAlertDaysWarning;

    private Integer turnInPreAlertDefaultTurnInDepotDays;

    @XmlAttribute
    private String partShipmentFreightForwarder;

    @XmlAttribute
    @NotNull
    private String shipmentDestinationSystem;

    @XmlAttribute
    private String exportShipmentNumberSuffix;

    @XmlAttribute
    @NotNull
    private boolean linkUnlinkOrderIntegration;

    private boolean warningMissingMandatoryDocumentsOnSignOff;
    private boolean requireAllMandatoryDocumentsOnSignOff;

    private boolean useMatrixToPopulateDates;

    public String getExportShipmentNumberSuffix() {
        return exportShipmentNumberSuffix;
    }

    public void setExportShipmentNumberSuffix(String exportShipmentNumberSuffix) {
        this.exportShipmentNumberSuffix = exportShipmentNumberSuffix;
    }

    public String getShipmentDestinationSystem() {
        return shipmentDestinationSystem;
    }

    public void setShipmentDestinationSystem(String shipmentDestinationSystem) {
        this.shipmentDestinationSystem = shipmentDestinationSystem;
    }

    public boolean isForceUnsignOffReason() {
        return forceUnsignOffReason;
    }

    public void setForceUnsignOffReason(boolean forceUnsignOffReason) {
        this.forceUnsignOffReason = forceUnsignOffReason;
    }

    public Set<String> getUnsignOffReasons() {
        return unsignOffReasons;
    }

    public void setUnsignOffReasons(Set<String> unsignOffReasons) {
        this.unsignOffReasons = unsignOffReasons;
    }

    public boolean getCreateOverstayAndStorageDemurrageTransaction() {
        return createOverstayAndStorageDemurrageTransaction;
    }

    public void setCreateOverstayAndStorageDemurrageTransaction(boolean createOverstayAndStorageDemurrageTransaction) {
        this.createOverstayAndStorageDemurrageTransaction = createOverstayAndStorageDemurrageTransaction;
    }

    public boolean getCreateTurnInDemurrageTransaction() {
        return createTurnInDemurrageTransaction;
    }

    public void setCreateTurnInDemurrageTransaction(boolean createTurnInDemurrageTransaction) {
        this.createTurnInDemurrageTransaction = createTurnInDemurrageTransaction;
    }

    public Integer getTurnInPreAlertDaysWarning() {
        return turnInPreAlertDaysWarning;
    }

    public void setTurnInPreAlertDaysWarning(Integer turnInPreAlertDaysWarning) {
        this.turnInPreAlertDaysWarning = turnInPreAlertDaysWarning;
    }

    public Integer getTurnInPreAlertDefaultTurnInDepotDays() {
        return turnInPreAlertDefaultTurnInDepotDays;
    }

    public void setTurnInPreAlertDefaultTurnInDepotDays(Integer turnInPreAlertDefaultTurnInDepotDays) {
        this.turnInPreAlertDefaultTurnInDepotDays = turnInPreAlertDefaultTurnInDepotDays;
    }

    public boolean isCreatePartShipmentOnCommercialInvoiceSignOff() {
        return createPartShipmentOnCommercialInvoiceSignOff;
    }

    public int getCustomEntryDueDateDays() {
        return customEntryDueDateDays;
    }

    public void setCreatePartShipmentOnCommercialInvoiceSignOff(boolean createPartShipmentOnCommercialInvoiceSignOff) {
        this.createPartShipmentOnCommercialInvoiceSignOff = createPartShipmentOnCommercialInvoiceSignOff;
    }

    public boolean isAllowDifferentShippingModeLinking() {
        return allowDifferentShippingModeLinking;
    }

    public void setAllowDifferentShippingModeLinking(boolean allowDifferentShippingModeLinking) {
        this.allowDifferentShippingModeLinking = allowDifferentShippingModeLinking;
    }

    public boolean isAutomaticallyCloseQuantityBalancePerOrderAtCISignOff() {
        return automaticallyCloseQuantityBalancePerOrderAtCISignOff;
    }

    public void setAutomaticallyCloseQuantityBalancePerOrderAtCISignOff(boolean automaticallyCloseQuantityBalancePerOrderAtCISignOff) {
        this.automaticallyCloseQuantityBalancePerOrderAtCISignOff = automaticallyCloseQuantityBalancePerOrderAtCISignOff;
    }

    public boolean isAllowPartShipment() {
        return allowPartShipment;
    }

    public void setAllowPartShipment(boolean allowPartShipment) {
        this.allowPartShipment = allowPartShipment;
    }

    public void setCustomEntryDueDateDays(int customEntryDueDateDays) {
        this.customEntryDueDateDays = customEntryDueDateDays;
    }

    public int getDocumentsReceivedDueDateDays() {
        return documentsReceivedDueDateDays;
    }

    public void setDocumentsReceivedDueDateDays(int documentsReceivedDueDateDays) {
        this.documentsReceivedDueDateDays = documentsReceivedDueDateDays;
    }

    public Set<ServiceProvider> getServiceProviders() {
        return serviceProviders;
    }

    public void setServiceProviders(Set<ServiceProvider> serviceProviders) {
        this.serviceProviders = serviceProviders;
    }

    public String getPartShipmentFreightForwarder() {
        return partShipmentFreightForwarder;
    }

    public void setPartShipmentFreightForwarder(String partShipmentFreightForwarder) {
        this.partShipmentFreightForwarder = partShipmentFreightForwarder;
    }

    public boolean isAllowPartShipmentOnIntegratedOrders() {
        return allowPartShipmentOnIntegratedOrders;
    }

    public void setAllowPartShipmentOnIntegratedOrders(boolean allowPartShipmentOnIntegratedOrders) {
        this.allowPartShipmentOnIntegratedOrders = allowPartShipmentOnIntegratedOrders;
    }

    public boolean isWarningMissingMandatoryDocumentsOnSignOff() {
        return warningMissingMandatoryDocumentsOnSignOff;
    }

    public void setWarningMissingMandatoryDocumentsOnSignOff(boolean warningMissingMandatoryDocumentsOnSignOff) {
        this.warningMissingMandatoryDocumentsOnSignOff = warningMissingMandatoryDocumentsOnSignOff;
    }

    public boolean isRequireAllMandatoryDocumentsOnSignOff() {
        return requireAllMandatoryDocumentsOnSignOff;
    }

    public void setRequireAllMandatoryDocumentsOnSignOff(boolean requireAllMandatoryDocumentsOnSignOff) {
        this.requireAllMandatoryDocumentsOnSignOff = requireAllMandatoryDocumentsOnSignOff;
    }

    public boolean isLinkUnlinkOrderIntegration() {
        return linkUnlinkOrderIntegration;
    }

    public void setLinkUnlinkOrderIntegration(boolean linkUnlinkOrderIntegration) {
        this.linkUnlinkOrderIntegration = linkUnlinkOrderIntegration;
    }

    public boolean isAllowShipmentUpdateWithInvoice() {
        return allowShipmentUpdateWithInvoice;
    }

    public void setAllowShipmentUpdateWithInvoice(boolean allowShipmentUpdateWithInvoice) {
        this.allowShipmentUpdateWithInvoice = allowShipmentUpdateWithInvoice;
    }

    public List<ShipmentState> getShipmentStateToComplete() {
        return shipmentStateToComplete;
    }

    public void setShipmentStateToComplete(List<ShipmentState> shipmentStateToComplete) {
        this.shipmentStateToComplete = shipmentStateToComplete;
    }

    public boolean isAllowCarrierUpdate() {
        return allowCarrierUpdate;
    }

    public void setAllowCarrierUpdate(boolean allowCarrierUpdate) {
        this.allowCarrierUpdate = allowCarrierUpdate;
    }

    public boolean isAllowVoyagerNumberUpdate() {
        return allowVoyagerNumberUpdate;
    }

    public void setAllowVoyagerNumberUpdate(boolean allowVoyagerNumberUpdate) {
        this.allowVoyagerNumberUpdate = allowVoyagerNumberUpdate;
    }

    public boolean isAllowContainerUpdate() {
        return allowContainerUpdate;
    }

    public void setAllowContainerUpdate(boolean allowContainerUpdate) {
        this.allowContainerUpdate = allowContainerUpdate;
    }

    public boolean isAllowVesselNameUpdate() {
        return allowVesselNameUpdate;
    }

    public void setAllowVesselNameUpdate(boolean allowVesselNameUpdate) {
        this.allowVesselNameUpdate = allowVesselNameUpdate;
    }

    public boolean isUseMatrixToPopulateDates() {
        return useMatrixToPopulateDates;
    }

    public void setUseMatrixToPopulateDates(boolean useMatrixToPopulateDates) {
        this.useMatrixToPopulateDates = useMatrixToPopulateDates;
    }
}