ProductMapperImpl.java

package org.openwms.wms.shipping;

import java.util.LinkedHashMap;
import java.util.Map;
import javax.annotation.processing.Generated;
import org.openwms.wms.shipping.api.ProductVO;
import org.openwms.wms.shipping.events.inventory.ProductMO;
import org.openwms.wms.shipping.impl.Product;
import org.springframework.stereotype.Component;

@Generated(
    value = "org.mapstruct.ap.MappingProcessor"
)
@Component
public class ProductMapperImpl implements ProductMapper {

    @Override
    public Product convertTo(ProductMO mo) {
        if ( mo == null ) {
            return null;
        }

        String foreignPKey = null;
        String sku = null;

        foreignPKey = mo.getpKey();
        sku = mo.getSku();

        Product product = new Product( sku, foreignPKey );

        product.setLabel( mo.getLabel() );
        product.setDescription( mo.getDescription() );
        product.setStockZone( mo.getStockZone() );
        Map<String, String> map = mo.getDetails();
        if ( map != null ) {
            product.setDetails( new LinkedHashMap<String, String>( map ) );
        }

        return product;
    }

    @Override
    public Product convertVO(ProductVO vo) {
        if ( vo == null ) {
            return null;
        }

        String sku = null;

        sku = vo.getSku();

        String foreignPKey = null;

        Product product = new Product( sku, foreignPKey );

        product.setPersistentKey( vo.getpKey() );
        product.setLabel( vo.getLabel() );
        product.setDescription( vo.getDescription() );
        Map<String, String> map = vo.getDetails();
        if ( map != null ) {
            product.setDetails( new LinkedHashMap<String, String>( map ) );
        }

        return product;
    }

    @Override
    public ProductVO convert(Product eo) {
        if ( eo == null ) {
            return null;
        }

        ProductVO productVO = new ProductVO();

        if ( eo.hasPersistentKey() ) {
            productVO.setpKey( eo.getPersistentKey() );
        }
        productVO.setSku( eo.getSku() );
        productVO.setLabel( eo.getLabel() );
        productVO.setDescription( eo.getDescription() );
        Map<String, String> map = eo.getDetails();
        if ( map != null ) {
            productVO.setDetails( new LinkedHashMap<String, String>( map ) );
        }
        productVO.setOl( eo.getOl() );
        productVO.setCreateDt( eo.getCreateDt() );
        productVO.setLastModifiedDt( eo.getLastModifiedDt() );

        return productVO;
    }

    @Override
    public Product convertSpiVO(org.openwms.wms.shipping.spi.wms.inventory.ProductVO vo) {
        if ( vo == null ) {
            return null;
        }

        String foreignPKey = null;
        String sku = null;

        foreignPKey = vo.getpKey();
        sku = vo.getSku();

        Product product = new Product( sku, foreignPKey );

        product.setLabel( vo.getLabel() );
        product.setDescription( vo.getDescription() );
        product.setStockZone( vo.getStockZone() );
        Map<String, String> map = vo.getDetails();
        if ( map != null ) {
            product.setDetails( new LinkedHashMap<String, String>( map ) );
        }

        return product;
    }
}