com.arextest.config.mapper.RecordServiceConfigMapperImpl Maven / Gradle / Ivy
package com.arextest.config.mapper;
import com.arextest.config.model.dao.config.RecordServiceConfigCollection;
import com.arextest.config.model.dto.record.SerializeSkipInfoConfiguration;
import com.arextest.config.model.dto.record.ServiceCollectConfiguration;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Generated;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2024-09-19T06:47:37+0000",
comments = "version: 1.2.0.Final, compiler: javac, environment: Java 11.0.24 (Eclipse Adoptium)"
)
public class RecordServiceConfigMapperImpl implements RecordServiceConfigMapper {
@Override
public ServiceCollectConfiguration dtoFromDao(RecordServiceConfigCollection dao) {
if ( dao == null ) {
return null;
}
ServiceCollectConfiguration serviceCollectConfiguration = new ServiceCollectConfiguration();
serviceCollectConfiguration.setMultiEnvConfigs( recordServiceConfigCollectionListToServiceCollectConfigurationList( dao.getMultiEnvConfigs() ) );
Map> map = dao.getEnvTags();
if ( map != null ) {
serviceCollectConfiguration.setEnvTags( new HashMap>( map ) );
}
else {
serviceCollectConfiguration.setEnvTags( null );
}
serviceCollectConfiguration.setAppId( dao.getAppId() );
serviceCollectConfiguration.setSampleRate( dao.getSampleRate() );
serviceCollectConfiguration.setAllowDayOfWeeks( dao.getAllowDayOfWeeks() );
serviceCollectConfiguration.setAllowTimeOfDayFrom( dao.getAllowTimeOfDayFrom() );
serviceCollectConfiguration.setAllowTimeOfDayTo( dao.getAllowTimeOfDayTo() );
Set set = dao.getExcludeServiceOperationSet();
if ( set != null ) {
serviceCollectConfiguration.setExcludeServiceOperationSet( new HashSet( set ) );
}
else {
serviceCollectConfiguration.setExcludeServiceOperationSet( null );
}
Map map1 = dao.getExtendField();
if ( map1 != null ) {
serviceCollectConfiguration.setExtendField( new HashMap( map1 ) );
}
else {
serviceCollectConfiguration.setExtendField( null );
}
List list1 = dao.getSerializeSkipInfoList();
if ( list1 != null ) {
serviceCollectConfiguration.setSerializeSkipInfoList( new ArrayList( list1 ) );
}
else {
serviceCollectConfiguration.setSerializeSkipInfoList( null );
}
serviceCollectConfiguration.setModifiedTime( dao.getDataChangeUpdateTime() == null ? null : new java.sql.Timestamp(dao.getDataChangeUpdateTime()) );
serviceCollectConfiguration.setRecordMachineCountLimit( dao.getRecordMachineCountLimit() == null ? 1 : dao.getRecordMachineCountLimit() );
serviceCollectConfiguration.setTimeMock( true );
return serviceCollectConfiguration;
}
@Override
public RecordServiceConfigCollection daoFromDto(ServiceCollectConfiguration dto) {
if ( dto == null ) {
return null;
}
RecordServiceConfigCollection recordServiceConfigCollection = new RecordServiceConfigCollection();
recordServiceConfigCollection.setMultiEnvConfigs( serviceCollectConfigurationListToRecordServiceConfigCollectionList( dto.getMultiEnvConfigs() ) );
Map> map = dto.getEnvTags();
if ( map != null ) {
recordServiceConfigCollection.setEnvTags( new HashMap>( map ) );
}
else {
recordServiceConfigCollection.setEnvTags( null );
}
recordServiceConfigCollection.setAppId( dto.getAppId() );
recordServiceConfigCollection.setSampleRate( dto.getSampleRate() );
recordServiceConfigCollection.setAllowDayOfWeeks( dto.getAllowDayOfWeeks() );
recordServiceConfigCollection.setTimeMock( dto.isTimeMock() );
recordServiceConfigCollection.setAllowTimeOfDayFrom( dto.getAllowTimeOfDayFrom() );
recordServiceConfigCollection.setAllowTimeOfDayTo( dto.getAllowTimeOfDayTo() );
Set set = dto.getExcludeServiceOperationSet();
if ( set != null ) {
recordServiceConfigCollection.setExcludeServiceOperationSet( new HashSet( set ) );
}
else {
recordServiceConfigCollection.setExcludeServiceOperationSet( null );
}
recordServiceConfigCollection.setRecordMachineCountLimit( dto.getRecordMachineCountLimit() );
Map map1 = dto.getExtendField();
if ( map1 != null ) {
recordServiceConfigCollection.setExtendField( new HashMap( map1 ) );
}
else {
recordServiceConfigCollection.setExtendField( null );
}
List list1 = dto.getSerializeSkipInfoList();
if ( list1 != null ) {
recordServiceConfigCollection.setSerializeSkipInfoList( new ArrayList( list1 ) );
}
else {
recordServiceConfigCollection.setSerializeSkipInfoList( null );
}
recordServiceConfigCollection.setDataChangeCreateTime( System.currentTimeMillis() );
recordServiceConfigCollection.setDataChangeUpdateTime( System.currentTimeMillis() );
return recordServiceConfigCollection;
}
protected List recordServiceConfigCollectionListToServiceCollectConfigurationList(List list) {
if ( list == null ) {
return null;
}
List list1 = new ArrayList( list.size() );
for ( RecordServiceConfigCollection recordServiceConfigCollection : list ) {
list1.add( dtoFromDao( recordServiceConfigCollection ) );
}
return list1;
}
protected List serviceCollectConfigurationListToRecordServiceConfigCollectionList(List list) {
if ( list == null ) {
return null;
}
List list1 = new ArrayList( list.size() );
for ( ServiceCollectConfiguration serviceCollectConfiguration : list ) {
list1.add( daoFromDto( serviceCollectConfiguration ) );
}
return list1;
}
}