LocationGroupMapperImpl.java
package org.openwms.common.location;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import javax.annotation.processing.Generated;
import org.openwms.common.account.Account;
import org.openwms.common.location.api.LocationGroupVO;
import org.openwms.common.location.api.messages.LocationGroupMO;
import org.springframework.stereotype.Component;
@Generated(
value = "org.mapstruct.ap.MappingProcessor"
)
@Component
public class LocationGroupMapperImpl extends LocationGroupMapper {
@Override
public LocationGroupVO convertToVO(LocationGroup eo) {
if ( eo == null ) {
return null;
}
LocationGroupVO locationGroupVO = new LocationGroupVO();
if ( eo.hasPersistentKey() ) {
locationGroupVO.setpKey( eo.getPersistentKey() );
}
locationGroupVO.setAccountId( eoAccountIdentifier( eo ) );
String name = eoParentName( eo );
if ( eo.hasParent() ) {
locationGroupVO.setParent( name );
}
locationGroupVO.setGroupStateIn( eo.getGroupStateIn() );
locationGroupVO.setGroupStateOut( eo.getGroupStateOut() );
if ( eo.hasLocationGroups() ) {
locationGroupVO.setChildren( locationGroupSetToLocationGroupVOList( eo.getLocationGroups() ) );
}
locationGroupVO.setCreateDt( eo.getCreateDt() );
locationGroupVO.setOperationMode( eo.getOperationMode() );
locationGroupVO.setName( eo.getName() );
locationGroupVO.setDescription( eo.getDescription() );
locationGroupVO.setGroupType( eo.getGroupType() );
return locationGroupVO;
}
@Override
public LocationGroupMO convertToMO(LocationGroup eo) {
if ( eo == null ) {
return null;
}
LocationGroupMO locationGroupMO = new LocationGroupMO();
locationGroupMO.setAccountId( eoAccountIdentifier( eo ) );
String name = eoParentName( eo );
if ( eo.hasParent() ) {
locationGroupMO.setParent( name );
}
locationGroupMO.setOperationMode( eo.getOperationMode() );
locationGroupMO.setName( eo.getName() );
locationGroupMO.setIncomingActive( eo.isInfeedAllowed() );
locationGroupMO.setOutgoingActive( eo.isOutfeedAllowed() );
return locationGroupMO;
}
@Override
public List<LocationGroupVO> convertToVO(List<LocationGroup> eo) {
if ( eo == null ) {
return null;
}
List<LocationGroupVO> list = new ArrayList<LocationGroupVO>( eo.size() );
for ( LocationGroup locationGroup : eo ) {
list.add( convertToVO( locationGroup ) );
}
return list;
}
private String eoAccountIdentifier(LocationGroup locationGroup) {
Account account = locationGroup.getAccount();
if ( account == null ) {
return null;
}
return account.getIdentifier();
}
private String eoParentName(LocationGroup locationGroup) {
if ( !locationGroup.hasParent() ) {
return null;
}
LocationGroup parent = locationGroup.getParent();
return parent.getName();
}
protected List<LocationGroupVO> locationGroupSetToLocationGroupVOList(Set<LocationGroup> set) {
if ( set == null ) {
return null;
}
List<LocationGroupVO> list = new ArrayList<LocationGroupVO>( set.size() );
for ( LocationGroup locationGroup : set ) {
list.add( convertToVO( locationGroup ) );
}
return list;
}
}