LocationMapperImpl.java

package org.openwms.wms.location.impl;

import javax.annotation.processing.Generated;
import org.openwms.common.location.api.messages.LocationMO;
import org.openwms.wms.location.Location;
import org.openwms.wms.location.LocationPK;
import org.openwms.wms.location.api.LocationVO;
import org.springframework.stereotype.Component;

@Generated(
    value = "org.mapstruct.ap.MappingProcessor"
)
@Component
public class LocationMapperImpl extends LocationMapper {

    @Override
    public LocationVO convertToVO(Location eo) {
        if ( eo == null ) {
            return null;
        }

        LocationVO locationVO = new LocationVO();

        if ( eo.hasPersistentKey() ) {
            locationVO.setpKey( eo.getPersistentKey() );
        }
        locationVO.setLocationGroupName( eo.getLocationGroup() );
        locationVO.setOl( eo.getOl() );
        locationVO.setCreateDt( eo.getCreateDt() );
        locationVO.setLastModifiedDt( eo.getLastModifiedDt() );
        locationVO.setIncomingActive( eo.getIncomingActive() );
        locationVO.setOutgoingActive( eo.getOutgoingActive() );
        locationVO.setMixedProducts( eo.getMixedProducts() );
        locationVO.setDirectBookingAllowed( eo.getDirectBookingAllowed() );
        locationVO.setPlcState( eo.getPlcState() );
        if ( eo.hasErpCode() ) {
            locationVO.setErpCode( eo.getErpCode() );
        }
        locationVO.setDescription( eo.getDescription() );
        locationVO.setSortOrder( eo.getSortOrder() );
        locationVO.setNoMaxTransportUnits( eo.getNoMaxTransportUnits() );
        locationVO.setLastPickingDate( eo.getLastPickingDate() );
        locationVO.setLastInventoryDate( eo.getLastInventoryDate() );

        locationVO.setLocationId( eo.getLocationId().toString() );

        return locationVO;
    }

    @Override
    public Location convertFromVO(LocationVO vo) {
        if ( vo == null ) {
            return null;
        }

        LocationPK locationId = null;

        if ( vo.hasLocationId() ) {
            locationId = convert( vo.getLocationId() );
        }

        Location location = new Location( locationId );

        if ( vo.getIncomingActive() != null ) {
            location.setIncomingActive( vo.getIncomingActive() );
        }
        if ( vo.getOutgoingActive() != null ) {
            location.setOutgoingActive( vo.getOutgoingActive() );
        }
        if ( vo.getPlcState() != null ) {
            location.setPlcState( vo.getPlcState() );
        }
        if ( vo.hasErpCode() ) {
            location.setErpCode( vo.getErpCode() );
        }
        location.setDescription( vo.getDescription() );
        if ( vo.hasNoMaxTransportUnits() ) {
            location.setNoMaxTransportUnits( vo.getNoMaxTransportUnits() );
        }
        location.setLastInventoryDate( vo.getLastInventoryDate() );

        return location;
    }

    @Override
    public Location convertFromMO(LocationMO mo) {
        if ( mo == null ) {
            return null;
        }

        LocationPK locationId = null;

        locationId = convert( mo.id() );

        Location location = new Location( locationId );

        location.setForeignPKey( mo.pKey() );
        location.setLocationGroup( mo.locationGroupName() );
        if ( mo.incomingActive() != null ) {
            location.setIncomingActive( mo.incomingActive() );
        }
        if ( mo.outgoingActive() != null ) {
            location.setOutgoingActive( mo.outgoingActive() );
        }
        if ( mo.plcState() != null ) {
            location.setPlcState( mo.plcState() );
        }
        location.setErpCode( mo.erpCode() );

        return location;
    }
}