package com.qsoft.rs.sincoar.dominio.mapper;

import com.qsoft.rs.sincoar.dto.MdConnectionsDTO;
import com.qsoft.rs.sincoar.model.MdConnections;
import com.qsoft.rs.sincoar.model.MdProjects;
import java.math.BigDecimal;
import java.math.BigInteger;
import javax.annotation.processing.Generated;

@Generated(
    value = "org.mapstruct.ap.MappingProcessor",
    date = "2022-09-02T16:14:50-0500",
    comments = "version: 1.5.2.Final, compiler: javac, environment: Java 17.0.4 (Private Build)"
)
public class MdConnectionsMapperImpl implements MdConnectionsMapper {

    @Override
    public MdConnections getEntidad(MdConnectionsDTO mdConnections) {
        if ( mdConnections == null ) {
            return null;
        }

        MdConnections mdConnections1 = new MdConnections();

        mdConnections1.setProjectIdFk( mdConnectionsDTOToMdProjects( mdConnections ) );
        if ( mdConnections.getId() != null ) {
            mdConnections1.setId( BigDecimal.valueOf( mdConnections.getId() ) );
        }
        mdConnections1.setType( mdConnections.getType() );
        mdConnections1.setHost( mdConnections.getHost() );
        if ( mdConnections.getPort() != null ) {
            mdConnections1.setPort( BigInteger.valueOf( mdConnections.getPort() ) );
        }
        mdConnections1.setUsername( mdConnections.getUsername() );
        mdConnections1.setPassword( mdConnections.getPassword() );
        mdConnections1.setDburl( mdConnections.getDburl() );
        mdConnections1.setName( mdConnections.getName() );
        mdConnections1.setNativeSql( mdConnections.getNativeSql() );
        mdConnections1.setStatus( mdConnections.getStatus() );
        if ( mdConnections.getNumCatalogs() != null ) {
            mdConnections1.setNumCatalogs( BigInteger.valueOf( mdConnections.getNumCatalogs() ) );
        }
        if ( mdConnections.getNumColumns() != null ) {
            mdConnections1.setNumColumns( BigInteger.valueOf( mdConnections.getNumColumns() ) );
        }
        if ( mdConnections.getNumConstraints() != null ) {
            mdConnections1.setNumConstraints( BigInteger.valueOf( mdConnections.getNumConstraints() ) );
        }
        if ( mdConnections.getNumGroups() != null ) {
            mdConnections1.setNumGroups( BigInteger.valueOf( mdConnections.getNumGroups() ) );
        }
        if ( mdConnections.getNumRoles() != null ) {
            mdConnections1.setNumRoles( BigInteger.valueOf( mdConnections.getNumRoles() ) );
        }
        if ( mdConnections.getNumIndexes() != null ) {
            mdConnections1.setNumIndexes( BigInteger.valueOf( mdConnections.getNumIndexes() ) );
        }
        if ( mdConnections.getNumOtherObjects() != null ) {
            mdConnections1.setNumOtherObjects( BigInteger.valueOf( mdConnections.getNumOtherObjects() ) );
        }
        if ( mdConnections.getNumPackages() != null ) {
            mdConnections1.setNumPackages( BigInteger.valueOf( mdConnections.getNumPackages() ) );
        }
        if ( mdConnections.getNumPrivileges() != null ) {
            mdConnections1.setNumPrivileges( BigInteger.valueOf( mdConnections.getNumPrivileges() ) );
        }
        if ( mdConnections.getNumSchemas() != null ) {
            mdConnections1.setNumSchemas( BigInteger.valueOf( mdConnections.getNumSchemas() ) );
        }
        if ( mdConnections.getNumSequences() != null ) {
            mdConnections1.setNumSequences( BigInteger.valueOf( mdConnections.getNumSequences() ) );
        }
        if ( mdConnections.getNumStoredPrograms() != null ) {
            mdConnections1.setNumStoredPrograms( BigInteger.valueOf( mdConnections.getNumStoredPrograms() ) );
        }
        if ( mdConnections.getNumSynonyms() != null ) {
            mdConnections1.setNumSynonyms( BigInteger.valueOf( mdConnections.getNumSynonyms() ) );
        }
        if ( mdConnections.getNumTables() != null ) {
            mdConnections1.setNumTables( BigInteger.valueOf( mdConnections.getNumTables() ) );
        }
        if ( mdConnections.getNumTablespaces() != null ) {
            mdConnections1.setNumTablespaces( BigInteger.valueOf( mdConnections.getNumTablespaces() ) );
        }
        if ( mdConnections.getNumTriggers() != null ) {
            mdConnections1.setNumTriggers( BigInteger.valueOf( mdConnections.getNumTriggers() ) );
        }
        if ( mdConnections.getNumUserDefinedDataTypes() != null ) {
            mdConnections1.setNumUserDefinedDataTypes( BigInteger.valueOf( mdConnections.getNumUserDefinedDataTypes() ) );
        }
        if ( mdConnections.getNumUsers() != null ) {
            mdConnections1.setNumUsers( BigInteger.valueOf( mdConnections.getNumUsers() ) );
        }
        if ( mdConnections.getNumViews() != null ) {
            mdConnections1.setNumViews( BigInteger.valueOf( mdConnections.getNumViews() ) );
        }
        mdConnections1.setComments( mdConnections.getComments() );
        if ( mdConnections.getSecurityGroupId() != null ) {
            mdConnections1.setSecurityGroupId( BigInteger.valueOf( mdConnections.getSecurityGroupId() ) );
        }
        mdConnections1.setCreatedOn( mdConnections.getCreatedOn() );
        mdConnections1.setCreatedBy( mdConnections.getCreatedBy() );
        mdConnections1.setLastUpdatedOn( mdConnections.getLastUpdatedOn() );
        mdConnections1.setLastUpdatedBy( mdConnections.getLastUpdatedBy() );

        validaNulos( mdConnections, mdConnections1 );

        return mdConnections1;
    }

