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

com.brihaspathee.zeus.mapper.impl.FileDetailMapperImpl Maven / Gradle / Ivy

The newest version!
package com.brihaspathee.zeus.mapper.impl;

import com.brihaspathee.zeus.domain.entity.FileDetail;
import com.brihaspathee.zeus.dto.transaction.FileDetailDto;
import com.brihaspathee.zeus.mapper.interfaces.FileDetailMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Set;
import java.util.stream.Collectors;

/**
 * Created in Intellij IDEA
 * User: Balaji Varadharajan
 * Date: 30, March 2022
 * Time: 3:52 PM
 * Project: Zeus
 * Package Name: com.brihaspathee.zeus.mapper.impl
 * To change this template use File | Settings | File and Code Template
 */
@Slf4j
@Component
public class FileDetailMapperImpl implements FileDetailMapper {

    @Override
    public FileDetail fileDetailDtoToFileDetail(FileDetailDto detailDto) {
        if(detailDto == null){
            return null;
        }
        FileDetail fileDetail = FileDetail.builder()
                .fileDetailSK(detailDto.getFileDetailSK())
                .zeusFileControlNumber(detailDto.getZeusFileControlNumber())
                .interchangeControlNumber(detailDto.getInterchangeControlNumber())
                .fileName(detailDto.getFileName())
                .fileReceivedDate(detailDto.getFileReceivedDate())
                .senderId(detailDto.getSenderId())
                .receiverId(detailDto.getReceiverId())
                .tradingPartnerId(detailDto.getTradingPartnerId())
                .lineOfBusinessTypeCode(detailDto.getLineOfBusinessTypeCode())
                .businessUnitTypeCode(detailDto.getBusinessUnitTypeCode())
                .marketplaceTypeCode(detailDto.getMarketplaceTypeCode())
                .stateTypeCode(detailDto.getStateTypeCode())
                .build();
        return fileDetail;
    }

    @Override
    public FileDetailDto fileDetailToFileDetailDto(FileDetail detail) {
        if(detail == null){
            return null;
        }
        FileDetailDto fileDetailDto = FileDetailDto.builder()
                .fileDetailSK(detail.getFileDetailSK())
                .zeusFileControlNumber(detail.getZeusFileControlNumber())
                .interchangeControlNumber(detail.getInterchangeControlNumber())
                .fileName(detail.getFileName())
                .fileReceivedDate(detail.getFileReceivedDate())
                .senderId(detail.getSenderId())
                .receiverId(detail.getReceiverId())
                .tradingPartnerId(detail.getTradingPartnerId())
                .lineOfBusinessTypeCode(detail.getLineOfBusinessTypeCode())
                .businessUnitTypeCode(detail.getBusinessUnitTypeCode())
                .marketplaceTypeCode(detail.getMarketplaceTypeCode())
                .stateTypeCode(detail.getStateTypeCode())
                .build();
        return fileDetailDto;
    }

    @Override
    public Set fileDetailDtosToFileDetails(Set detailDtos) {
        return detailDtos.stream().map(this::fileDetailDtoToFileDetail).collect(Collectors.toSet());
    }

    @Override
    public Set fileDetailsToFileDetailDtos(Set details) {
        return details.stream().map(this::fileDetailToFileDetailDto).collect(Collectors.toSet());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy