PreferenceEOMapperImpl.java

package org.openwms.core.preferences.impl.jpa;

import java.util.ArrayList;
import java.util.List;
import javax.annotation.processing.Generated;
import org.openwms.core.preferences.Preference;
import org.springframework.stereotype.Component;

@Generated(
    value = "org.mapstruct.ap.MappingProcessor"
)
@Component
class PreferenceEOMapperImpl implements PreferenceEOMapper {

    @Override
    public Preference toDomain(PreferenceEO eo) {
        if ( eo == null ) {
            return null;
        }

        Preference preference = new Preference();

        if ( eo.hasPersistentKey() ) {
            preference.setPKey( eo.getPersistentKey() );
        }
        preference.setKey( eo.getKey() );
        preference.setOwner( eo.getOwner() );
        preference.setDescription( eo.getDescription() );
        preference.setVal( eo.getVal() );
        preference.setDefValue( eo.getDefValue() );
        preference.setMinValue( eo.getMinValue() );
        preference.setMaxValue( eo.getMaxValue() );
        preference.setGroupName( eo.getGroupName() );
        preference.setScope( eo.getScope() );
        preference.setType( eo.getType() );
        preference.setFromFile( eo.isFromFile() );
        preference.setLastModifiedDt( eo.getLastModifiedDt() );

        return preference;
    }

    @Override
    public List<Preference> toDomainList(List<PreferenceEO> eos) {
        if ( eos == null ) {
            return null;
        }

        List<Preference> list = new ArrayList<Preference>( eos.size() );
        for ( PreferenceEO preferenceEO : eos ) {
            list.add( toDomain( preferenceEO ) );
        }

        return list;
    }

    @Override
    public PreferenceEO toEntity(Preference preference) {
        if ( preference == null ) {
            return null;
        }

        PreferenceEO preferenceEO = new PreferenceEO();

        preferenceEO.setPersistentKey( preference.getPKey() );
        preferenceEO.setKey( preference.getKey() );
        preferenceEO.setOwner( preference.getOwner() );
        preferenceEO.setDescription( preference.getDescription() );
        preferenceEO.setVal( preference.getVal() );
        preferenceEO.setFromFile( preference.isFromFile() );
        preferenceEO.setScope( preference.getScope() );
        preferenceEO.setDefValue( preference.getDefValue() );
        preferenceEO.setMinValue( preference.getMinValue() );
        preferenceEO.setMaxValue( preference.getMaxValue() );
        preferenceEO.setGroupName( preference.getGroupName() );
        preferenceEO.setType( preference.getType() );

        return preferenceEO;
    }

    @Override
    public PreferenceEO updateEntity(Preference preference, PreferenceEO eo) {
        if ( preference == null ) {
            return eo;
        }

        eo.setKey( preference.getKey() );
        eo.setOwner( preference.getOwner() );
        eo.setDescription( preference.getDescription() );
        eo.setVal( preference.getVal() );
        eo.setFromFile( preference.isFromFile() );
        eo.setScope( preference.getScope() );
        eo.setDefValue( preference.getDefValue() );
        eo.setMinValue( preference.getMinValue() );
        eo.setMaxValue( preference.getMaxValue() );
        eo.setGroupName( preference.getGroupName() );
        eo.setType( preference.getType() );

        return eo;
    }
}