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

fr.pacifista.api.web.news.service.mappers.PacifistaNewsMapperImpl Maven / Gradle / Ivy

There is a newer version: 1.5.3.11
Show newest version
package fr.pacifista.api.web.news.service.mappers;

import fr.pacifista.api.web.news.client.dtos.PacifistaNewsDTO;
import fr.pacifista.api.web.news.service.entities.PacifistaNews;
import javax.annotation.processing.Generated;
import org.springframework.stereotype.Component;

@Generated(
    value = "org.mapstruct.ap.MappingProcessor",
    date = "2024-07-02T23:49:55+0000",
    comments = "version: 1.5.5.Final, compiler: javac, environment: Java 21.0.3 (Eclipse Adoptium)"
)
@Component
public class PacifistaNewsMapperImpl implements PacifistaNewsMapper {

    @Override
    public PacifistaNews toEntity(PacifistaNewsDTO dto) {
        if ( dto == null ) {
            return null;
        }

        PacifistaNews pacifistaNews = new PacifistaNews();

        pacifistaNews.setUuid( dto.getId() );
        pacifistaNews.setCreatedAt( dto.getCreatedAt() );
        pacifistaNews.setUpdatedAt( dto.getUpdatedAt() );
        pacifistaNews.setOriginalWriter( dto.getOriginalWriter() );
        pacifistaNews.setUpdateWriter( dto.getUpdateWriter() );
        pacifistaNews.setName( dto.getName() );
        pacifistaNews.setTitle( dto.getTitle() );
        pacifistaNews.setSubtitle( dto.getSubtitle() );
        pacifistaNews.setArticleImageUrl( dto.getArticleImageUrl() );
        pacifistaNews.setBody( dto.getBody() );

        return pacifistaNews;
    }

    @Override
    public PacifistaNewsDTO toDto(PacifistaNews entity) {
        if ( entity == null ) {
            return null;
        }

        PacifistaNewsDTO pacifistaNewsDTO = new PacifistaNewsDTO();

        pacifistaNewsDTO.setId( entity.getUuid() );
        pacifistaNewsDTO.setCreatedAt( entity.getCreatedAt() );
        pacifistaNewsDTO.setUpdatedAt( entity.getUpdatedAt() );
        pacifistaNewsDTO.setOriginalWriter( entity.getOriginalWriter() );
        pacifistaNewsDTO.setUpdateWriter( entity.getUpdateWriter() );
        pacifistaNewsDTO.setName( entity.getName() );
        pacifistaNewsDTO.setTitle( entity.getTitle() );
        pacifistaNewsDTO.setSubtitle( entity.getSubtitle() );
        pacifistaNewsDTO.setArticleImageUrl( entity.getArticleImageUrl() );
        pacifistaNewsDTO.setBody( entity.getBody() );

        return pacifistaNewsDTO;
    }

    @Override
    public void patch(PacifistaNews request, PacifistaNews toPatch) {
        if ( request == null ) {
            return;
        }

        if ( request.getUuid() != null ) {
            toPatch.setUuid( request.getUuid() );
        }
        if ( request.getId() != null ) {
            toPatch.setId( request.getId() );
        }
        if ( request.getCreatedAt() != null ) {
            toPatch.setCreatedAt( request.getCreatedAt() );
        }
        if ( request.getUpdatedAt() != null ) {
            toPatch.setUpdatedAt( request.getUpdatedAt() );
        }
        if ( request.getOriginalWriter() != null ) {
            toPatch.setOriginalWriter( request.getOriginalWriter() );
        }
        if ( request.getUpdateWriter() != null ) {
            toPatch.setUpdateWriter( request.getUpdateWriter() );
        }
        if ( request.getName() != null ) {
            toPatch.setName( request.getName() );
        }
        if ( request.getTitle() != null ) {
            toPatch.setTitle( request.getTitle() );
        }
        if ( request.getSubtitle() != null ) {
            toPatch.setSubtitle( request.getSubtitle() );
        }
        if ( request.getArticleImageUrl() != null ) {
            toPatch.setArticleImageUrl( request.getArticleImageUrl() );
        }
        if ( request.getBody() != null ) {
            toPatch.setBody( request.getBody() );
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy