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

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

package com.arextest.web.model.mapper;

import com.arextest.web.model.contract.contracts.ReportInitialRequestType;
import com.arextest.web.model.contract.contracts.common.PlanStatistic;
import com.arextest.web.model.contract.contracts.replay.UpdateReportInfoRequestType;
import com.arextest.web.model.dao.mongodb.ReportPlanStatisticCollection;
import com.arextest.web.model.dto.ReportPlanStatisticDto;
import java.util.LinkedHashMap;
import java.util.Map;

/*
@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 PlanMapperImpl implements PlanMapper {

    @Override
    public ReportPlanStatisticDto dtoFromContract(ReportInitialRequestType contract) {
        if ( contract == null ) {
            return null;
        }

        ReportPlanStatisticDto reportPlanStatisticDto = new ReportPlanStatisticDto();

        reportPlanStatisticDto.setAppId( contractApplicationAppId( contract ) );
        reportPlanStatisticDto.setAppName( contractApplicationAppName( contract ) );
        reportPlanStatisticDto.setSourceEnv( contractHostEnvSourceEnv( contract ) );
        reportPlanStatisticDto.setTargetEnv( contractHostEnvTargetEnv( contract ) );
        reportPlanStatisticDto.setSourceHost( contractHostEnvSourceHost( contract ) );
        reportPlanStatisticDto.setTargetHost( contractHostEnvTargetHost( contract ) );
        reportPlanStatisticDto.setCaseSourceType( contractCaseSourceEnvCaseSourceType( contract ) );
        Map caseTags = contractCaseSourceEnvCaseTags( contract );
        Map map = caseTags;
        if ( map != null ) {
            reportPlanStatisticDto.setCaseTags( new LinkedHashMap( map ) );
        }
        reportPlanStatisticDto.setCaseStartTime( contractCaseSourceEnvCaseStartTime( contract ) );
        reportPlanStatisticDto.setCaseEndTime( contractCaseSourceEnvCaseEndTime( contract ) );
        reportPlanStatisticDto.setTargetImageId( contractTargetImageTargetImageId( contract ) );
        reportPlanStatisticDto.setTargetImageName( contractTargetImageTargetImageName( contract ) );
        reportPlanStatisticDto.setCoreVersion( contractVersionCoreVersion( contract ) );
        reportPlanStatisticDto.setExtVersion( contractVersionExtVersion( contract ) );
        reportPlanStatisticDto.setCaseRecordVersion( contractVersionCaseRecordVersion( contract ) );
        reportPlanStatisticDto.setPlanId( contract.getPlanId() );
        reportPlanStatisticDto.setPlanName( contract.getPlanName() );
        reportPlanStatisticDto.setCreator( contract.getCreator() );
        reportPlanStatisticDto.setTotalCaseCount( contract.getTotalCaseCount() );
        Map map1 = contract.getCustomTags();
        if ( map1 != null ) {
            reportPlanStatisticDto.setCustomTags( new LinkedHashMap( map1 ) );
        }

        return reportPlanStatisticDto;
    }

    @Override
    public ReportPlanStatisticDto dtoFromDao(ReportPlanStatisticCollection dao) {
        if ( dao == null ) {
            return null;
        }

        ReportPlanStatisticDto reportPlanStatisticDto = new ReportPlanStatisticDto();

        reportPlanStatisticDto.setPlanId( dao.getPlanId() );
        reportPlanStatisticDto.setStatus( dao.getStatus() );
        reportPlanStatisticDto.setAppId( dao.getAppId() );
        reportPlanStatisticDto.setPlanName( dao.getPlanName() );
        reportPlanStatisticDto.setCreator( dao.getCreator() );
        reportPlanStatisticDto.setTargetImageId( dao.getTargetImageId() );
        reportPlanStatisticDto.setTargetImageName( dao.getTargetImageName() );
        reportPlanStatisticDto.setSourceEnv( dao.getSourceEnv() );
        reportPlanStatisticDto.setTargetEnv( dao.getTargetEnv() );
        reportPlanStatisticDto.setSourceHost( dao.getSourceHost() );
        reportPlanStatisticDto.setTargetHost( dao.getTargetHost() );
        reportPlanStatisticDto.setCoreVersion( dao.getCoreVersion() );
        reportPlanStatisticDto.setExtVersion( dao.getExtVersion() );
        reportPlanStatisticDto.setCaseRecordVersion( dao.getCaseRecordVersion() );
        reportPlanStatisticDto.setReplayStartTime( dao.getReplayStartTime() );
        reportPlanStatisticDto.setReplayEndTime( dao.getReplayEndTime() );
        reportPlanStatisticDto.setLastRerunStartTime( dao.getLastRerunStartTime() );
        reportPlanStatisticDto.setCaseSourceType( dao.getCaseSourceType() );
        Map map = dao.getCaseTags();
        if ( map != null ) {
            reportPlanStatisticDto.setCaseTags( new LinkedHashMap( map ) );
        }
        reportPlanStatisticDto.setCaseStartTime( dao.getCaseStartTime() );
        reportPlanStatisticDto.setCaseEndTime( dao.getCaseEndTime() );
        reportPlanStatisticDto.setTotalCaseCount( dao.getTotalCaseCount() );
        reportPlanStatisticDto.setDataChangeCreateTime( dao.getDataChangeCreateTime() );
        reportPlanStatisticDto.setErrorMessage( dao.getErrorMessage() );
        Map map1 = dao.getCustomTags();
        if ( map1 != null ) {
            reportPlanStatisticDto.setCustomTags( new LinkedHashMap( map1 ) );
        }

        reportPlanStatisticDto.setAppName( "unknown app name".equals(dao.getAppName()) ? dao.getAppId() : dao.getAppName() );

        return reportPlanStatisticDto;
    }

    @Override
    public PlanStatistic contractFromDto(ReportPlanStatisticDto dto) {
        if ( dto == null ) {
            return null;
        }

        PlanStatistic planStatistic = new PlanStatistic();

        planStatistic.setErrorMessage( convertErrorMessage( dto ) );
        planStatistic.setPlanId( dto.getPlanId() );
        planStatistic.setPlanName( dto.getPlanName() );
        planStatistic.setStatus( dto.getStatus() );
        planStatistic.setAppId( dto.getAppId() );
        planStatistic.setAppName( dto.getAppName() );
        planStatistic.setCreator( dto.getCreator() );
        planStatistic.setTargetImageId( dto.getTargetImageId() );
        planStatistic.setTargetImageName( dto.getTargetImageName() );
        planStatistic.setCaseSourceType( dto.getCaseSourceType() );
        planStatistic.setSourceEnv( dto.getSourceEnv() );
        planStatistic.setTargetEnv( dto.getTargetEnv() );
        planStatistic.setSourceHost( dto.getSourceHost() );
        planStatistic.setTargetHost( dto.getTargetHost() );
        planStatistic.setCoreVersion( dto.getCoreVersion() );
        planStatistic.setExtVersion( dto.getExtVersion() );
        planStatistic.setCaseRecordVersion( dto.getCaseRecordVersion() );
        planStatistic.setReplayStartTime( dto.getReplayStartTime() );
        planStatistic.setReplayEndTime( dto.getReplayEndTime() );
        planStatistic.setCaseStartTime( dto.getCaseStartTime() );
        planStatistic.setCaseEndTime( dto.getCaseEndTime() );
        planStatistic.setTotalCaseCount( dto.getTotalCaseCount() );
        planStatistic.setErrorCaseCount( dto.getErrorCaseCount() );
        planStatistic.setSuccessCaseCount( dto.getSuccessCaseCount() );
        planStatistic.setFailCaseCount( dto.getFailCaseCount() );
        planStatistic.setWaitCaseCount( dto.getWaitCaseCount() );
        planStatistic.setTotalOperationCount( dto.getTotalOperationCount() );
        planStatistic.setSuccessOperationCount( dto.getSuccessOperationCount() );
        Map map = dto.getCaseTags();
        if ( map != null ) {
            planStatistic.setCaseTags( new LinkedHashMap( map ) );
        }
        Map map1 = dto.getCustomTags();
        if ( map1 != null ) {
            planStatistic.setCustomTags( new LinkedHashMap( map1 ) );
        }

        return planStatistic;
    }

    @Override
    public ReportPlanStatisticDto dtoFromContract(UpdateReportInfoRequestType contract) {
        if ( contract == null ) {
            return null;
        }

        ReportPlanStatisticDto reportPlanStatisticDto = new ReportPlanStatisticDto();

        reportPlanStatisticDto.setPlanId( contract.getPlanId() );
        reportPlanStatisticDto.setSourceHost( contract.getSourceHost() );
        reportPlanStatisticDto.setTargetHost( contract.getTargetHost() );
        reportPlanStatisticDto.setTotalCaseCount( contract.getTotalCaseCount() );

        return reportPlanStatisticDto;
    }

    private String contractApplicationAppId(ReportInitialRequestType reportInitialRequestType) {
        if ( reportInitialRequestType == null ) {
            return null;
        }
        ReportInitialRequestType.Application application = reportInitialRequestType.getApplication();
        if ( application == null ) {
            return null;
        }
        String appId = application.getAppId();
        if ( appId == null ) {
            return null;
        }
        return appId;
    }

    private String contractApplicationAppName(ReportInitialRequestType reportInitialRequestType) {
        if ( reportInitialRequestType == null ) {
            return null;
        }
        ReportInitialRequestType.Application application = reportInitialRequestType.getApplication();
        if ( application == null ) {
            return null;
        }
        String appName = application.getAppName();
        if ( appName == null ) {
            return null;
        }
        return appName;
    }

    private String contractHostEnvSourceEnv(ReportInitialRequestType reportInitialRequestType) {
        if ( reportInitialRequestType == null ) {
            return null;
        }
        ReportInitialRequestType.HostEnvironment hostEnv = reportInitialRequestType.getHostEnv();
        if ( hostEnv == null ) {
            return null;
        }
        String sourceEnv = hostEnv.getSourceEnv();
        if ( sourceEnv == null ) {
            return null;
        }
        return sourceEnv;
    }

    private String contractHostEnvTargetEnv(ReportInitialRequestType reportInitialRequestType) {
        if ( reportInitialRequestType == null ) {
            return null;
        }
        ReportInitialRequestType.HostEnvironment hostEnv = reportInitialRequestType.getHostEnv();
        if ( hostEnv == null ) {
            return null;
        }
        String targetEnv = hostEnv.getTargetEnv();
        if ( targetEnv == null ) {
            return null;
        }
        return targetEnv;
    }

    private String contractHostEnvSourceHost(ReportInitialRequestType reportInitialRequestType) {
        if ( reportInitialRequestType == null ) {
            return null;
        }
        ReportInitialRequestType.HostEnvironment hostEnv = reportInitialRequestType.getHostEnv();
        if ( hostEnv == null ) {
            return null;
        }
        String sourceHost = hostEnv.getSourceHost();
        if ( sourceHost == null ) {
            return null;
        }
        return sourceHost;
    }

    private String contractHostEnvTargetHost(ReportInitialRequestType reportInitialRequestType) {
        if ( reportInitialRequestType == null ) {
            return null;
        }
        ReportInitialRequestType.HostEnvironment hostEnv = reportInitialRequestType.getHostEnv();
        if ( hostEnv == null ) {
            return null;
        }
        String targetHost = hostEnv.getTargetHost();
        if ( targetHost == null ) {
            return null;
        }
        return targetHost;
    }

    private Integer contractCaseSourceEnvCaseSourceType(ReportInitialRequestType reportInitialRequestType) {
        if ( reportInitialRequestType == null ) {
            return null;
        }
        ReportInitialRequestType.CaseSourceEnvironment caseSourceEnv = reportInitialRequestType.getCaseSourceEnv();
        if ( caseSourceEnv == null ) {
            return null;
        }
        Integer caseSourceType = caseSourceEnv.getCaseSourceType();
        if ( caseSourceType == null ) {
            return null;
        }
        return caseSourceType;
    }

    private Map contractCaseSourceEnvCaseTags(ReportInitialRequestType reportInitialRequestType) {
        if ( reportInitialRequestType == null ) {
            return null;
        }
        ReportInitialRequestType.CaseSourceEnvironment caseSourceEnv = reportInitialRequestType.getCaseSourceEnv();
        if ( caseSourceEnv == null ) {
            return null;
        }
        Map caseTags = caseSourceEnv.getCaseTags();
        if ( caseTags == null ) {
            return null;
        }
        return caseTags;
    }

    private Long contractCaseSourceEnvCaseStartTime(ReportInitialRequestType reportInitialRequestType) {
        if ( reportInitialRequestType == null ) {
            return null;
        }
        ReportInitialRequestType.CaseSourceEnvironment caseSourceEnv = reportInitialRequestType.getCaseSourceEnv();
        if ( caseSourceEnv == null ) {
            return null;
        }
        Long caseStartTime = caseSourceEnv.getCaseStartTime();
        if ( caseStartTime == null ) {
            return null;
        }
        return caseStartTime;
    }

    private Long contractCaseSourceEnvCaseEndTime(ReportInitialRequestType reportInitialRequestType) {
        if ( reportInitialRequestType == null ) {
            return null;
        }
        ReportInitialRequestType.CaseSourceEnvironment caseSourceEnv = reportInitialRequestType.getCaseSourceEnv();
        if ( caseSourceEnv == null ) {
            return null;
        }
        Long caseEndTime = caseSourceEnv.getCaseEndTime();
        if ( caseEndTime == null ) {
            return null;
        }
        return caseEndTime;
    }

    private String contractTargetImageTargetImageId(ReportInitialRequestType reportInitialRequestType) {
        if ( reportInitialRequestType == null ) {
            return null;
        }
        ReportInitialRequestType.TargetImage targetImage = reportInitialRequestType.getTargetImage();
        if ( targetImage == null ) {
            return null;
        }
        String targetImageId = targetImage.getTargetImageId();
        if ( targetImageId == null ) {
            return null;
        }
        return targetImageId;
    }

    private String contractTargetImageTargetImageName(ReportInitialRequestType reportInitialRequestType) {
        if ( reportInitialRequestType == null ) {
            return null;
        }
        ReportInitialRequestType.TargetImage targetImage = reportInitialRequestType.getTargetImage();
        if ( targetImage == null ) {
            return null;
        }
        String targetImageName = targetImage.getTargetImageName();
        if ( targetImageName == null ) {
            return null;
        }
        return targetImageName;
    }

    private String contractVersionCoreVersion(ReportInitialRequestType reportInitialRequestType) {
        if ( reportInitialRequestType == null ) {
            return null;
        }
        ReportInitialRequestType.Version version = reportInitialRequestType.getVersion();
        if ( version == null ) {
            return null;
        }
        String coreVersion = version.getCoreVersion();
        if ( coreVersion == null ) {
            return null;
        }
        return coreVersion;
    }

    private String contractVersionExtVersion(ReportInitialRequestType reportInitialRequestType) {
        if ( reportInitialRequestType == null ) {
            return null;
        }
        ReportInitialRequestType.Version version = reportInitialRequestType.getVersion();
        if ( version == null ) {
            return null;
        }
        String extVersion = version.getExtVersion();
        if ( extVersion == null ) {
            return null;
        }
        return extVersion;
    }

    private String contractVersionCaseRecordVersion(ReportInitialRequestType reportInitialRequestType) {
        if ( reportInitialRequestType == null ) {
            return null;
        }
        ReportInitialRequestType.Version version = reportInitialRequestType.getVersion();
        if ( version == null ) {
            return null;
        }
        String caseRecordVersion = version.getCaseRecordVersion();
        if ( caseRecordVersion == null ) {
            return null;
        }
        return caseRecordVersion;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy