ItemDTO.java

package com.tradecloud.dto.api;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.tradecloud.domain.item.AdditionalLineItemType;
import com.tradecloud.schema.ordermanagement.CostedPurchaseOrderItem;
import com.tradecloud.schema.ordermanagement.Property;

import java.util.List;

@JsonIgnoreProperties(value = {"properties"}, ignoreUnknown = true)
public class ItemDTO extends CostedPurchaseOrderItem {

    private AdditionalLineItemType additionalLineItemType;
    private String id;

    public ItemDTO() {
    }

    public ItemDTO(CostedPurchaseOrderItem orderItem) {
        super();
        super.setAdValoremDuty(orderItem.getAdValoremDuty());
        super.setBarcode(orderItem.getBarcode());
        super.setCountryOfOrigin(orderItem.getCountryOfOrigin());
        super.setCustomsDuty(orderItem.getCustomsDuty());
        super.setDescription(orderItem.getDescription());
        super.setForeignCommission(orderItem.getForeignCommission());
        super.setMerchandisingCommission(orderItem.getMerchandisingCommission());
        super.setOrganisationalUnit(orderItem.getOrganisationalUnit());
        super.setPackageUnitType(orderItem.getPackageUnitType());
        super.setPrice(orderItem.getPrice());
        super.setQuantity(orderItem.getQuantity());
        super.setReference(orderItem.getReference());
        super.setSourcingCommission(orderItem.getSourcingCommission());
        super.setSupplierReference(orderItem.getSupplierReference());
        super.setTariffHeading(orderItem.getTariffHeading());
        super.setUnitType(orderItem.getUnitType());
        super.setItemType(orderItem.getItemType());
        super.setVolume(orderItem.getVolume());
        super.setWarehousingCommission(orderItem.getWarehousingCommission());
        super.setWeight(orderItem.getWeight());
        super.setDimensions(orderItem.getDimensions());
        super.setPackagePrice(orderItem.getPackagePrice());
        super.setExciseDuty(orderItem.getExciseDuty());
        super.setElcReference(orderItem.getElcReference());
        super.setItemTemplateDescription(orderItem.getItemTemplateDescription());
    }

    public ItemDTO(ProductDTO orderItem) {
        super();
        super.setBarcode(orderItem.getBarcode());
        super.setCountryOfOrigin(orderItem.getCountryOfOrigin());
        super.setDescription(orderItem.getDescription());
        super.setOrganisationalUnit(orderItem.getOrganisation());
        super.setPackageUnitType(orderItem.getPackageUnitType());
        super.setPrice(orderItem.getPrice());
        super.setQuantity(orderItem.getQuantity());
        super.setReference(orderItem.getReference());
        super.setSupplierReference(orderItem.getSupplierReference());
        super.setTariffHeading(orderItem.getTariffHeading());
        super.setUnitType(orderItem.getUnitType());
        super.setVolume(orderItem.getVolume());
        super.setWeight(orderItem.getWeight());
    }

    @Override
    @JsonIgnore
    public List<Property> getProperties() {
        return super.getProperties();
    }

    @JsonIgnore
    public AdditionalLineItemType getAdditionalLineItemType() {
        return additionalLineItemType;
    }

    public void setAdditionalLineItemType(AdditionalLineItemType additionalLineItemType) {
        this.additionalLineItemType = additionalLineItemType;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
}