AllocationMapperImpl.java
package org.openwms.common.transport.allocation;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.processing.Generated;
import org.openwms.common.location.Location;
import org.openwms.common.transport.TransportUnit;
import org.openwms.common.transport.allocation.api.AllocationVO;
import org.openwms.common.transport.allocation.spi.TransportUnitAllocation;
import org.openwms.common.transport.barcode.Barcode;
import org.springframework.stereotype.Component;
@Generated(
value = "org.mapstruct.ap.MappingProcessor"
)
@Component
public class AllocationMapperImpl implements AllocationMapper {
@Override
public AllocationVO convert(TransportUnitAllocation entity) {
if ( entity == null ) {
return null;
}
AllocationVO.Builder allocationVO = AllocationVO.newBuilder();
allocationVO.transportUnitBK( entityTransportUnitBarcodeValue( entity ) );
allocationVO.actualErpCode( entityActualLocationErpCode( entity ) );
allocationVO.reservationId( entity.getReservationId() );
return allocationVO.build();
}
@Override
public List<AllocationVO> convert(List<TransportUnitAllocation> entities) {
if ( entities == null ) {
return null;
}
List<AllocationVO> list = new ArrayList<AllocationVO>( entities.size() );
for ( TransportUnitAllocation transportUnitAllocation : entities ) {
list.add( convert( transportUnitAllocation ) );
}
return list;
}
private String entityTransportUnitBarcodeValue(TransportUnitAllocation transportUnitAllocation) {
TransportUnit transportUnit = transportUnitAllocation.getTransportUnit();
if ( transportUnit == null ) {
return null;
}
Barcode barcode = transportUnit.getBarcode();
if ( barcode == null ) {
return null;
}
return barcode.getValue();
}
private String entityActualLocationErpCode(TransportUnitAllocation transportUnitAllocation) {
Location actualLocation = transportUnitAllocation.getActualLocation();
if ( actualLocation == null ) {
return null;
}
return actualLocation.getErpCode();
}
}