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

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

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

import com.arextest.web.model.contract.contracts.QuerySceneInfoResponseType;
import com.arextest.web.model.dao.mongodb.iosummary.SceneInfoCollection;
import com.arextest.web.model.dao.mongodb.iosummary.SubSceneInfoDao;
import com.arextest.web.model.dto.iosummary.DiffDetail;
import com.arextest.web.model.dto.iosummary.SceneInfo;
import com.arextest.web.model.dto.iosummary.SubSceneInfo;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
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 SceneInfoMapperImpl implements SceneInfoMapper {

    @Override
    public SceneInfoCollection daoFromDto(SceneInfo dto) {
        if ( dto == null ) {
            return null;
        }

        SceneInfoCollection sceneInfoCollection = new SceneInfoCollection();

        sceneInfoCollection.setId( dto.getId() );
        sceneInfoCollection.setDataChangeCreateTime( dto.getDataChangeCreateTime() );
        sceneInfoCollection.setDataChangeUpdateTime( dto.getDataChangeUpdateTime() );
        sceneInfoCollection.setCode( dto.getCode() );
        sceneInfoCollection.setCount( dto.getCount() );
        sceneInfoCollection.setCategoryKey( dto.getCategoryKey() );
        sceneInfoCollection.setPlanId( dto.getPlanId() );
        sceneInfoCollection.setPlanItemId( dto.getPlanItemId() );
        sceneInfoCollection.setSubScenes( subSceneInfoListToSubSceneInfoDaoList( dto.getSubScenes() ) );
        sceneInfoCollection.setSubSceneInfoMap( stringSubSceneInfoMapToStringSubSceneInfoDaoMap( dto.getSubSceneInfoMap() ) );
        sceneInfoCollection.setReCalculated( dto.isReCalculated() );

        return sceneInfoCollection;
    }

    @Override
    public SceneInfo dtoFromDao(SceneInfoCollection dao) {
        if ( dao == null ) {
            return null;
        }

        SceneInfo sceneInfo = new SceneInfo();

        sceneInfo.setId( dao.getId() );
        sceneInfo.setDataChangeCreateTime( dao.getDataChangeCreateTime() );
        sceneInfo.setDataChangeUpdateTime( dao.getDataChangeUpdateTime() );
        sceneInfo.setCode( dao.getCode() );
        sceneInfo.setCount( dao.getCount() );
        sceneInfo.setCategoryKey( dao.getCategoryKey() );
        sceneInfo.setPlanId( dao.getPlanId() );
        sceneInfo.setPlanItemId( dao.getPlanItemId() );
        sceneInfo.setSubScenes( subSceneInfoDaoListToSubSceneInfoList( dao.getSubScenes() ) );
        sceneInfo.setSubSceneInfoMap( stringSubSceneInfoDaoMapToStringSubSceneInfoMap( dao.getSubSceneInfoMap() ) );
        sceneInfo.setReCalculated( dao.isReCalculated() );

        return sceneInfo;
    }

    @Override
    public QuerySceneInfoResponseType.SceneInfoType contractFromDto(SceneInfo dto) {
        if ( dto == null ) {
            return null;
        }

        QuerySceneInfoResponseType.SceneInfoType sceneInfoType = new QuerySceneInfoResponseType.SceneInfoType();

        sceneInfoType.setCount( dto.getCount() );
        sceneInfoType.setSubScenes( subSceneInfoListToSubSceneInfoTypeList( dto.getSubScenes() ) );

        mapSubScenesAfterMapping( dto, sceneInfoType );

        return sceneInfoType;
    }

    protected SubSceneInfoDao subSceneInfoToSubSceneInfoDao(SubSceneInfo subSceneInfo) {
        if ( subSceneInfo == null ) {
            return null;
        }

        SubSceneInfoDao subSceneInfoDao = new SubSceneInfoDao();

        subSceneInfoDao.setCount( subSceneInfo.getCount() );
        subSceneInfoDao.setCode( subSceneInfo.getCode() );
        subSceneInfoDao.setRecordId( subSceneInfo.getRecordId() );
        subSceneInfoDao.setReplayId( subSceneInfo.getReplayId() );
        subSceneInfoDao.setFeedbackType( subSceneInfo.getFeedbackType() );
        subSceneInfoDao.setRemark( subSceneInfo.getRemark() );

        return subSceneInfoDao;
    }

    protected List subSceneInfoListToSubSceneInfoDaoList(List list) {
        if ( list == null ) {
            return null;
        }

        List list1 = new ArrayList( list.size() );
        for ( SubSceneInfo subSceneInfo : list ) {
            list1.add( subSceneInfoToSubSceneInfoDao( subSceneInfo ) );
        }

        return list1;
    }

    protected Map stringSubSceneInfoMapToStringSubSceneInfoDaoMap(Map map) {
        if ( map == null ) {
            return null;
        }

        Map map1 = new LinkedHashMap( Math.max( (int) ( map.size() / .75f ) + 1, 16 ) );

        for ( java.util.Map.Entry entry : map.entrySet() ) {
            String key = entry.getKey();
            SubSceneInfoDao value = subSceneInfoToSubSceneInfoDao( entry.getValue() );
            map1.put( key, value );
        }

        return map1;
    }

    protected SubSceneInfo subSceneInfoDaoToSubSceneInfo(SubSceneInfoDao subSceneInfoDao) {
        if ( subSceneInfoDao == null ) {
            return null;
        }

        SubSceneInfo subSceneInfo = new SubSceneInfo();

        subSceneInfo.setCode( subSceneInfoDao.getCode() );
        subSceneInfo.setCount( subSceneInfoDao.getCount() );
        subSceneInfo.setRecordId( subSceneInfoDao.getRecordId() );
        subSceneInfo.setReplayId( subSceneInfoDao.getReplayId() );
        subSceneInfo.setFeedbackType( subSceneInfoDao.getFeedbackType() );
        subSceneInfo.setRemark( subSceneInfoDao.getRemark() );

        return subSceneInfo;
    }

    protected List subSceneInfoDaoListToSubSceneInfoList(List list) {
        if ( list == null ) {
            return null;
        }

        List list1 = new ArrayList( list.size() );
        for ( SubSceneInfoDao subSceneInfoDao : list ) {
            list1.add( subSceneInfoDaoToSubSceneInfo( subSceneInfoDao ) );
        }

        return list1;
    }

    protected Map stringSubSceneInfoDaoMapToStringSubSceneInfoMap(Map map) {
        if ( map == null ) {
            return null;
        }

        Map map1 = new LinkedHashMap( Math.max( (int) ( map.size() / .75f ) + 1, 16 ) );

        for ( java.util.Map.Entry entry : map.entrySet() ) {
            String key = entry.getKey();
            SubSceneInfo value = subSceneInfoDaoToSubSceneInfo( entry.getValue() );
            map1.put( key, value );
        }

        return map1;
    }

    protected QuerySceneInfoResponseType.DiffDetailType diffDetailToDiffDetailType(DiffDetail diffDetail) {
        if ( diffDetail == null ) {
            return null;
        }

        QuerySceneInfoResponseType.DiffDetailType diffDetailType = new QuerySceneInfoResponseType.DiffDetailType();

        diffDetailType.setCode( diffDetail.getCode() );
        diffDetailType.setCategoryName( diffDetail.getCategoryName() );
        diffDetailType.setOperationName( diffDetail.getOperationName() );

        return diffDetailType;
    }

    protected List diffDetailListToDiffDetailTypeList(List list) {
        if ( list == null ) {
            return null;
        }

        List list1 = new ArrayList( list.size() );
        for ( DiffDetail diffDetail : list ) {
            list1.add( diffDetailToDiffDetailType( diffDetail ) );
        }

        return list1;
    }

    protected QuerySceneInfoResponseType.SubSceneInfoType subSceneInfoToSubSceneInfoType(SubSceneInfo subSceneInfo) {
        if ( subSceneInfo == null ) {
            return null;
        }

        QuerySceneInfoResponseType.SubSceneInfoType subSceneInfoType = new QuerySceneInfoResponseType.SubSceneInfoType();

        subSceneInfoType.setCount( subSceneInfo.getCount() );
        subSceneInfoType.setRecordId( subSceneInfo.getRecordId() );
        subSceneInfoType.setReplayId( subSceneInfo.getReplayId() );
        subSceneInfoType.setFeedbackType( subSceneInfo.getFeedbackType() );
        subSceneInfoType.setRemark( subSceneInfo.getRemark() );
        subSceneInfoType.setDetails( diffDetailListToDiffDetailTypeList( subSceneInfo.getDetails() ) );

        return subSceneInfoType;
    }

    protected List subSceneInfoListToSubSceneInfoTypeList(List list) {
        if ( list == null ) {
            return null;
        }

        List list1 = new ArrayList( list.size() );
        for ( SubSceneInfo subSceneInfo : list ) {
            list1.add( subSceneInfoToSubSceneInfoType( subSceneInfo ) );
        }

        return list1;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy