ShipmentShippingInfo.java

package com.tradecloud.domain.shipment;

import com.tradecloud.common.base.PersistenceBase;
import com.tradecloud.domain.common.Incoterm;
import com.tradecloud.domain.export.ExportParty;
import com.tradecloud.domain.model.shipment.ShippingMode;
import com.tradecloud.domain.party.ServiceProvider;
import com.tradecloud.domain.place.City;
import com.tradecloud.domain.place.Country;
import com.tradecloud.domain.place.PlaceOfDischarge;
import com.tradecloud.domain.place.PlaceOfLoading;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.ForeignKey;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;

/**
 *
 */
@Entity
@Table(name = "shipmentshippinginfo")
@Getter
@Setter
public class ShipmentShippingInfo extends PersistenceBase implements BaseShippingInfo {

    /**
     * The shipping mode that will be used to deliver the order. This should
     * default to the shipping mode configured in the client setup.
     */
    @Enumerated(value = EnumType.STRING)
    @XmlAttribute
    private ShippingMode shippingMode;

    @Enumerated(EnumType.STRING)
    private ShippingMode multiModalShippingMode;

    @NotNull(message = "incoterm is required")
    @ManyToOne
    @XmlElement(name = "Incoterm")
    @ForeignKey(name = "fk_incoterm")
    private Incoterm incoterm;

    /**
     * The place where the order is loaded. This should default to the place of
     * loading configured in the client setup.
     */
    @NotNull(message = "PlaceOfLoading is required")
    @ManyToOne(fetch = FetchType.LAZY)
    @XmlElement(name = "PlaceOfLoading")
    @ForeignKey(name = "fk_placeofloading")
    private PlaceOfLoading placeOfLoading;

    /**
     * The place where the order is discharged. This should default to the place
     * of discharge configured in the client setup.
     */
    @NotNull(message = "placeOfDischarge is required")
    @ManyToOne(fetch = FetchType.LAZY)
    @XmlElement(name = "PlaceOfDischarge")
    @ForeignKey(name = "fk_placeofdischarge")
    private PlaceOfDischarge placeOfDischarge;

    /**
     * The freight forwarder responsible for the order. This should default to
     * the the supplier's freight forwarder. If there is no freight forwarder
     * provided for the supplier then the freight forwarder configured in the
     * client setup will be used.
     */
    @NotNull(message = "freightForwarder is required")
    @XmlElement(name = "FreightForwarder")
    @ManyToOne(fetch = FetchType.LAZY)
    @ForeignKey(name = "fk_freightforwarder")
    private ServiceProvider freightForwarder;

    /**
     * The agent who will be responsible for clearing the goods. This should
     * default to the the supplier's clearing agent. If there is no clearing
     * agent provided for the supplier then the clearing agent configured in the
     * client setup will be used.
     */
    @NotNull(message = "clearingAgent is required")
    @XmlElement(name = "ClearingAgent")
    @ManyToOne(fetch = FetchType.LAZY)
    @ForeignKey(name = "fk_clearingagent")
    private ServiceProvider clearingAgent;

    @ManyToOne
    @XmlElement(name = "CountryOfExport")
    private Country countryOfExport;

    @ManyToOne
    protected City placeOfReceipt;
    @ManyToOne
    private ExportParty shipToParty;

    @Override
    public ShippingMode getShippingMode() {
        return shippingMode;
    }

    @Override
    public void setShippingMode(ShippingMode shippingMode) {
        this.shippingMode = shippingMode;
    }

    @Override
    public Incoterm getIncoterm() {
        return incoterm;
    }

    @Override
    public void setIncoterm(Incoterm incoterm) {
        this.incoterm = incoterm;
    }

    @Override
    public PlaceOfLoading getPlaceOfLoading() {
        return placeOfLoading;
    }

    @Override
    public void setPlaceOfLoading(PlaceOfLoading placeOfLoading) {
        this.placeOfLoading = placeOfLoading;
    }

    @Override
    public PlaceOfDischarge getPlaceOfDischarge() {
        return placeOfDischarge;
    }

    @Override
    public void setPlaceOfDischarge(PlaceOfDischarge placeOfDischarge) {
        this.placeOfDischarge = placeOfDischarge;
    }

    @Override
    public ServiceProvider getFreightForwarder() {
        return freightForwarder;
    }

    @Override
    public void setFreightForwarder(ServiceProvider freightForwarder) {
        this.freightForwarder = freightForwarder;
    }

    @Override
    public ServiceProvider getClearingAgent() {
        return clearingAgent;
    }

    @Override
    public void setClearingAgent(ServiceProvider clearingAgent) {
        this.clearingAgent = clearingAgent;
    }

    public Country getCountryOfExport() {
        return countryOfExport;
    }

    public void setCountryOfExport(Country countryOfExport) {
        this.countryOfExport = countryOfExport;
    }

    public City getPlaceOfReceipt() {
        return placeOfReceipt;
    }

    public void setPlaceOfReceipt(City placeOfReceipt) {
        this.placeOfReceipt = placeOfReceipt;
    }

    public ExportParty getShipToParty() {
        return shipToParty;
    }

    public void setShipToParty(ExportParty shipToParty) {
        this.shipToParty = shipToParty;
    }
}