com.abavilla.fpi.load.mapper.QueryMapperImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fpi-load-api-core Show documentation
Show all versions of fpi-load-api-core Show documentation
FPI Reactive backend Topup API, contains usage for DTOne and GlobeLabs Rewards API with callback functionality
The newest version!
package com.abavilla.fpi.load.mapper;
import com.abavilla.fpi.load.entity.Query;
import com.abavilla.fpi.load.ext.dto.QueryDto;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.processing.Generated;
import javax.enterprise.context.ApplicationScoped;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2022-11-14T11:22:26+0000",
comments = "version: 1.5.3.Final, compiler: javac, environment: Java 17.0.4.1 (Eclipse Adoptium)"
)
@ApplicationScoped
public class QueryMapperImpl implements QueryMapper {
@Override
public QueryDto mapToDto(Query entity) {
if ( entity == null ) {
return null;
}
QueryDto queryDto = new QueryDto();
queryDto.setQuery( entity.getBody() );
queryDto.setBotSource( botSourceToStr( entity.getSource() ) );
queryDto.setId( mongoIdToStr( entity.getId() ) );
queryDto.setDateCreated( entity.getDateCreated() );
queryDto.setDateUpdated( entity.getDateUpdated() );
List list = entity.getExceptions();
if ( list != null ) {
queryDto.setExceptions( new ArrayList( list ) );
}
return queryDto;
}
@Override
public Query mapToEntity(QueryDto dto) {
if ( dto == null ) {
return null;
}
Query query = new Query();
query.setBody( dto.getQuery() );
query.setSource( strToBotSource( dto.getBotSource() ) );
query.setId( strToMongoId( dto.getId() ) );
query.setDateCreated( dto.getDateCreated() );
query.setDateUpdated( dto.getDateUpdated() );
List list = dto.getExceptions();
if ( list != null ) {
query.setExceptions( new ArrayList( list ) );
}
return query;
}
@Override
public void patchEntity(Query entity, QueryDto dto) {
if ( dto == null ) {
return;
}
if ( dto.getQuery() != null ) {
entity.setBody( dto.getQuery() );
}
if ( dto.getBotSource() != null ) {
entity.setSource( strToBotSource( dto.getBotSource() ) );
}
if ( dto.getId() != null ) {
entity.setId( strToMongoId( dto.getId() ) );
}
if ( dto.getDateCreated() != null ) {
entity.setDateCreated( dto.getDateCreated() );
}
if ( dto.getDateUpdated() != null ) {
entity.setDateUpdated( dto.getDateUpdated() );
}
if ( entity.getExceptions() != null ) {
List list = dto.getExceptions();
if ( list != null ) {
entity.getExceptions().clear();
entity.getExceptions().addAll( list );
}
}
else {
List list = dto.getExceptions();
if ( list != null ) {
entity.setExceptions( new ArrayList( list ) );
}
}
}
}