    @Override
    public MdConnectionsDTO getDto(MdConnections mdConnections) {
        if ( mdConnections == null ) {
            return null;
        }

        MdConnectionsDTO mdConnectionsDTO = new MdConnectionsDTO();

        BigDecimal id = mdConnectionsProjectIdFkId( mdConnections );
        if ( id != null ) {
            mdConnectionsDTO.setProjectIdFk( id.intValue() );
        }
        if ( mdConnections.getId() != null ) {
            mdConnectionsDTO.setId( mdConnections.getId().intValue() );
        }
        mdConnectionsDTO.setType( mdConnections.getType() );
        mdConnectionsDTO.setHost( mdConnections.getHost() );
        if ( mdConnections.getPort() != null ) {
            mdConnectionsDTO.setPort( mdConnections.getPort().intValue() );
        }
        mdConnectionsDTO.setUsername( mdConnections.getUsername() );
        mdConnectionsDTO.setPassword( mdConnections.getPassword() );
        mdConnectionsDTO.setDburl( mdConnections.getDburl() );
        mdConnectionsDTO.setName( mdConnections.getName() );
        mdConnectionsDTO.setNativeSql( mdConnections.getNativeSql() );
        mdConnectionsDTO.setStatus( mdConnections.getStatus() );
        if ( mdConnections.getNumCatalogs() != null ) {
            mdConnectionsDTO.setNumCatalogs( mdConnections.getNumCatalogs().intValue() );
        }
        if ( mdConnections.getNumColumns() != null ) {
            mdConnectionsDTO.setNumColumns( mdConnections.getNumColumns().intValue() );
        }
        if ( mdConnections.getNumConstraints() != null ) {
            mdConnectionsDTO.setNumConstraints( mdConnections.getNumConstraints().intValue() );
        }
        if ( mdConnections.getNumGroups() != null ) {
            mdConnectionsDTO.setNumGroups( mdConnections.getNumGroups().intValue() );
        }
        if ( mdConnections.getNumRoles() != null ) {
            mdConnectionsDTO.setNumRoles( mdConnections.getNumRoles().intValue() );
        }
        if ( mdConnections.getNumIndexes() != null ) {
            mdConnectionsDTO.setNumIndexes( mdConnections.getNumIndexes().intValue() );
        }
        if ( mdConnections.getNumOtherObjects() != null ) {
            mdConnectionsDTO.setNumOtherObjects( mdConnections.getNumOtherObjects().intValue() );
        }
        if ( mdConnections.getNumPackages() != null ) {
            mdConnectionsDTO.setNumPackages( mdConnections.getNumPackages().intValue() );
        }
        if ( mdConnections.getNumPrivileges() != null ) {
            mdConnectionsDTO.setNumPrivileges( mdConnections.getNumPrivileges().intValue() );
        }
        if ( mdConnections.getNumSchemas() != null ) {
            mdConnectionsDTO.setNumSchemas( mdConnections.getNumSchemas().intValue() );
        }
        if ( mdConnections.getNumSequences() != null ) {
            mdConnectionsDTO.setNumSequences( mdConnections.getNumSequences().intValue() );
        }
        if ( mdConnections.getNumStoredPrograms() != null ) {
            mdConnectionsDTO.setNumStoredPrograms( mdConnections.getNumStoredPrograms().intValue() );
        }
        if ( mdConnections.getNumSynonyms() != null ) {
            mdConnectionsDTO.setNumSynonyms( mdConnections.getNumSynonyms().intValue() );
        }
        if ( mdConnections.getNumTables() != null ) {
            mdConnectionsDTO.setNumTables( mdConnections.getNumTables().intValue() );
        }
        if ( mdConnections.getNumTablespaces() != null ) {
            mdConnectionsDTO.setNumTablespaces( mdConnections.getNumTablespaces().intValue() );
        }
        if ( mdConnections.getNumTriggers() != null ) {
            mdConnectionsDTO.setNumTriggers( mdConnections.getNumTriggers().intValue() );
        }
        if ( mdConnections.getNumUserDefinedDataTypes() != null ) {
            mdConnectionsDTO.setNumUserDefinedDataTypes( mdConnections.getNumUserDefinedDataTypes().intValue() );
        }
        if ( mdConnections.getNumUsers() != null ) {
            mdConnectionsDTO.setNumUsers( mdConnections.getNumUsers().intValue() );
        }
        if ( mdConnections.getNumViews() != null ) {
            mdConnectionsDTO.setNumViews( mdConnections.getNumViews().intValue() );
        }
        mdConnectionsDTO.setComments( mdConnections.getComments() );
        if ( mdConnections.getSecurityGroupId() != null ) {
            mdConnectionsDTO.setSecurityGroupId( mdConnections.getSecurityGroupId().intValue() );
        }
        mdConnectionsDTO.setCreatedOn( mdConnections.getCreatedOn() );
        mdConnectionsDTO.setCreatedBy( mdConnections.getCreatedBy() );
        mdConnectionsDTO.setLastUpdatedOn( mdConnections.getLastUpdatedOn() );
        mdConnectionsDTO.setLastUpdatedBy( mdConnections.getLastUpdatedBy() );

        return mdConnectionsDTO;
    }

    protected MdProjects mdConnectionsDTOToMdProjects(MdConnectionsDTO mdConnectionsDTO) {
        if ( mdConnectionsDTO == null ) {
            return null;
        }

        MdProjects mdProjects = new MdProjects();

        if ( mdConnectionsDTO.getProjectIdFk() != null ) {
            mdProjects.setId( BigDecimal.valueOf( mdConnectionsDTO.getProjectIdFk() ) );
        }

        return mdProjects;
    }

    private BigDecimal mdConnectionsProjectIdFkId(MdConnections mdConnections) {
        if ( mdConnections == null ) {
            return null;
        }
        MdProjects projectIdFk = mdConnections.getProjectIdFk();
        if ( projectIdFk == null ) {
            return null;
        }
        BigDecimal id = projectIdFk.getId();
        if ( id == null ) {
            return null;
        }
        return id;
    }
}
