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

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

package com.arextest.web.model.mapper;

import com.arextest.web.model.contract.contracts.CompareResultDetail;
import com.arextest.web.model.contract.contracts.common.CompareResult;
import com.arextest.web.model.contract.contracts.common.LogEntity;
import com.arextest.web.model.contract.contracts.replay.AnalyzeCompareResultsRequestType;
import com.arextest.web.model.dao.mongodb.ReplayCompareResultCollection;
import com.arextest.web.model.dao.mongodb.entity.MsgInfoDao;
import com.arextest.web.model.dto.CompareResultDto;
import com.arextest.web.model.dto.MsgInfoDto;
import java.util.ArrayList;
import java.util.List;

/*
@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 CompareResultMapperImpl implements CompareResultMapper {

    @Override
    public ReplayCompareResultCollection daoFromDto(CompareResultDto dto) {
        if ( dto == null ) {
            return null;
        }

        ReplayCompareResultCollection replayCompareResultCollection = new ReplayCompareResultCollection();

        replayCompareResultCollection.setId( dto.getId() );
        replayCompareResultCollection.setCaseId( dto.getCaseId() );
        replayCompareResultCollection.setPlanId( dto.getPlanId() );
        replayCompareResultCollection.setOperationId( dto.getOperationId() );
        replayCompareResultCollection.setServiceName( dto.getServiceName() );
        replayCompareResultCollection.setCategoryName( dto.getCategoryName() );
        replayCompareResultCollection.setOperationName( dto.getOperationName() );
        replayCompareResultCollection.setReplayId( dto.getReplayId() );
        replayCompareResultCollection.setRecordId( dto.getRecordId() );
        replayCompareResultCollection.setRecordTime( dto.getRecordTime() );
        replayCompareResultCollection.setReplayTime( dto.getReplayTime() );
        replayCompareResultCollection.setInstanceId( dto.getInstanceId() );
        replayCompareResultCollection.setBaseMsg( dto.getBaseMsg() );
        replayCompareResultCollection.setTestMsg( dto.getTestMsg() );
        replayCompareResultCollection.setLogs( map( dto.getLogs() ) );
        replayCompareResultCollection.setPlanItemId( dto.getPlanItemId() );
        if ( dto.getDiffResultCode() != null ) {
            replayCompareResultCollection.setDiffResultCode( dto.getDiffResultCode() );
        }
        replayCompareResultCollection.setMsgInfo( msgInfoDtoToMsgInfoDao( dto.getMsgInfo() ) );
        replayCompareResultCollection.setDataCreateTime( dto.getDataCreateTime() );
        replayCompareResultCollection.setIgnore( dto.getIgnore() );

        replayCompareResultCollection.setDataChangeCreateTime( dto.getDataChangeCreateTime() == null?System.currentTimeMillis():dto.getDataChangeCreateTime() );
        replayCompareResultCollection.setDataChangeUpdateTime( dto.getDataChangeUpdateTime() == null?System.currentTimeMillis():dto.getDataChangeUpdateTime() );

        return replayCompareResultCollection;
    }

    @Override
    public CompareResultDto dtoFromDao(ReplayCompareResultCollection dao) {
        if ( dao == null ) {
            return null;
        }

        CompareResultDto compareResultDto = new CompareResultDto();

        compareResultDto.setBaseMsg( decompressMsg( dao.getBaseMsg() ) );
        compareResultDto.setTestMsg( decompressMsg( dao.getTestMsg() ) );
        compareResultDto.setId( dao.getId() );
        compareResultDto.setDataChangeCreateTime( dao.getDataChangeCreateTime() );
        compareResultDto.setDataChangeUpdateTime( dao.getDataChangeUpdateTime() );
        compareResultDto.setCaseId( dao.getCaseId() );
        compareResultDto.setPlanId( dao.getPlanId() );
        compareResultDto.setOperationId( dao.getOperationId() );
        compareResultDto.setServiceName( dao.getServiceName() );
        compareResultDto.setCategoryName( dao.getCategoryName() );
        compareResultDto.setOperationName( dao.getOperationName() );
        compareResultDto.setReplayId( dao.getReplayId() );
        compareResultDto.setRecordId( dao.getRecordId() );
        compareResultDto.setRecordTime( dao.getRecordTime() );
        compareResultDto.setReplayTime( dao.getReplayTime() );
        compareResultDto.setInstanceId( dao.getInstanceId() );
        compareResultDto.setLogs( map( dao.getLogs() ) );
        compareResultDto.setPlanItemId( dao.getPlanItemId() );
        compareResultDto.setDiffResultCode( dao.getDiffResultCode() );
        compareResultDto.setMsgInfo( msgInfoDaoToMsgInfoDto( dao.getMsgInfo() ) );
        compareResultDto.setIgnore( dao.getIgnore() );
        compareResultDto.setDataCreateTime( dao.getDataCreateTime() );

        return compareResultDto;
    }

    @Override
    public CompareResultDto dtoFromContract(CompareResult contract) {
        if ( contract == null ) {
            return null;
        }

        CompareResultDto compareResultDto = new CompareResultDto();

        compareResultDto.setPlanId( contract.getPlanId() );
        compareResultDto.setOperationId( contract.getOperationId() );
        compareResultDto.setServiceName( contract.getServiceName() );
        compareResultDto.setCategoryName( contract.getCategoryName() );
        compareResultDto.setOperationName( contract.getOperationName() );
        compareResultDto.setReplayId( contract.getReplayId() );
        compareResultDto.setRecordId( contract.getRecordId() );
        compareResultDto.setRecordTime( contract.getRecordTime() );
        compareResultDto.setReplayTime( contract.getReplayTime() );
        compareResultDto.setInstanceId( contract.getInstanceId() );
        compareResultDto.setBaseMsg( contract.getBaseMsg() );
        compareResultDto.setTestMsg( contract.getTestMsg() );
        List list = contract.getLogs();
        if ( list != null ) {
            compareResultDto.setLogs( new ArrayList( list ) );
        }
        compareResultDto.setPlanItemId( contract.getPlanItemId() );
        compareResultDto.setDiffResultCode( contract.getDiffResultCode() );

        compareResultDto.setDataCreateTime( new java.util.Date() );

        return compareResultDto;
    }

    @Override
    public CompareResult contractFromDto(CompareResultDto dto) {
        if ( dto == null ) {
            return null;
        }

        CompareResult compareResult = new CompareResult();

        compareResult.setPlanId( dto.getPlanId() );
        compareResult.setOperationId( dto.getOperationId() );
        compareResult.setServiceName( dto.getServiceName() );
        compareResult.setCategoryName( dto.getCategoryName() );
        compareResult.setDiffResultCode( dto.getDiffResultCode() );
        compareResult.setOperationName( dto.getOperationName() );
        compareResult.setReplayId( dto.getReplayId() );
        compareResult.setRecordId( dto.getRecordId() );
        compareResult.setRecordTime( dto.getRecordTime() );
        compareResult.setReplayTime( dto.getReplayTime() );
        compareResult.setInstanceId( dto.getInstanceId() );
        compareResult.setBaseMsg( dto.getBaseMsg() );
        compareResult.setTestMsg( dto.getTestMsg() );
        compareResult.setPlanItemId( dto.getPlanItemId() );
        List list = dto.getLogs();
        if ( list != null ) {
            compareResult.setLogs( new ArrayList( list ) );
        }

        return compareResult;
    }

    @Override
    public CompareResultDetail detailFromDto(CompareResultDto dto) {
        if ( dto == null ) {
            return null;
        }

        CompareResultDetail compareResultDetail = new CompareResultDetail();

        compareResultDetail.setId( dto.getId() );
        compareResultDetail.setCategoryName( dto.getCategoryName() );
        compareResultDetail.setOperationName( dto.getOperationName() );
        compareResultDetail.setBaseMsg( dto.getBaseMsg() );
        compareResultDetail.setTestMsg( dto.getTestMsg() );
        compareResultDetail.setDiffResultCode( dto.getDiffResultCode() );

        return compareResultDetail;
    }

    @Override
    public CompareResult contractFromDtoLogsLimitDisplay(CompareResultDto dto) {
        if ( dto == null ) {
            return null;
        }

        CompareResult compareResult = new CompareResult();

        compareResult.setPlanId( dto.getPlanId() );
        compareResult.setOperationId( dto.getOperationId() );
        compareResult.setServiceName( dto.getServiceName() );
        compareResult.setCategoryName( dto.getCategoryName() );
        compareResult.setDiffResultCode( dto.getDiffResultCode() );
        compareResult.setOperationName( dto.getOperationName() );
        compareResult.setReplayId( dto.getReplayId() );
        compareResult.setRecordId( dto.getRecordId() );
        compareResult.setRecordTime( dto.getRecordTime() );
        compareResult.setReplayTime( dto.getReplayTime() );
        compareResult.setInstanceId( dto.getInstanceId() );
        compareResult.setBaseMsg( dto.getBaseMsg() );
        compareResult.setTestMsg( dto.getTestMsg() );
        compareResult.setPlanItemId( dto.getPlanItemId() );

        compareResult.setLogs( dto.getDiffResultCode() == 2 ? dto.getLogs() : null );

        return compareResult;
    }

    @Override
    public CompareResultDto dtoFromAnalyzeContract(AnalyzeCompareResultsRequestType.AnalyzeCompareInfoItem analyzeCompareInfoItem) {
        if ( analyzeCompareInfoItem == null ) {
            return null;
        }

        CompareResultDto compareResultDto = new CompareResultDto();

        compareResultDto.setPlanId( analyzeCompareInfoItem.getPlanId() );
        compareResultDto.setOperationId( analyzeCompareInfoItem.getOperationId() );
        compareResultDto.setServiceName( analyzeCompareInfoItem.getServiceName() );
        compareResultDto.setCategoryName( analyzeCompareInfoItem.getCategoryName() );
        compareResultDto.setOperationName( analyzeCompareInfoItem.getOperationName() );
        compareResultDto.setReplayId( analyzeCompareInfoItem.getReplayId() );
        compareResultDto.setRecordId( analyzeCompareInfoItem.getRecordId() );
        compareResultDto.setPlanItemId( analyzeCompareInfoItem.getPlanItemId() );
        compareResultDto.setDiffResultCode( analyzeCompareInfoItem.getDiffResultCode() );
        compareResultDto.setMsgInfo( msgInfoToMsgInfoDto( analyzeCompareInfoItem.getMsgInfo() ) );

        return compareResultDto;
    }

    protected MsgInfoDao msgInfoDtoToMsgInfoDao(MsgInfoDto msgInfoDto) {
        if ( msgInfoDto == null ) {
            return null;
        }

        MsgInfoDao msgInfoDao = new MsgInfoDao();

        msgInfoDao.setMsgMiss( msgInfoDto.getMsgMiss() );

        return msgInfoDao;
    }

    protected MsgInfoDto msgInfoDaoToMsgInfoDto(MsgInfoDao msgInfoDao) {
        if ( msgInfoDao == null ) {
            return null;
        }

        MsgInfoDto msgInfoDto = new MsgInfoDto();

        msgInfoDto.setMsgMiss( msgInfoDao.getMsgMiss() );

        return msgInfoDto;
    }

    protected MsgInfoDto msgInfoToMsgInfoDto(AnalyzeCompareResultsRequestType.MsgInfo msgInfo) {
        if ( msgInfo == null ) {
            return null;
        }

        MsgInfoDto msgInfoDto = new MsgInfoDto();

        msgInfoDto.setMsgMiss( msgInfo.getMsgMiss() );

        return msgInfoDto;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy