All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.arextest.web.model.mapper.YamlServiceConfigMapperImpl Maven / Gradle / Ivy

The newest version!
package com.arextest.web.model.mapper;

import com.arextest.config.model.dto.record.ServiceCollectConfiguration;
import com.arextest.web.model.contract.contracts.config.yamlTemplate.entity.ServiceTemplateConfig;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Set;

/*
@Generated(
    value = "org.mapstruct.ap.MappingProcessor",
    date = "2024-12-23T06:09:22+0000",
    comments = "version: 1.5.5.Final, compiler: javac, environment: Java 21.0.5 (Eclipse Adoptium)"
)
*/
public class YamlServiceConfigMapperImpl implements YamlServiceConfigMapper {

    @Override
    public ServiceTemplateConfig toYaml(ServiceCollectConfiguration dao) {
        if ( dao == null ) {
            return null;
        }

        ServiceTemplateConfig serviceTemplateConfig = new ServiceTemplateConfig();

        serviceTemplateConfig.setSampleRate( dao.getSampleRate() );
        serviceTemplateConfig.setAllowDayOfWeeks( dao.getAllowDayOfWeeks() );
        serviceTemplateConfig.setTimeMock( dao.isTimeMock() );
        serviceTemplateConfig.setAllowTimeOfDayFrom( dao.getAllowTimeOfDayFrom() );
        serviceTemplateConfig.setAllowTimeOfDayTo( dao.getAllowTimeOfDayTo() );
        Set set = dao.getExcludeServiceOperationSet();
        if ( set != null ) {
            serviceTemplateConfig.setExcludeServiceOperationSet( new ArrayList( set ) );
        }
        serviceTemplateConfig.setRecordMachineCountLimit( dao.getRecordMachineCountLimit() );

        return serviceTemplateConfig;
    }

    @Override
    public ServiceCollectConfiguration fromYaml(ServiceTemplateConfig dto) {
        if ( dto == null ) {
            return null;
        }

        ServiceCollectConfiguration serviceCollectConfiguration = new ServiceCollectConfiguration();

        serviceCollectConfiguration.setSampleRate( dto.getSampleRate() );
        serviceCollectConfiguration.setAllowDayOfWeeks( dto.getAllowDayOfWeeks() );
        serviceCollectConfiguration.setTimeMock( dto.isTimeMock() );
        serviceCollectConfiguration.setAllowTimeOfDayFrom( dto.getAllowTimeOfDayFrom() );
        serviceCollectConfiguration.setAllowTimeOfDayTo( dto.getAllowTimeOfDayTo() );
        Collection collection = dto.getExcludeServiceOperationSet();
        if ( collection != null ) {
            serviceCollectConfiguration.setExcludeServiceOperationSet( new LinkedHashSet( collection ) );
        }
        serviceCollectConfiguration.setRecordMachineCountLimit( dto.getRecordMachineCountLimit() );

        return serviceCollectConfiguration;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy