com.arextest.web.model.mapper.ManualReportCaseMapper Maven / Gradle / Ivy
The newest version!
package com.arextest.web.model.mapper;
import com.arextest.common.utils.SerializationUtils;
import com.arextest.web.model.contract.contracts.common.LogEntity;
import com.arextest.web.model.contract.contracts.manualreport.ReportCaseType;
import com.arextest.web.model.dao.mongodb.ManualReportCaseCollection;
import com.arextest.web.model.dto.filesystem.FSCaseDto;
import com.arextest.web.model.dto.manualreport.ManualReportCaseDto;
import com.arextest.web.model.dto.manualreport.SaveManualReportCaseDto;
import java.util.Arrays;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
@Mapper
public interface ManualReportCaseMapper extends BaseMapper {
ManualReportCaseMapper INSTANCE = Mappers.getMapper(ManualReportCaseMapper.class);
List dtoFromFsCaseDto(List dtos);
List daoFromDtoList(List dtos);
@Mappings({@Mapping(target = "baseMsg", qualifiedByName = "compressMsg"),
@Mapping(target = "testMsg", qualifiedByName = "compressMsg")})
ManualReportCaseCollection daoFromDto(SaveManualReportCaseDto dto);
ReportCaseType contractFromDto(ManualReportCaseDto dto);
ManualReportCaseDto dtoFromDao(ManualReportCaseCollection dao);
default String map(List logs) {
if (logs == null) {
return StringUtils.EMPTY;
}
return SerializationUtils.useZstdSerializeToBase64(logs.toArray());
}
default List map(String logs) {
LogEntity[] logEntities = SerializationUtils.useZstdDeserialize(logs, LogEntity[].class);
if (logEntities == null) {
return null;
}
return Arrays.asList(logEntities);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy