DimensionMapperImpl.java

package org.openwms.wms.inventory;

import javax.annotation.processing.Generated;
import org.openwms.wms.inventory.api.DimensionVO;
import org.springframework.stereotype.Component;

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

    @Override
    public DimensionVO convert(Dimension entity) {
        if ( entity == null ) {
            return null;
        }

        DimensionVO dimensionVO = new DimensionVO();

        dimensionVO.setHeight( entity.getHeight() );
        dimensionVO.setLength( entity.getLength() );
        dimensionVO.setWidth( entity.getWidth() );
        dimensionVO.setUom( entity.getUom() );

        return dimensionVO;
    }

    @Override
    public Dimension convertVO(DimensionVO vo) {
        if ( vo == null ) {
            return null;
        }

        int height = 0;
        int length = 0;
        int width = 0;
        String uom = null;

        height = vo.getHeight();
        if ( vo.getLength() != null ) {
            length = vo.getLength();
        }
        if ( vo.getWidth() != null ) {
            width = vo.getWidth();
        }
        uom = vo.getUom();

        Dimension dimension = new Dimension( height, length, width, uom );

        return dimension;
    }
}