package com.ejie.ad74a.dao;

import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.sql.DataSource;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.support.DataAccessUtils;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.ejie.ad74a.model.DatosInterop;
import com.ejie.ad74a.util.UtilSQL;
import com.ejie.x38.dao.RowNumResultSetExtractor;
import com.ejie.x38.dto.JerarquiaDto;
import com.ejie.x38.dto.TableManager;
import com.ejie.x38.dto.TableManagerJerarquia;
import com.ejie.x38.dto.TableRequestDto;
import com.ejie.x38.dto.TableRowDto;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;

import es.redsara.intermediacion.scsp.esquemas.datosespecificos.Retorno;

/**
 * DatosInteropDaoImpl generated by UDA, 13-abr-2023 9:33:48.
 * 
 * @author UDA
 */

@Repository
@Transactional
public class DatosInteropDaoImpl implements DatosInteropDao {
	private static final Logger logger = LoggerFactory.getLogger(DatosInteropDaoImpl.class);

	public static final String[] ORDER_BY_WHITE_LIST = new String[] { "IDINTEROP19", "IDEXPEDIENTE19", "FCONDGP19",
			"CODRESULCONDGP19", "RESULCONDGP19", "FINVOKECONDGP19", "IDTRACONDGP19", "FCONPADRON19",
			"CODRESULCONPADRON19", "RESULCONPADRON19", "FINVOKECONPADRON19", "IDTRACONPADRON19", "FCONIRPF19",
			"CODRESULCONIRPF19", "RESULCONIRPF19", "FINVOKECONIRPF19", "IDTRACONIRPF19", "FCONIMSERSO19",
			"CODRESULCONIMSERSO19", "RESULCONIMSERSO19", "FINVOKECONIMSERSO19", "IDTRACONIMSERSO19", "FCONCONYUIRPF19",
			"CODRESULCONCONYUIRPF19", "RESULCONCONYUIRPF19", "FINVOKECONCONYUIRPF19", "IDTRACONCONYUIRPF19",
			"FCONDISCAPA19", "CODRESULDISCAPA19", "RESULDISCAPA19", "FINVOKEDISCAPA19", "IDTRADISCAPA19" };

	private JdbcTemplate jdbcTemplate;

	public static final String SEQUENCE_DATOS_INTEROP = "SEQ_DATOS_INTEROP";

	/*
	 * ROW_MAPPERS
	 */
	private RowMapper<DatosInterop> rwMap = new RowMapper<DatosInterop>() {
		public DatosInterop mapRow(ResultSet resultSet, int rowNum) throws SQLException {
			return new DatosInterop(UtilSQL.getLong(resultSet, "IDINTEROP19"),
					UtilSQL.getLong(resultSet, "IDEXPEDIENTE19"), resultSet.getDate("FCONDGP19"),
					resultSet.getString("CODRESULCONDGP19"), resultSet.getString("RESULCONDGP19"),
					resultSet.getDate("FINVOKECONDGP19"), resultSet.getString("IDTRACONDGP19"),
					resultSet.getDate("FCONPADRON19"), resultSet.getString("CODRESULCONPADRON19"),
					resultSet.getString("RESULCONPADRON19"), resultSet.getDate("FINVOKECONPADRON19"),
					resultSet.getString("IDTRACONPADRON19"), resultSet.getDate("FCONIRPF19"),
					resultSet.getString("CODRESULCONIRPF19"), resultSet.getString("RESULCONIRPF19"),
					resultSet.getDate("FINVOKECONIRPF19"), resultSet.getString("IDTRACONIRPF19"),
					resultSet.getDate("FCONIMSERSO19"), resultSet.getString("CODRESULCONIMSERSO19"),
					resultSet.getString("RESULCONIMSERSO19"), resultSet.getDate("FINVOKECONIMSERSO19"),
					resultSet.getString("IDTRACONIMSERSO19"), resultSet.getDate("FCONCONYUIRPF19"),
					resultSet.getString("CODRESULCONCONYUIRPF19"), resultSet.getString("RESULCONCONYUIRPF19"),
					resultSet.getDate("FINVOKECONCONYUIRPF19"), resultSet.getString("IDTRACONCONYUIRPF19"),
					resultSet.getDate("FCONDISCAPA19"), resultSet.getString("CODRESULDISCAPA19"),
					resultSet.getString("RESULDISCAPA19"), resultSet.getDate("FINVOKEDISCAPA19"),
					resultSet.getString("IDTRADISCAPA19"));
		}
	};

	private ObjectMapper omDatosRetorno = new ObjectMapper()
			.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
	/*
	 * Rowmapper mas pesado solo para metodo find. Se encarga de recoger y parsear
	 * el objeto json DatosRetornoDGP
	 */
	private RowMapper<DatosInterop> rwMapFind = new RowMapper<DatosInterop>() {

		@Override
		public DatosInterop mapRow(ResultSet resultSet, int rowNum) throws SQLException {
			DatosInterop d = rwMap.mapRow(resultSet, rowNum);
			String datosRetornoDGPStr = resultSet.getString("DATOSRETORNODGP19");
			if (StringUtils.isNotBlank(datosRetornoDGPStr)) {
				try {
					d.setDatosRetornoDGP19(omDatosRetorno.readValue(datosRetornoDGPStr, Retorno.class));
				} catch (IOException e) {
					logger.warn("Error '{}' al parsear json de la columna DATOS_RETORNO_DGP_19 '{}'.", e.getMessage(),
							datosRetornoDGPStr);
				}
			}
			return d;
		}
	};

	private RowMapper<DatosInterop> rwMapPK = new RowMapper<DatosInterop>() {
		public DatosInterop mapRow(ResultSet resultSet, int rowNum) throws SQLException {
			return new DatosInterop(UtilSQL.getLong(resultSet, "IDINTEROP19"));
		}
	};

	/**
	 * Rowmapper para Jerarquía
	 *
	 * @param dataSource DataSource
	 * @return
	 */
	private RowMapper<JerarquiaDto<DatosInterop>> rwMapJerarquia = new RowMapper<JerarquiaDto<DatosInterop>>() {
		public JerarquiaDto<DatosInterop> mapRow(ResultSet resultSet, int rowNum) throws SQLException {

			DatosInterop datosinterop = new DatosInterop(UtilSQL.getLong(resultSet, "IDINTEROP19"),
					UtilSQL.getLong(resultSet, "IDEXPEDIENTE19"), resultSet.getDate("FCONDGP19"),
					resultSet.getString("CODRESULCONDGP19"), resultSet.getString("RESULCONDGP19"),
					resultSet.getDate("FINVOKECONDGP19"), resultSet.getString("IDTRACONDGP19"),
					resultSet.getDate("FCONPADRON19"), resultSet.getString("CODRESULCONPADRON19"),
					resultSet.getString("RESULCONPADRON19"), resultSet.getDate("FINVOKECONPADRON19"),
					resultSet.getString("IDTRACONPADRON19"), resultSet.getDate("FCONIRPF19"),
					resultSet.getString("CODRESULCONIRPF19"), resultSet.getString("RESULCONIRPF19"),
					resultSet.getDate("FINVOKECONIRPF19"), resultSet.getString("IDTRACONIRPF19"),
					resultSet.getDate("FCONIMSERSO19"), resultSet.getString("CODRESULCONIMSERSO19"),
					resultSet.getString("RESULCONIMSERSO19"), resultSet.getDate("FINVOKECONIMSERSO19"),
					resultSet.getString("IDTRACONIMSERSO19"), resultSet.getDate("FCONCONYUIRPF19"),
					resultSet.getString("CODRESULCONCONYUIRPF19"), resultSet.getString("RESULCONCONYUIRPF19"),
					resultSet.getDate("FINVOKECONCONYUIRPF19"), resultSet.getString("IDTRACONCONYUIRPF19"),
					resultSet.getDate("FCONDISCAPA19"), resultSet.getString("CODRESULDISCAPA19"),
					resultSet.getString("RESULDISCAPA19"), resultSet.getDate("FINVOKEDISCAPA19"),
					resultSet.getString("IDTRADISCAPA19"));

			JerarquiaDto<DatosInterop> jerarquia = new JerarquiaDto<DatosInterop>();
			jerarquia.setModel(datosinterop);
			jerarquia.setLevel(resultSet.getBigDecimal("LEVEL").intValue());
			jerarquia.setParentNodes(resultSet.getString("PARENTNODES"));
			jerarquia.setIsLeaf(Boolean.parseBoolean(resultSet.getString("ISLEAF")));
			jerarquia.setFilter(Boolean.parseBoolean(resultSet.getString("FILTER")));
			return jerarquia;
		}
	};

	/**
	 * Method use to set the datasource.
	 *
	 * @param dataSource DataSource
	 * @return
	 */
	@Resource
	public void setDataSource(DataSource dataSource) {
		this.jdbcTemplate = new JdbcTemplate(dataSource);
	}

	/*
	 * OPERACIONES CRUD
	 */

	/**
	 * Inserts a single row in the DatosInterop table.
	 *
	 * @param datosinterop DatosInterop
	 * @return DatosInterop
	 */
	public DatosInterop add(DatosInterop datosinterop) {

		GeneratedKeyHolder generatedKeyHolder = new GeneratedKeyHolder();

		String query = "INSERT INTO DATOS_INTEROP (ID_INTEROP_19, ID_EXPEDIENTE_19, F_CON_DGP_19, CODRESUL_CON_DGP_19, RESUL_CON_DGP_19, FINVOKE_CON_DGP_19, IDTRA_CON_DGP_19, F_CON_PADRON_19, CODRESUL_CON_PADRON_19, RESUL_CON_PADRON_19, FINVOKE_CON_PADRON_19, IDTRA_CON_PADRON_19, F_CON_IRPF_19, CODRESUL_CON_IRPF_19, RESUL_CON_IRPF_19, FINVOKE_CON_IRPF_19, IDTRA_CON_IRPF_19, F_CON_IMSERSO_19, CODRESUL_CON_IMSERSO_19, RESUL_CON_IMSERSO_19, FINVOKE_CON_IMSERSO_19, IDTRA_CON_IMSERSO_19, F_CON_CONYU_IRPF_19, CODRESUL_CON_CONYU_IRPF_19, RESUL_CON_CONYU_IRPF_19, FINVOKE_CON_CONYU_IRPF_19, IDTRA_CON_CONYU_IRPF_19, F_CON_DISCAPA_19, CODRESUL_DISCAPA_19, RESUL_DISCAPA_19, FINVOKE_DISCAPA_19, IDTRA_DISCAPA_19, DATOS_RETORNO_DGP_19) "
				+ "VALUES (" + SEQUENCE_DATOS_INTEROP
				+ ".NEXTVAL,:idExpediente,:fConDgp,:codResulConDgp,:resulConDgp,:fInvokeConDgp,:idtraConDgp,:fConPadron,:codResulConPadron,:resulConPadron,:fInvokeConPadron,:idtraConPadron,:fConIrpf,:codResulConIrpf,:resulConIrpf,:fInvokeConIrpf,:idtraConIrpf,:fConImserso,:codResulImserso,:resulConImserso,:fInvokeImserso,:idtraConImserso, :fConConyu, :codResulConyu, :resulConConyu, :fInvokeConyu, :idtraConConyu, :fConDiscapa, :codResulDiscapa, :resulDiscapa, :fInvokeDiscapa, :idtraDiscapa, :datosRetornoDgp)";

		MapSqlParameterSource parameters = new MapSqlParameterSource()
				.addValue("idExpediente", datosinterop.getIdExpediente19())
				.addValue("fConDgp", datosinterop.getfConDgp19())
				.addValue("codResulConDgp", datosinterop.getCodresulConDgp19())
				.addValue("resulConDgp", datosinterop.getResulConDgp19())
				.addValue("fInvokeConDgp", datosinterop.getfinvokeConDgp19())
				.addValue("idtraConDgp", datosinterop.getIdtraConDgp19())

				.addValue("fConPadron", datosinterop.getfConPadron19())
				.addValue("codResulConPadron", datosinterop.getCodresulConPadron19())
				.addValue("resulConPadron", datosinterop.getResulConPadron19())
				.addValue("fInvokeConPadron", datosinterop.getfinvokeConPadron19())
				.addValue("idtraConPadron", datosinterop.getIdtraConPadron19())

				.addValue("fConIrpf", datosinterop.getfConIrpf19())
				.addValue("codResulConIrpf", datosinterop.getCodresulConIrpf19())
				.addValue("resulConIrpf", datosinterop.getResulConIrpf19())
				.addValue("fInvokeConIrpf", datosinterop.getfinvokeConIrpf19())
				.addValue("idtraConIrpf", datosinterop.getIdtraConIrpf19())

				.addValue("fConImserso", datosinterop.getfConImserso19())
				.addValue("codResulImserso", datosinterop.getCodresulConImserso19())
				.addValue("resulConImserso", datosinterop.getResulConImserso19())
				.addValue("fInvokeImserso", datosinterop.getfinvokeConImserso19())
				.addValue("idtraConImserso", datosinterop.getIdtraConImserso19())

				.addValue("fConConyu", datosinterop.getfConConyuIrpf19())
				.addValue("codResulConyu", datosinterop.getCodresulConConyuIrpf19())
				.addValue("resulConConyu", datosinterop.getResulConConyuIrpf19())
				.addValue("fInvokeConyu", datosinterop.getfinvokeConConyuIrpf19())
				.addValue("idtraConConyu", datosinterop.getIdtraConConyuIrpf19())

				.addValue("fConDiscapa", datosinterop.getfConDiscapa19())
				.addValue("codResulDiscapa", datosinterop.getResulDiscapa19())
				.addValue("resulDiscapa", datosinterop.getResulDiscapa19())
				.addValue("fInvokeDiscapa", datosinterop.getFinvokeDiscapa19())
				.addValue("idtraDiscapa", datosinterop.getIdtraDiscapa19());
		String datosRetornoDGPStr = null;
		if (datosinterop.getDatosRetornoDGP19() != null) {
			try {
				datosRetornoDGPStr = omDatosRetorno.writeValueAsString(datosinterop.getDatosRetornoDGP19());
			} catch (IOException e) {
				logger.warn("Error '{}' al parsear json de la columna DATOS_RETORNO_DGP_19 '{}'.", e.getMessage(),
						datosRetornoDGPStr);
			}
		}
		parameters.addValue("datosRetornoDgp", datosRetornoDGPStr);

		NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
		namedParameterJdbcTemplate.update(query, parameters, generatedKeyHolder, new String[] { "ID_INTEROP_19" });
		datosinterop.setIdInterop19(generatedKeyHolder.getKey().longValue());
		return datosinterop;
	}

	/**
	 * Updates a single row in the DatosInterop table.
	 *
	 * @param datosinterop DatosInterop
	 * @return DatosInterop
	 */
	public DatosInterop update(DatosInterop datosinterop) {
		String query = "UPDATE DATOS_INTEROP SET ID_EXPEDIENTE_19=?, F_CON_DGP_19=?, CODRESUL_CON_DGP_19=?, RESUL_CON_DGP_19=?, FINVOKE_CON_DGP_19=?, IDTRA_CON_DGP_19=?, F_CON_PADRON_19=?, CODRESUL_CON_PADRON_19=?, RESUL_CON_PADRON_19=?, FINVOKE_CON_PADRON_19=?, IDTRA_CON_PADRON_19=?, F_CON_IRPF_19=?, CODRESUL_CON_IRPF_19=?, RESUL_CON_IRPF_19=?, FINVOKE_CON_IRPF_19=?, IDTRA_CON_IRPF_19=?, F_CON_IMSERSO_19=?, CODRESUL_CON_IMSERSO_19=?, RESUL_CON_IMSERSO_19=?, FINVOKE_CON_IMSERSO_19=?, IDTRA_CON_IMSERSO_19=?, F_CON_CONYU_IRPF_19 = ?, CODRESUL_CON_CONYU_IRPF_19 = ?, RESUL_CON_CONYU_IRPF_19 = ?, FINVOKE_CON_CONYU_IRPF_19 = ?, IDTRA_CON_CONYU_IRPF_19 = ?, F_CON_DISCAPA_19 = ?, CODRESUL_DISCAPA_19 = ?, RESUL_DISCAPA_19 = ?, FINVOKE_DISCAPA_19 = ?, IDTRA_DISCAPA_19 = ?, DATOS_RETORNO_DGP_19 = ? WHERE ID_INTEROP_19=?";

		String datosRetornoDGPStr = null;
		if (datosinterop.getDatosRetornoDGP19() != null) {
			try {
				datosRetornoDGPStr = omDatosRetorno.writeValueAsString(datosinterop.getDatosRetornoDGP19());
			} catch (IOException e) {
				logger.warn("Error '{}' al parsear json de la columna DATOS_RETORNO_DGP_19 '{}'.", e.getMessage(),
						datosRetornoDGPStr);
			}
		}
		this.jdbcTemplate.update(query, datosinterop.getIdExpediente19(), datosinterop.getfConDgp19(),
				datosinterop.getCodresulConDgp19(), datosinterop.getResulConDgp19(), datosinterop.getfinvokeConDgp19(),
				datosinterop.getIdtraConDgp19(), datosinterop.getfConPadron19(), datosinterop.getCodresulConPadron19(),
				datosinterop.getResulConPadron19(), datosinterop.getfinvokeConPadron19(),
				datosinterop.getIdtraConPadron19(), datosinterop.getfConIrpf19(), datosinterop.getCodresulConIrpf19(),
				datosinterop.getResulConIrpf19(), datosinterop.getfinvokeConIrpf19(), datosinterop.getIdtraConIrpf19(),
				datosinterop.getfConImserso19(), datosinterop.getCodresulConImserso19(),
				datosinterop.getResulConImserso19(), datosinterop.getfinvokeConImserso19(),
				datosinterop.getIdtraConImserso19(), datosinterop.getfConConyuIrpf19(),
				datosinterop.getCodresulConConyuIrpf19(), datosinterop.getResulConConyuIrpf19(),
				datosinterop.getfinvokeConConyuIrpf19(), datosinterop.getIdtraConConyuIrpf19(),
				datosinterop.getfConDiscapa19(), datosinterop.getCodresulDiscapa19(), datosinterop.getResulDiscapa19(),
				datosinterop.getFinvokeDiscapa19(), datosinterop.getIdtraDiscapa19(), datosRetornoDGPStr,
				datosinterop.getIdInterop19());
		return datosinterop;
	}

	/**
	 * Actualiza los datos de interoperabilidad del conyuge
	 *
	 * @param datosinterop DatosInterop
	 * @return DatosInterop
	 */
	public DatosInterop updateDatosConyuge(DatosInterop datosinterop) {
		String query = "UPDATE DATOS_INTEROP SET F_CON_CONYU_IRPF_19 = ?, CODRESUL_CON_CONYU_IRPF_19 = ?, RESUL_CON_CONYU_IRPF_19 = ?, FINVOKE_CON_CONYU_IRPF_19 = ?, IDTRA_CON_CONYU_IRPF_19 = ? WHERE ID_INTEROP_19=?";
		this.jdbcTemplate.update(query, datosinterop.getfConConyuIrpf19(), datosinterop.getCodresulConConyuIrpf19(),
				datosinterop.getResulConConyuIrpf19(), datosinterop.getfinvokeConConyuIrpf19(),
				datosinterop.getIdtraConConyuIrpf19(), datosinterop.getIdInterop19());
		return datosinterop;
	}

	public DatosInterop updateDatosDiscapacidad(DatosInterop datosinterop) {
		String query = "UPDATE DATOS_INTEROP SET F_CON_DISCAPA_19 = ?, CODRESUL_DISCAPA_19 = ?, RESUL_DISCAPA_19 = ?, FINVOKE_DISCAPA_19 = ?, IDTRA_DISCAPA_19 = ? WHERE ID_INTEROP_19=?";
		this.jdbcTemplate.update(query, datosinterop.getfConDiscapa19(), datosinterop.getCodresulDiscapa19(),
				datosinterop.getResulDiscapa19(), datosinterop.getFinvokeDiscapa19(), datosinterop.getIdtraDiscapa19(),
				datosinterop.getIdInterop19());
		return datosinterop;
	}

	/**
	 * Actualiza los datos de interoperabilidad del titular
	 *
	 * @param datosinterop DatosInterop
	 * @return DatosInterop
	 */
	public DatosInterop updateDatosTitular(DatosInterop datosinterop) {

		String query = "UPDATE DATOS_INTEROP SET F_CON_DGP_19=?, CODRESUL_CON_DGP_19=?, RESUL_CON_DGP_19=?, FINVOKE_CON_DGP_19=?, IDTRA_CON_DGP_19=?, F_CON_PADRON_19=?, CODRESUL_CON_PADRON_19=?, RESUL_CON_PADRON_19=?, FINVOKE_CON_PADRON_19=?, IDTRA_CON_PADRON_19=?, F_CON_IRPF_19=?, CODRESUL_CON_IRPF_19=?, RESUL_CON_IRPF_19=?, FINVOKE_CON_IRPF_19=?, IDTRA_CON_IRPF_19=?, F_CON_IMSERSO_19=?, CODRESUL_CON_IMSERSO_19=?, RESUL_CON_IMSERSO_19=?, FINVOKE_CON_IMSERSO_19=?, IDTRA_CON_IMSERSO_19=?, DATOS_RETORNO_DGP_19 = ?,F_CON_DISCAPA_19 = ?, CODRESUL_DISCAPA_19 = ?, RESUL_DISCAPA_19 = ?, FINVOKE_DISCAPA_19 = ?, IDTRA_DISCAPA_19 = ? WHERE ID_INTEROP_19=?";
		String datosRetornoDGPStr = null;
		if (datosinterop.getDatosRetornoDGP19() != null) {
			try {
				datosRetornoDGPStr = omDatosRetorno.writeValueAsString(datosinterop.getDatosRetornoDGP19());
			} catch (IOException e) {
				logger.warn("Error '{}' al parsear json de la columna DATOS_RETORNO_DGP_19 '{}'.", e.getMessage(),
						datosRetornoDGPStr);
			}
		}
		this.jdbcTemplate.update(query, datosinterop.getfConDgp19(), datosinterop.getCodresulConDgp19(),
				datosinterop.getResulConDgp19(), datosinterop.getfinvokeConDgp19(), datosinterop.getIdtraConDgp19(),
				datosinterop.getfConPadron19(), datosinterop.getCodresulConPadron19(),
				datosinterop.getResulConPadron19(), datosinterop.getfinvokeConPadron19(),
				datosinterop.getIdtraConPadron19(), datosinterop.getfConIrpf19(), datosinterop.getCodresulConIrpf19(),
				datosinterop.getResulConIrpf19(), datosinterop.getfinvokeConIrpf19(), datosinterop.getIdtraConIrpf19(),
				datosinterop.getfConImserso19(), datosinterop.getCodresulConImserso19(),
				datosinterop.getResulConImserso19(), datosinterop.getfinvokeConImserso19(),
				datosinterop.getIdtraConImserso19(), datosRetornoDGPStr,

				datosinterop.getfConDiscapa19(), datosinterop.getCodresulDiscapa19(), datosinterop.getResulDiscapa19(),
				datosinterop.getFinvokeDiscapa19(), datosinterop.getIdtraDiscapa19(),

				datosinterop.getIdInterop19());
		return datosinterop;
	}

	/**
	 * Actualiza los datos de interoperabilidad del titular
	 *
	 * @param datosinterop DatosInterop
	 * @return DatosInterop
	 */
	public DatosInterop updateDatosEspecificos(DatosInterop datosinterop, String interoperabilidad) {
		List<Object> params = new ArrayList<>();

		String datosRetornoDGPStr = null;
		if (datosinterop.getDatosRetornoDGP19() != null) {
			try {
				datosRetornoDGPStr = omDatosRetorno.writeValueAsString(datosinterop.getDatosRetornoDGP19());
			} catch (IOException e) {
				logger.warn("Error '{}' al parsear json de la columna DATOS_RETORNO_DGP_19 '{}'.", e.getMessage(),
						datosRetornoDGPStr);
			}
		}

		StringBuilder query = new StringBuilder("UPDATE DATOS_INTEROP SET ");
		// Interoperabilidad DGP
		if (com.ejie.ad74a.util.constantes.Constantes.Nisae.COD_CERTIFICADO_CONSULTA_DGP.equals(interoperabilidad)
				|| com.ejie.ad74a.util.constantes.Constantes.Nisae.LANZAR_TODAS_MENOS_CONYUGE
						.equals(interoperabilidad)) {
			query.append("f_con_dgp_19 = ?,	");
			params.add(datosinterop.getfConDgp19());
			query.append("codresul_con_dgp_19 = ?,  ");
			params.add(datosinterop.getCodresulConDgp19());
			query.append("resul_con_dgp_19 = ?, ");
			params.add(datosinterop.getResulConDgp19());
			query.append("finvoke_con_dgp_19 = SYSDATE, ");
			query.append("idtra_con_dgp_19 = ?, ");
			params.add(datosinterop.getIdtraConDgp19());
			query.append("datos_retorno_dgp_19 = ?, ");
			params.add(datosRetornoDGPStr);
		}

		// Interoperabilidad Padrón
		if (com.ejie.ad74a.util.constantes.Constantes.Nisae.COD_CERTIFICADO_CONSULTA_PADRON.equals(interoperabilidad)
				|| com.ejie.ad74a.util.constantes.Constantes.Nisae.LANZAR_TODAS_MENOS_CONYUGE
						.equals(interoperabilidad)) {
			query.append("f_con_padron_19 = ?, ");
			params.add(datosinterop.getfConPadron19());
			query.append("codresul_con_padron_19 = ?, ");
			params.add(datosinterop.getCodresulConPadron19());
			query.append("resul_con_padron_19 = ?, ");
			params.add(datosinterop.getResulConPadron19());
			query.append("finvoke_con_padron_19 = SYSDATE, ");
			query.append("idtra_con_padron_19 = ?, ");
			params.add(datosinterop.getIdtraConPadron19());
		}

		// Interoperabilidad IRPF
		if (com.ejie.ad74a.util.constantes.Constantes.Nisae.COD_CERTIFICADO_CONSULTA_IRPF.equals(interoperabilidad)
				|| com.ejie.ad74a.util.constantes.Constantes.Nisae.LANZAR_TODAS_MENOS_CONYUGE
						.equals(interoperabilidad)) {
			query.append("f_con_irpf_19 = ?, ");
			params.add(datosinterop.getfConIrpf19());
			query.append("codresul_con_irpf_19 = ?, ");
			params.add(datosinterop.getCodresulConIrpf19());
			query.append("resul_con_irpf_19 = ?, ");
			params.add(datosinterop.getResulConIrpf19());
			query.append("finvoke_con_irpf_19 = SYSDATE, ");
			query.append("idtra_con_irpf_19 = ?, ");
			params.add(datosinterop.getIdtraConIrpf19());
		}

		// Interoperabilidad Imserso
		if (com.ejie.ad74a.util.constantes.Constantes.Nisae.COD_CERTIFICADO_CONSULTA_DEPENDENCIA
				.equals(interoperabilidad)
				|| com.ejie.ad74a.util.constantes.Constantes.Nisae.LANZAR_TODAS_MENOS_CONYUGE
						.equals(interoperabilidad)) {
			query.append("f_con_imserso_19 = ?, ");
			params.add(datosinterop.getfConImserso19());
			query.append("codresul_con_imserso_19 = ?, ");
			params.add(datosinterop.getCodresulConImserso19());
			query.append("resul_con_imserso_19 = ?, ");
			params.add(datosinterop.getResulConImserso19());
			query.append("finvoke_con_imserso_19 = SYSDATE, ");
			query.append("idtra_con_imserso_19 = ?, ");
			params.add(datosinterop.getIdtraConImserso19());
		}

		// Interoperabilidad Discapacidad
		if (com.ejie.ad74a.util.constantes.Constantes.Nisae.COD_CERTIFICADO_CONSULTA_DISCAPACIDAD
				.equals(interoperabilidad)
				|| com.ejie.ad74a.util.constantes.Constantes.Nisae.LANZAR_TODAS_MENOS_CONYUGE
						.equals(interoperabilidad)) {
			query.append("f_con_discapa_19 = ?, ");
			params.add(datosinterop.getfConDiscapa19());
			query.append("codresul_discapa_19 = ?, ");
			params.add(datosinterop.getCodresulDiscapa19());
			query.append("resul_discapa_19 = ?, ");
			params.add(datosinterop.getResulDiscapa19());
			query.append("finvoke_discapa_19 = SYSDATE, ");
			query.append("idtra_discapa_19 = ?, ");
			params.add(datosinterop.getIdtraDiscapa19());
		}

		if (com.ejie.ad74a.util.constantes.Constantes.Nisae.ES_CONSULTA_DE_CONYUGE.equals(interoperabilidad)) {
			query.append("F_CON_CONYU_IRPF_19 = ?, ");
			params.add(datosinterop.getfConConyuIrpf19());
			query.append("CODRESUL_CON_CONYU_IRPF_19 = ?, ");
			params.add(datosinterop.getCodresulConConyuIrpf19());
			query.append("RESUL_CON_CONYU_IRPF_19 = ?, ");
			params.add(datosinterop.getResulConConyuIrpf19());
			query.append("FINVOKE_CON_CONYU_IRPF_19 = SYSDATE, ");
			query.append("IDTRA_CON_CONYU_IRPF_19 = ?, ");
			params.add(datosinterop.getIdtraConConyuIrpf19());
		}

		// Eliminamos la coma final y añadimos la cláusula WHERE
		query.setLength(query.length() - 2); // Elimina la última coma y el espacio

		query.append(" WHERE id_interop_19 = ?");
		params.add(datosinterop.getIdInterop19());

		// Ejecutamos la actualización
		this.jdbcTemplate.update(query.toString(), params.toArray());

		return datosinterop;
	}

	/**
	 * Finds a single row in the DatosInterop table.
	 *
	 * @param datosinterop DatosInterop
	 * @return DatosInterop
	 */
	@Transactional(readOnly = true)
	public DatosInterop find(DatosInterop datosinterop) {
		String query = "SELECT t1.ID_INTEROP_19 IDINTEROP19, t1.ID_EXPEDIENTE_19 IDEXPEDIENTE19, t1.F_CON_DGP_19 FCONDGP19, t1.CODRESUL_CON_DGP_19 CODRESULCONDGP19, t1.RESUL_CON_DGP_19 RESULCONDGP19, t1.FINVOKE_CON_DGP_19 FINVOKECONDGP19, t1.IDTRA_CON_DGP_19 IDTRACONDGP19, t1.F_CON_PADRON_19 FCONPADRON19, t1.CODRESUL_CON_PADRON_19 CODRESULCONPADRON19, t1.RESUL_CON_PADRON_19 RESULCONPADRON19, t1.FINVOKE_CON_PADRON_19 FINVOKECONPADRON19, t1.IDTRA_CON_PADRON_19 IDTRACONPADRON19, t1.F_CON_IRPF_19 FCONIRPF19, t1.CODRESUL_CON_IRPF_19 CODRESULCONIRPF19, t1.RESUL_CON_IRPF_19 RESULCONIRPF19, t1.FINVOKE_CON_IRPF_19 FINVOKECONIRPF19, t1.IDTRA_CON_IRPF_19 IDTRACONIRPF19, t1.F_CON_IMSERSO_19 FCONIMSERSO19, t1.CODRESUL_CON_IMSERSO_19 CODRESULCONIMSERSO19, t1.RESUL_CON_IMSERSO_19 RESULCONIMSERSO19, t1.FINVOKE_CON_IMSERSO_19 FINVOKECONIMSERSO19, t1.IDTRA_CON_IMSERSO_19 IDTRACONIMSERSO19, t1.F_CON_CONYU_IRPF_19 FCONCONYUIRPF19, t1.CODRESUL_CON_CONYU_IRPF_19 CODRESULCONCONYUIRPF19, t1.RESUL_CON_CONYU_IRPF_19 RESULCONCONYUIRPF19, t1.FINVOKE_CON_CONYU_IRPF_19 FINVOKECONCONYUIRPF19, t1.IDTRA_CON_CONYU_IRPF_19 IDTRACONCONYUIRPF19, t1.F_CON_DISCAPA_19 FCONDISCAPA19, t1.CODRESUL_DISCAPA_19 CODRESULDISCAPA19, t1.RESUL_DISCAPA_19 RESULDISCAPA19, t1.FINVOKE_DISCAPA_19 FINVOKEDISCAPA19, t1.IDTRA_DISCAPA_19 IDTRADISCAPA19, t1.DATOS_RETORNO_DGP_19 DATOSRETORNODGP19 FROM DATOS_INTEROP t1  WHERE t1.ID_INTEROP_19 = ?  ";

		List<DatosInterop> datosinteropList = this.jdbcTemplate.query(query, this.rwMapFind,
				datosinterop.getIdInterop19());
		return (DatosInterop) DataAccessUtils.uniqueResult(datosinteropList);
	}

	/**
	 * Finds a single row in the DatosInterop table.
	 *
	 * @param datosinterop DatosInterop
	 * @return DatosInterop
	 */
	@Transactional(readOnly = true)
	public DatosInterop findIdExpediente(DatosInterop datosinterop) {
		String query = "SELECT t1.ID_INTEROP_19 IDINTEROP19, t1.ID_EXPEDIENTE_19 IDEXPEDIENTE19, t1.F_CON_DGP_19 FCONDGP19, t1.CODRESUL_CON_DGP_19 CODRESULCONDGP19, t1.RESUL_CON_DGP_19 RESULCONDGP19, t1.FINVOKE_CON_DGP_19 FINVOKECONDGP19, t1.IDTRA_CON_DGP_19 IDTRACONDGP19, t1.F_CON_PADRON_19 FCONPADRON19, t1.CODRESUL_CON_PADRON_19 CODRESULCONPADRON19, t1.RESUL_CON_PADRON_19 RESULCONPADRON19, t1.FINVOKE_CON_PADRON_19 FINVOKECONPADRON19, t1.IDTRA_CON_PADRON_19 IDTRACONPADRON19, t1.F_CON_IRPF_19 FCONIRPF19, t1.CODRESUL_CON_IRPF_19 CODRESULCONIRPF19, t1.RESUL_CON_IRPF_19 RESULCONIRPF19, t1.FINVOKE_CON_IRPF_19 FINVOKECONIRPF19, t1.IDTRA_CON_IRPF_19 IDTRACONIRPF19, t1.F_CON_IMSERSO_19 FCONIMSERSO19, t1.CODRESUL_CON_IMSERSO_19 CODRESULCONIMSERSO19, t1.RESUL_CON_IMSERSO_19 RESULCONIMSERSO19, t1.FINVOKE_CON_IMSERSO_19 FINVOKECONIMSERSO19, t1.IDTRA_CON_IMSERSO_19 IDTRACONIMSERSO19, t1.F_CON_CONYU_IRPF_19 FCONCONYUIRPF19, t1.CODRESUL_CON_CONYU_IRPF_19 CODRESULCONCONYUIRPF19, t1.RESUL_CON_CONYU_IRPF_19 RESULCONCONYUIRPF19, t1.FINVOKE_CON_CONYU_IRPF_19 FINVOKECONCONYUIRPF19, t1.IDTRA_CON_CONYU_IRPF_19 IDTRACONCONYUIRPF19, t1.F_CON_DISCAPA_19 FCONDISCAPA19, t1.CODRESUL_DISCAPA_19 CODRESULDISCAPA19, t1.RESUL_DISCAPA_19 RESULDISCAPA19, t1.FINVOKE_DISCAPA_19 FINVOKEDISCAPA19, t1.IDTRA_DISCAPA_19 IDTRADISCAPA19, t1.DATOS_RETORNO_DGP_19 DATOSRETORNODGP19 FROM DATOS_INTEROP t1  WHERE t1.ID_EXPEDIENTE_19 = ?  ";

		List<DatosInterop> datosinteropList = this.jdbcTemplate.query(query, this.rwMapFind,
				datosinterop.getIdExpediente19());
		return (DatosInterop) DataAccessUtils.uniqueResult(datosinteropList);
	}

	/**
	 * Removes a single row in the DatosInterop table.
	 *
	 * @param datosinterop DatosInterop
	 * @return
	 */
	public void remove(DatosInterop datosinterop) {
		String query = "DELETE FROM DATOS_INTEROP WHERE ID_INTEROP_19=?";
		this.jdbcTemplate.update(query, datosinterop.getIdInterop19());
	}

	/**
	 * Exporta Datos al clipBoard
	 *
	 */
	public List<DatosInterop> getMultiple(DatosInterop filterDatosInterop, TableRequestDto tableRequestDto,
			Boolean startsWith) {

		StringBuilder query = new StringBuilder(
				"SELECT t1.ID_INTEROP_19 IDINTEROP19, t1.ID_EXPEDIENTE_19 IDEXPEDIENTE19, t1.F_CON_DGP_19 FCONDGP19, t1.CODRESUL_CON_DGP_19 CODRESULCONDGP19, t1.RESUL_CON_DGP_19 RESULCONDGP19, t1.FINVOKE_CON_DGP_19 FINVOKECONDGP19, t1.IDTRA_CON_DGP_19 IDTRACONDGP19, t1.F_CON_PADRON_19 FCONPADRON19, t1.CODRESUL_CON_PADRON_19 CODRESULCONPADRON19, t1.RESUL_CON_PADRON_19 RESULCONPADRON19, t1.FINVOKE_CON_PADRON_19 FINVOKECONPADRON19, t1.IDTRA_CON_PADRON_19 IDTRACONPADRON19, t1.F_CON_IRPF_19 FCONIRPF19, t1.CODRESUL_CON_IRPF_19 CODRESULCONIRPF19, t1.RESUL_CON_IRPF_19 RESULCONIRPF19, t1.FINVOKE_CON_IRPF_19 FINVOKECONIRPF19, t1.IDTRA_CON_IRPF_19 IDTRACONIRPF19, t1.F_CON_IMSERSO_19 FCONIMSERSO19, t1.CODRESUL_CON_IMSERSO_19 CODRESULCONIMSERSO19, t1.RESUL_CON_IMSERSO_19 RESULCONIMSERSO19, t1.FINVOKE_CON_IMSERSO_19 FINVOKECONIMSERSO19, t1.IDTRA_CON_IMSERSO_19 IDTRACONIMSERSO19, t1.F_CON_CONYU_IRPF_19 FCONCONYUIRPF19, t1.CODRESUL_CON_CONYU_IRPF_19 CODRESULCONCONYUIRPF19, t1.RESUL_CON_CONYU_IRPF_19 RESULCONCONYUIRPF19, t1.FINVOKE_CON_CONYU_IRPF_19 FINVOKECONCONYUIRPF19, t1.IDTRA_CON_CONYU_IRPF_19 IDTRACONCONYUIRPF19, t1.F_CON_DISCAPA_19 FCONDISCAPA19, t1.CODRESUL_DISCAPA_19 CODRESULDISCAPA19, t1.RESUL_DISCAPA_19 RESULDISCAPA19, t1.FINVOKE_DISCAPA_19 FINVOKEDISCAPA19, t1.IDTRA_DISCAPA_19 IDTRADISCAPA19 ");
		query.append(" FROM DATOS_INTEROP t1  ");
		// Where clause & Params
		Map<String, Object> mapaWhere = this.getWhereLikeMap(filterDatosInterop, startsWith);
		StringBuilder where = new StringBuilder(query + " WHERE 1=1 ");
		where.append(mapaWhere.get("query"));

		@SuppressWarnings("unchecked")
		List<Object> params = (List<Object>) mapaWhere.get("params");

		StringBuilder sbMultipleSQL = TableManager.getSelectMultipleQuery(tableRequestDto, DatosInterop.class, params,
				"ID_INTEROP_19");
		where.append(sbMultipleSQL);

		return this.jdbcTemplate.query(where.toString(), this.rwMap, params.toArray());
	}

	/**
	 * Finds a list of rows in the DatosInterop table.
	 *
	 * @param datosinterop    DatosInterop
	 * @param tableRequestDto TableRequestDto
	 * @return List<DatosInterop>
	 */
	@Transactional(readOnly = true)
	public List<DatosInterop> findAll(DatosInterop datosinterop, TableRequestDto tableRequestDto) {
		StringBuilder query = new StringBuilder(
				"SELECT  t1.ID_INTEROP_19 IDINTEROP19,t1.ID_EXPEDIENTE_19 IDEXPEDIENTE19,t1.F_CON_DGP_19 FCONDGP19,t1.CODRESUL_CON_DGP_19 CODRESULCONDGP19,t1.RESUL_CON_DGP_19 RESULCONDGP19,t1.FINVOKE_CON_DGP_19 FINVOKECONDGP19,t1.IDTRA_CON_DGP_19 IDTRACONDGP19,t1.F_CON_PADRON_19 FCONPADRON19,t1.CODRESUL_CON_PADRON_19 CODRESULCONPADRON19,t1.RESUL_CON_PADRON_19 RESULCONPADRON19,t1.FINVOKE_CON_PADRON_19 FINVOKECONPADRON19,t1.IDTRA_CON_PADRON_19 IDTRACONPADRON19,t1.F_CON_IRPF_19 FCONIRPF19,t1.CODRESUL_CON_IRPF_19 CODRESULCONIRPF19,t1.RESUL_CON_IRPF_19 RESULCONIRPF19,t1.FINVOKE_CON_IRPF_19 FINVOKECONIRPF19,t1.IDTRA_CON_IRPF_19 IDTRACONIRPF19,t1.F_CON_IMSERSO_19 FCONIMSERSO19,t1.CODRESUL_CON_IMSERSO_19 CODRESULCONIMSERSO19,t1.RESUL_CON_IMSERSO_19 RESULCONIMSERSO19,t1.FINVOKE_CON_IMSERSO_19 FINVOKECONIMSERSO19,t1.IDTRA_CON_IMSERSO_19 IDTRACONIMSERSO19, t1.F_CON_CONYU_IRPF_19 FCONCONYUIRPF19, t1.CODRESUL_CON_CONYU_IRPF_19 CODRESULCONCONYUIRPF19, t1.RESUL_CON_CONYU_IRPF_19 RESULCONCONYUIRPF19, t1.FINVOKE_CON_CONYU_IRPF_19 FINVOKECONCONYUIRPF19, t1.IDTRA_CON_CONYU_IRPF_19 IDTRACONCONYUIRPF19, t1.F_CON_DISCAPA_19 FCONDISCAPA19, t1.CODRESUL_DISCAPA_19 CODRESULDISCAPA19, t1.RESUL_DISCAPA_19 RESULDISCAPA19, t1.FINVOKE_DISCAPA_19 FINVOKEDISCAPA19, t1.IDTRA_DISCAPA_19 IDTRADISCAPA19  ");
		query.append("FROM DATOS_INTEROP t1 ");

		// Where clause & Params
		Map<String, ?> mapaWhere = this.getWhereMap(datosinterop);
		StringBuilder where = new StringBuilder(" WHERE 1=1 ");
		where.append(mapaWhere.get("query"));
		query.append(where);

		List<?> params = (List<?>) mapaWhere.get("params");

		if (tableRequestDto != null) {
			query = TableManager.getPaginationQuery(tableRequestDto, query, DatosInteropDaoImpl.ORDER_BY_WHITE_LIST);
		}

		return (List<DatosInterop>) this.jdbcTemplate.query(query.toString(), this.rwMap, params.toArray());
	}

	/**
	 * Finds rows in the DatosInterop table using like.
	 *
	 * @param datosinterop    DatosInterop
	 * @param tableRequestDto TableRequestDto
	 * @param startsWith      Boolean
	 * @return List<DatosInterop>
	 */
	@Transactional(readOnly = true)
	public List<DatosInterop> findAllLike(DatosInterop datosinterop, TableRequestDto tableRequestDto,
			Boolean startsWith) {
		StringBuilder query = new StringBuilder(
				"SELECT  t1.ID_INTEROP_19 IDINTEROP19,t1.ID_EXPEDIENTE_19 IDEXPEDIENTE19,t1.F_CON_DGP_19 FCONDGP19,t1.CODRESUL_CON_DGP_19 CODRESULCONDGP19,t1.RESUL_CON_DGP_19 RESULCONDGP19,t1.FINVOKE_CON_DGP_19 FINVOKECONDGP19,t1.IDTRA_CON_DGP_19 IDTRACONDGP19,t1.F_CON_PADRON_19 FCONPADRON19,t1.CODRESUL_CON_PADRON_19 CODRESULCONPADRON19,t1.RESUL_CON_PADRON_19 RESULCONPADRON19,t1.FINVOKE_CON_PADRON_19 FINVOKECONPADRON19,t1.IDTRA_CON_PADRON_19 IDTRACONPADRON19,t1.F_CON_IRPF_19 FCONIRPF19,t1.CODRESUL_CON_IRPF_19 CODRESULCONIRPF19,t1.RESUL_CON_IRPF_19 RESULCONIRPF19,t1.FINVOKE_CON_IRPF_19 FINVOKECONIRPF19,t1.IDTRA_CON_IRPF_19 IDTRACONIRPF19,t1.F_CON_IMSERSO_19 FCONIMSERSO19,t1.CODRESUL_CON_IMSERSO_19 CODRESULCONIMSERSO19,t1.RESUL_CON_IMSERSO_19 RESULCONIMSERSO19,t1.FINVOKE_CON_IMSERSO_19 FINVOKECONIMSERSO19,t1.IDTRA_CON_IMSERSO_19 IDTRACONIMSERSO19, t1.F_CON_CONYU_IRPF_19 FCONCONYUIRPF19, t1.CODRESUL_CON_CONYU_IRPF_19 CODRESULCONCONYUIRPF19, t1.RESUL_CON_CONYU_IRPF_19 RESULCONCONYUIRPF19, t1.FINVOKE_CON_CONYU_IRPF_19 FINVOKECONCONYUIRPF19, t1.IDTRA_CON_CONYU_IRPF_19 IDTRACONCONYUIRPF19, t1.F_CON_DISCAPA_19 FCONDISCAPA19, t1.CODRESUL_DISCAPA_19 CODRESULDISCAPA19, t1.RESUL_DISCAPA_19 RESULDISCAPA19, t1.FINVOKE_DISCAPA_19 FINVOKEDISCAPA19, t1.IDTRA_DISCAPA_19 IDTRADISCAPA19  ");
		query.append("FROM DATOS_INTEROP t1 ");

		// Where clause & Params
		Map<String, ?> mapaWhere = this.getWhereLikeMap(datosinterop, startsWith);
		StringBuilder where = new StringBuilder(" WHERE 1=1 ");
		where.append(mapaWhere.get("query"));
		query.append(where);

		List<?> params = (List<?>) mapaWhere.get("params");

		if (tableRequestDto != null) {
			query = TableManager.getPaginationQuery(tableRequestDto, query, DatosInteropDaoImpl.ORDER_BY_WHITE_LIST);
		}

		return (List<DatosInterop>) this.jdbcTemplate.query(query.toString(), this.rwMap, params.toArray());
	}

	/*
	 * OPERACIONES RUP_TABLE
	 */

	/**
	 * Counts rows in the DatosInterop table.
	 *
	 * @param datosinterop DatosInterop
	 * @return Long
	 */
	@Transactional(readOnly = true)
	public Long findAllCount(DatosInterop datosinterop) {
		StringBuilder query = new StringBuilder("SELECT COUNT(1) FROM DATOS_INTEROP t1 ");

		// Where clause & Params
		Map<String, ?> mapaWhere = this.getWhereMap(datosinterop);
		StringBuilder where = new StringBuilder(" WHERE 1=1 ");
		where.append(mapaWhere.get("query"));
		query.append(where);

		List<?> params = (List<?>) mapaWhere.get("params");

		return this.jdbcTemplate.queryForObject(query.toString(), params.toArray(), Long.class);
	}

	/**
	 * Counts rows in the DatosInterop table using like.
	 *
	 * @param datosinterop DatosInterop
	 * @param startsWith   Boolean
	 * @return Long
	 */
	@Transactional(readOnly = true)
	public Long findAllLikeCount(DatosInterop datosinterop, Boolean startsWith) {
		StringBuilder query = new StringBuilder("SELECT COUNT(1) FROM DATOS_INTEROP t1 ");

		// Where clause & Params
		Map<String, ?> mapaWhere = this.getWhereLikeMap(datosinterop, startsWith);
		StringBuilder where = new StringBuilder(" WHERE 1=1 ");
		where.append(mapaWhere.get("query"));
		query.append(where);

		List<?> params = (List<?>) mapaWhere.get("params");

		return this.jdbcTemplate.queryForObject(query.toString(), params.toArray(), Long.class);
	}

	/**
	 * Reorder the data list of DatosInterop selected for rup_table
	 *
	 * @param datosinterop    DatosInterop
	 * @param tableRequestDto TableRequestDto
	 * @param startsWith      Boolean
	 * @return List<TableRowDto<DatosInterop>>
	 */
	@Override
	public List<TableRowDto<DatosInterop>> reorderSelection(DatosInterop datosinterop, TableRequestDto tableRequestDto,
			Boolean startsWith) {
		// SELECT
		StringBuilder query = new StringBuilder(
				"SELECT t1.ID_INTEROP_19 IDINTEROP19,t1.ID_EXPEDIENTE_19 IDEXPEDIENTE19,t1.F_CON_DGP_19 FCONDGP19,t1.CODRESUL_CON_DGP_19 CODRESULCONDGP19,t1.RESUL_CON_DGP_19 RESULCONDGP19,t1.FINVOKE_CON_DGP_19 FINVOKECONDGP19,t1.IDTRA_CON_DGP_19 IDTRACONDGP19,t1.F_CON_PADRON_19 FCONPADRON19,t1.CODRESUL_CON_PADRON_19 CODRESULCONPADRON19,t1.RESUL_CON_PADRON_19 RESULCONPADRON19,t1.FINVOKE_CON_PADRON_19 FINVOKECONPADRON19,t1.IDTRA_CON_PADRON_19 IDTRACONPADRON19,t1.F_CON_IRPF_19 FCONIRPF19,t1.CODRESUL_CON_IRPF_19 CODRESULCONIRPF19,t1.RESUL_CON_IRPF_19 RESULCONIRPF19,t1.FINVOKE_CON_IRPF_19 FINVOKECONIRPF19,t1.IDTRA_CON_IRPF_19 IDTRACONIRPF19,t1.F_CON_IMSERSO_19 FCONIMSERSO19,t1.CODRESUL_CON_IMSERSO_19 CODRESULCONIMSERSO19,t1.RESUL_CON_IMSERSO_19 RESULCONIMSERSO19,t1.FINVOKE_CON_IMSERSO_19 FINVOKECONIMSERSO19,t1.IDTRA_CON_IMSERSO_19 IDTRACONIMSERSO19, t1.F_CON_CONYU_IRPF_19 FCONCONYUIRPF19, t1.CODRESUL_CON_CONYU_IRPF_19 CODRESULCONCONYUIRPF19, t1.RESUL_CON_CONYU_IRPF_19 RESULCONCONYUIRPF19, t1.FINVOKE_CON_CONYU_IRPF_19 FINVOKECONCONYUIRPF19, t1.IDTRA_CON_CONYU_IRPF_19 IDTRACONCONYUIRPF19, t1.F_CON_DISCAPA_19 FCONDISCAPA19, t1.CODRESUL_DISCAPA_19 CODRESULDISCAPA19, t1.RESUL_DISCAPA_19 RESULDISCAPA19, t1.FINVOKE_DISCAPA_19 FINVOKEDISCAPA19, t1.IDTRA_DISCAPA_19 IDTRADISCAPA19 ");
		// FROM
		query.append("FROM DATOS_INTEROP t1 ");
		// FILTRADO
		// Where clause & Params
		Map<String, ?> mapaWhere = this.getWhereLikeMap(datosinterop, startsWith);
		StringBuilder where = new StringBuilder(" WHERE 1=1 ");
		where.append(mapaWhere.get("query"));
		query.append(where);

		// Parámetros de filtrado
		@SuppressWarnings("unchecked")
		List<Object> filterParamList = (List<Object>) mapaWhere.get("params");

		// SQL para la reordenación
		StringBuilder sbReorderSelectionSQL = TableManager.getReorderQuery(query, tableRequestDto, DatosInterop.class,
				filterParamList, "IDINTEROP19");

		return this.jdbcTemplate.query(sbReorderSelectionSQL.toString(),
				new RowNumResultSetExtractor<DatosInterop>(this.rwMapPK, tableRequestDto), filterParamList.toArray());
	}

	/**
	 * Search method for rup_table
	 *
	 * @param filterParams    DatosInterop
	 * @param searchParams    DatosInterop
	 * @param tableRequestDto TableRequestDto
	 * @param startsWith      Boolean
	 * @return List<TableRowDto<DatosInterop>>
	 */
	@Override
	public List<TableRowDto<DatosInterop>> search(DatosInterop filterParams, DatosInterop searchParams,
			TableRequestDto tableRequestDto, Boolean startsWith) {
		// SELECT
		StringBuilder query = new StringBuilder(
				"SELECT t1.ID_INTEROP_19 IDINTEROP19,t1.ID_EXPEDIENTE_19 IDEXPEDIENTE19,t1.F_CON_DGP_19 FCONDGP19,t1.CODRESUL_CON_DGP_19 CODRESULCONDGP19,t1.RESUL_CON_DGP_19 RESULCONDGP19,t1.FINVOKE_CON_DGP_19 FINVOKECONDGP19,t1.IDTRA_CON_DGP_19 IDTRACONDGP19,t1.F_CON_PADRON_19 FCONPADRON19,t1.CODRESUL_CON_PADRON_19 CODRESULCONPADRON19,t1.RESUL_CON_PADRON_19 RESULCONPADRON19,t1.FINVOKE_CON_PADRON_19 FINVOKECONPADRON19,t1.IDTRA_CON_PADRON_19 IDTRACONPADRON19,t1.F_CON_IRPF_19 FCONIRPF19,t1.CODRESUL_CON_IRPF_19 CODRESULCONIRPF19,t1.RESUL_CON_IRPF_19 RESULCONIRPF19,t1.FINVOKE_CON_IRPF_19 FINVOKECONIRPF19,t1.IDTRA_CON_IRPF_19 IDTRACONIRPF19,t1.F_CON_IMSERSO_19 FCONIMSERSO19,t1.CODRESUL_CON_IMSERSO_19 CODRESULCONIMSERSO19,t1.RESUL_CON_IMSERSO_19 RESULCONIMSERSO19,t1.FINVOKE_CON_IMSERSO_19 FINVOKECONIMSERSO19,t1.IDTRA_CON_IMSERSO_19 IDTRACONIMSERSO19, t1.F_CON_CONYU_IRPF_19 FCONCONYUIRPF19, t1.CODRESUL_CON_CONYU_IRPF_19 CODRESULCONCONYUIRPF19, t1.RESUL_CON_CONYU_IRPF_19 RESULCONCONYUIRPF19, t1.FINVOKE_CON_CONYU_IRPF_19 FINVOKECONCONYUIRPF19, t1.IDTRA_CON_CONYU_IRPF_19 IDTRACONCONYUIRPF19 ");
		// FROM
		query.append("FROM DATOS_INTEROP t1 ");
		// TABLAS_ALIAS
		List<String> from_alias = new ArrayList<String>();
		from_alias.add(" t1 ");

		// FILTRADO
		Map<String, ?> mapaWhereFilter = this.getWhereLikeMap(filterParams, startsWith);
		StringBuilder where = new StringBuilder(" WHERE 1=1 ");
		where.append(mapaWhereFilter.get("query"));
		query.append(where);
		// Filter params
		@SuppressWarnings("unchecked")
		List<Object> filterParamList = (List<Object>) mapaWhereFilter.get("params");

		// BUSQUEDA
		Map<String, Object> mapaWhereSearch = this.getWhereLikeMap(searchParams, startsWith);
		String searchSQL = ((StringBuilder) mapaWhereSearch.get("query")).toString();
		// Search params
		@SuppressWarnings("unchecked")
		List<Object> searchParamList = (List<Object>) mapaWhereSearch.get("params");

		// SQL
		StringBuilder sbReorderSelectionSQL = TableManager.getSearchQuery(query, tableRequestDto, DatosInterop.class,
				filterParamList, searchSQL, searchParamList, from_alias, "IDINTEROP19");

		return this.jdbcTemplate.query(sbReorderSelectionSQL.toString(),
				new RowNumResultSetExtractor<DatosInterop>(this.rwMapPK, tableRequestDto), filterParamList.toArray());
	}

	/**
	 * Remove multiple method for rup_table
	 *
	 * @param tableRequestDto TableRequestDto
	 */
	@Override
	public void removeMultiple(TableRequestDto tableRequestDto) {
		StringBuilder sbRemoveMultipleSQL = TableManager.getRemoveMultipleQuery(tableRequestDto, DatosInterop.class,
				"DATOS_INTEROP", new String[] { "IDINTEROP19" });

		List<String> params = tableRequestDto.getMultiselection().getSelectedIds();

		this.jdbcTemplate.update(sbRemoveMultipleSQL.toString(), params.toArray());
	}

	/**
	 * Filter in the hierarchical DatosInterop table.
	 *
	 * @param filterDatosInterop DatosInterop
	 * @param tableRequestDto    TableRequestDto
	 * @return List<JerarquiaDto<DatosInterop>>
	 */
	@Override
	public List<JerarquiaDto<DatosInterop>> findAllLikeJerarquia(DatosInterop filterDatosInterop,
			TableRequestDto tableRequestDto) {
		// SELECT
		StringBuilder query = new StringBuilder(
				"SELECT t1.ID_INTEROP_19 IDINTEROP19,t1.ID_EXPEDIENTE_19 IDEXPEDIENTE19,t1.F_CON_DGP_19 FCONDGP19,t1.CODRESUL_CON_DGP_19 CODRESULCONDGP19,t1.RESUL_CON_DGP_19 RESULCONDGP19,t1.FINVOKE_CON_DGP_19 FINVOKECONDGP19,t1.IDTRA_CON_DGP_19 IDTRACONDGP19,t1.F_CON_PADRON_19 FCONPADRON19,t1.CODRESUL_CON_PADRON_19 CODRESULCONPADRON19,t1.RESUL_CON_PADRON_19 RESULCONPADRON19,t1.FINVOKE_CON_PADRON_19 FINVOKECONPADRON19,t1.IDTRA_CON_PADRON_19 IDTRACONPADRON19,t1.F_CON_IRPF_19 FCONIRPF19,t1.CODRESUL_CON_IRPF_19 CODRESULCONIRPF19,t1.RESUL_CON_IRPF_19 RESULCONIRPF19,t1.FINVOKE_CON_IRPF_19 FINVOKECONIRPF19,t1.IDTRA_CON_IRPF_19 IDTRACONIRPF19,t1.F_CON_IMSERSO_19 FCONIMSERSO19,t1.CODRESUL_CON_IMSERSO_19 CODRESULCONIMSERSO19,t1.RESUL_CON_IMSERSO_19 RESULCONIMSERSO19,t1.FINVOKE_CON_IMSERSO_19 FINVOKECONIMSERSO19,t1.IDTRA_CON_IMSERSO_19 IDTRACONIMSERSO19, t1.F_CON_CONYU_IRPF_19 FCONCONYUIRPF19, t1.CODRESUL_CON_CONYU_IRPF_19 CODRESULCONCONYUIRPF19, t1.RESUL_CON_CONYU_IRPF_19 RESULCONCONYUIRPF19, t1.FINVOKE_CON_CONYU_IRPF_19 FINVOKECONCONYUIRPF19, t1.IDTRA_CON_CONYU_IRPF_19 IDTRACONCONYUIRPF19 ");
		// FROM
		// StringBuilder from = new StringBuilder("FROM DATOS_INTEROP t1 ");
		List<String> from = new ArrayList<String>();
		from.add("DATOS_INTEROP");
		// TABLAS_ALIAS
		List<String> from_alias = new ArrayList<String>();
		from_alias.add(" t1 ");

		// JOINS TABLAS
		/*
		 * Ejemplo de como indicar joins entre las tablas de la query
		 */
		/*
		 * StringBuilder joins = new StringBuilder("");
		 * joins.append("AND T1.ID=T2.ID_T1");
		 */

		// CONDICIONES (negocio)
		/*
		 * Ejemplo de como incluir condiciones de negocio en la consulta de la
		 * jerarquía
		 */
		/*
		 * StringBuilder businessFilters = new StringBuilder(); List<Object>
		 * businessParams = new ArrayList<Object>();
		 * businessFilters.append("   AND t1.EJIE = ?  "); businessParams.add("1");
		 */

		// FILTRO
		Map<String, ?> mapaWhere = this.getWhereLikeMap(filterDatosInterop, false);

		// JERARQUIA
		// Especificar la columna padre correspondiente en lugar de la generada
		// por
		// defecto (ID_PADRE)
		query = TableManagerJerarquia.getQuery(tableRequestDto, query, mapaWhere, "IDINTEROP19", "ID_PADRE", "NOMBRE",
				from, from_alias);

		/*
		 * Ejemplo de llamada en caso de indicar joins entre tablas y condiciones de
		 * negocio
		 */
		// query = TableManagerJerarquia.getQuery(tableRequestDto, query,
		// mapaWhere, "ID",
		// "ID_PADRE", "NOMBRE", from, from_alias, joins, businessFilters,
		// businessParams);

		// PAGINACION
		if (tableRequestDto != null) {
			query = TableManagerJerarquia.getPaginationQuery(tableRequestDto, query,
					DatosInteropDaoImpl.ORDER_BY_WHITE_LIST);
		}

		List<?> params = (List<?>) mapaWhere.get("params");
		return this.jdbcTemplate.query(query.toString(), this.rwMapJerarquia, params.toArray());
	}

	/**
	 * Count rows in hierarchy
	 *
	 * @param filterDatosInterop DatosInterop
	 * @param tableRequestDto    TableRequestDto
	 * @return Long
	 */
	@Override
	public Long findAllLikeCountJerarquia(DatosInterop filterDatosInterop, TableRequestDto tableRequestDto) {
		// FROM
		// StringBuilder from = new StringBuilder("FROM DATOS_INTEROP t1 ");
		List<String> from = new ArrayList<String>();
		from.add("DATOS_INTEROP");

		// TABLAS_ALIAS
		List<String> from_alias = new ArrayList<String>();
		from_alias.add(" t1 ");

		// JOINS TABLAS
		/*
		 * Ejemplo de como indicar joins entre las tablas de la query
		 */
		/*
		 * StringBuilder joins = new StringBuilder("");
		 * joins.append("AND T1.ID=T2.ID_T1");
		 */

		// CONDICIONES (negocio)
		/*
		 * Ejemplo de como incluir condiciones de negocio en la consulta de la
		 * jerarquía
		 */
		/*
		 * StringBuilder businessFilters = new StringBuilder(); List<Object>
		 * businessParams = new ArrayList<Object>();
		 * businessFilters.append("   AND t1.EJIE = ?  "); businessParams.add("1");
		 */

		// FILTRO
		Map<String, ?> mapaWhere = this.getWhereLikeMap(filterDatosInterop, false);

		// JERARQUIA
		// Especificar la columna padre correspondiente en lugar de la generada
		// por
		// defecto (ID_PADRE)
		StringBuilder query = TableManagerJerarquia.getQueryCount(tableRequestDto, mapaWhere, "IDINTEROP19", "ID_PADRE",
				from, from_alias);

		/*
		 * Ejemplo de llamada en caso de indicar joins entre tablas y condiciones de
		 * negocio
		 */
		// StringBuilder query =
		// TableManagerJerarquia.getQueryCount(tableRequestDto, mapaWhere,
		// "ID", "ID_PADRE", from, from_alias, joins, businessFilters,
		// businessParams);

		List<?> params = (List<?>) mapaWhere.get("params");
		return this.jdbcTemplate.queryForObject(query.toString(), params.toArray(), Long.class);
	}

	/**
	 * Find dependent hierarchical rows
	 *
	 * @param filterDatosInterop DatosInterop
	 * @param tableRequestDto    TableRequestDto
	 * @return List<TableRowDto<DatosInterop>>
	 */
	@Override
	public List<TableRowDto<DatosInterop>> findAllChild(DatosInterop filterDatosInterop,
			TableRequestDto tableRequestDto) {

		// FROM
		// StringBuilder from = new StringBuilder("FROM DATOS_INTEROP t1 ");
		List<String> from = new ArrayList<String>();
		from.add("DATOS_INTEROP");

		// TABLAS_ALIAS
		List<String> from_alias = new ArrayList<String>();
		from_alias.add(" t1 ");

		// JOINS TABLAS
		/*
		 * Ejemplo de como indicar joins entre las tablas de la query
		 */
		/*
		 * StringBuilder joins = new StringBuilder("");
		 * joins.append("AND T1.ID=T2.ID_T1");
		 */

		// CONDICIONES (negocio)
		/*
		 * Ejemplo de como incluir condiciones de negocio en la consulta de la
		 * jerarquía
		 */
		/*
		 * StringBuilder businessFilters = new StringBuilder(); List<Object>
		 * businessParams = new ArrayList<Object>();
		 * businessFilters.append("   AND t1.EJIE = ?  "); businessParams.add("1");
		 */

		// FILTRO
		Map<String, ?> mapaWhere = this.getWhereLikeMap(filterDatosInterop, false);

		// MULTISELECCION
		// Especificar la columna padre correspondiente en lugar de la generada
		// por
		// defecto (ID_PADRE)
		StringBuilder query = TableManagerJerarquia.getQueryChildren(tableRequestDto, mapaWhere, "IDINTEROP19",
				"ID_PADRE", from, from_alias);

		/*
		 * Ejemplo de llamada en caso de indicar joins entre tablas y condiciones de
		 * negocio
		 */
		// StringBuilder query =
		// TableManagerJerarquia.getQueryChildren(tableRequestDto, mapaWhere,
		// "ID", "ID_PADRE", from, from_alias, joins, businessFilters,
		// businessParams);

		List<?> params = (List<?>) mapaWhere.get("params");

		return this.jdbcTemplate.query(query.toString(),
				new RowNumResultSetExtractor<DatosInterop>(this.rwMapPK, "IDINTEROP19"), params.toArray());
	}

	/*
	 * MÉTODOS PRIVADOS
	 */

	/**
	 * Returns a map with the needed value to create the conditions to filter by the
	 * DatosInterop entity
	 *
	 * @param datosinterop DatosInterop Bean with the criteria values to filter by.
	 * @return Map created with two keys key query stores the sql query syntax key
	 *         params stores the parameter values to be used in the condition
	 *         sentence.
	 */
	// CHECKSTYLE:OFF CyclomaticComplexity - Generación de código de UDA
	private Map<String, ?> getWhereMap(DatosInterop datosinterop) {

		StringBuilder where = new StringBuilder(DatosInteropDaoImpl.STRING_BUILDER_INIT);
		List<Object> params = new ArrayList<Object>();

		if (datosinterop != null && datosinterop.getIdInterop19() != null) {
			where.append(" AND t1.ID_INTEROP_19 = ?");
			params.add(datosinterop.getIdInterop19());
		}
		if (datosinterop != null && datosinterop.getIdExpediente19() != null) {
			where.append(" AND t1.ID_EXPEDIENTE_19 = ?");
			params.add(datosinterop.getIdExpediente19());
		}
		if (datosinterop != null && datosinterop.getfConDgp19() != null) {
			where.append(" AND t1.F_CON_DGP_19 = ?");
			params.add(datosinterop.getfConDgp19());
		}
		if (datosinterop != null && datosinterop.getCodresulConDgp19() != null) {
			where.append(" AND t1.CODRESUL_CON_DGP_19 = ?");
			params.add(datosinterop.getCodresulConDgp19());
		}
		if (datosinterop != null && datosinterop.getResulConDgp19() != null) {
			where.append(" AND t1.RESUL_CON_DGP_19 = ?");
			params.add(datosinterop.getResulConDgp19());
		}
		if (datosinterop != null && datosinterop.getfinvokeConDgp19() != null) {
			where.append(" AND t1.FINVOKE_CON_DGP_19 = ?");
			params.add(datosinterop.getfinvokeConDgp19());
		}
		if (datosinterop != null && datosinterop.getIdtraConDgp19() != null) {
			where.append(" AND t1.IDTRA_CON_DGP_19 = ?");
			params.add(datosinterop.getIdtraConDgp19());
		}
		if (datosinterop != null && datosinterop.getfConPadron19() != null) {
			where.append(" AND t1.F_CON_PADRON_19 = ?");
			params.add(datosinterop.getfConPadron19());
		}
		if (datosinterop != null && datosinterop.getCodresulConPadron19() != null) {
			where.append(" AND t1.CODRESUL_CON_PADRON_19 = ?");
			params.add(datosinterop.getCodresulConPadron19());
		}
		if (datosinterop != null && datosinterop.getResulConPadron19() != null) {
			where.append(" AND t1.RESUL_CON_PADRON_19 = ?");
			params.add(datosinterop.getResulConPadron19());
		}
		if (datosinterop != null && datosinterop.getfinvokeConPadron19() != null) {
			where.append(" AND t1.FINVOKE_CON_PADRON_19 = ?");
			params.add(datosinterop.getfinvokeConPadron19());
		}
		if (datosinterop != null && datosinterop.getIdtraConPadron19() != null) {
			where.append(" AND t1.IDTRA_CON_PADRON_19 = ?");
			params.add(datosinterop.getIdtraConPadron19());
		}
		if (datosinterop != null && datosinterop.getfConIrpf19() != null) {
			where.append(" AND t1.F_CON_IRPF_19 = ?");
			params.add(datosinterop.getfConIrpf19());
		}
		if (datosinterop != null && datosinterop.getCodresulConIrpf19() != null) {
			where.append(" AND t1.CODRESUL_CON_IRPF_19 = ?");
			params.add(datosinterop.getCodresulConIrpf19());
		}
		if (datosinterop != null && datosinterop.getResulConIrpf19() != null) {
			where.append(" AND t1.RESUL_CON_IRPF_19 = ?");
			params.add(datosinterop.getResulConIrpf19());
		}
		if (datosinterop != null && datosinterop.getfinvokeConIrpf19() != null) {
			where.append(" AND t1.FINVOKE_CON_IRPF_19 = ?");
			params.add(datosinterop.getfinvokeConIrpf19());
		}
		if (datosinterop != null && datosinterop.getIdtraConIrpf19() != null) {
			where.append(" AND t1.IDTRA_CON_IRPF_19 = ?");
			params.add(datosinterop.getIdtraConIrpf19());
		}
		if (datosinterop != null && datosinterop.getfConImserso19() != null) {
			where.append(" AND t1.F_CON_IMSERSO_19 = ?");
			params.add(datosinterop.getfConImserso19());
		}
		if (datosinterop != null && datosinterop.getCodresulConImserso19() != null) {
			where.append(" AND t1.CODRESUL_CON_IMSERSO_19 = ?");
			params.add(datosinterop.getCodresulConImserso19());
		}
		if (datosinterop != null && datosinterop.getResulConImserso19() != null) {
			where.append(" AND t1.RESUL_CON_IMSERSO_19 = ?");
			params.add(datosinterop.getResulConImserso19());
		}
		if (datosinterop != null && datosinterop.getfinvokeConImserso19() != null) {
			where.append(" AND t1.FINVOKE_CON_IMSERSO_19 = ?");
			params.add(datosinterop.getfinvokeConImserso19());
		}
		if (datosinterop != null && datosinterop.getIdtraConImserso19() != null) {
			where.append(" AND t1.IDTRA_CON_IMSERSO_19 = ?");
			params.add(datosinterop.getIdtraConImserso19());
		}
		if (datosinterop != null && datosinterop.getfConConyuIrpf19() != null) {
			where.append(" AND t1.F_CON_CONYU_IRPF_19 = ?");
			params.add(datosinterop.getfConConyuIrpf19());
		}
		if (datosinterop != null && datosinterop.getCodresulConConyuIrpf19() != null) {
			where.append(" AND t1.CODRESUL_CON_CONYU_IRPF_19 = ?");
			params.add(datosinterop.getCodresulConConyuIrpf19());
		}
		if (datosinterop != null && datosinterop.getResulConConyuIrpf19() != null) {
			where.append(" AND t1.RESUL_CON_CONYU_IRPF_19 = ?");
			params.add(datosinterop.getResulConConyuIrpf19());
		}
		if (datosinterop != null && datosinterop.getfinvokeConConyuIrpf19() != null) {
			where.append(" AND t1.FINVOKE_CON_CONYU_IRPF_19 = ?");
			params.add(datosinterop.getfinvokeConConyuIrpf19());
		}
		if (datosinterop != null && datosinterop.getIdtraConConyuIrpf19() != null) {
			where.append(" AND t1.IDTRA_CON_CONYU_IRPF_19 = ?");
			params.add(datosinterop.getIdtraConConyuIrpf19());
		}

		if (datosinterop != null && datosinterop.getfConDiscapa19() != null) {
			where.append(" AND t1.F_CON_DISCAPA_19 = ?");
			params.add(datosinterop.getfConDiscapa19());
		}
		if (datosinterop != null && datosinterop.getCodresulDiscapa19() != null) {
			where.append(" AND t1.CODRESUL_DISCAPA_19 = ?");
			params.add(datosinterop.getCodresulDiscapa19());
		}
		if (datosinterop != null && datosinterop.getResulDiscapa19() != null) {
			where.append(" AND t1.RESUL_DISCAPA_19 = ?");
			params.add(datosinterop.getResulDiscapa19());
		}
		if (datosinterop != null && datosinterop.getFinvokeDiscapa19() != null) {
			where.append(" AND t1.FINVOKE_DISCAPA_19 = ?");
			params.add(datosinterop.getFinvokeDiscapa19());
		}
		if (datosinterop != null && datosinterop.getIdtraDiscapa19() != null) {
			where.append(" AND t1.IDTRA_DISCAPA_19 = ?");
			params.add(datosinterop.getIdtraDiscapa19());
		}

		Map<String, Object> mapWhere = new HashMap<String, Object>();
		mapWhere.put("query", where);
		mapWhere.put("params", params);

		return mapWhere;
	}
	// CHECKSTYLE:ON CyclomaticComplexity - Generación de código de UDA

	/**
	 * Returns a map with the needed value to create the conditions to filter by the
	 * DatosInterop entity
	 *
	 * @param datosinterop DatosInterop Bean with the criteria values to filter by.
	 * @param startsWith   Boolean
	 * @return Map created with two keys key query stores the sql query syntax key
	 *         params stores the parameter values to be used in the condition
	 *         sentence.
	 */
	// CHECKSTYLE:OFF CyclomaticComplexity - Generación de código de UDA
	private Map<String, Object> getWhereLikeMap(DatosInterop datosinterop, Boolean startsWith) {

		StringBuilder where = new StringBuilder(DatosInteropDaoImpl.STRING_BUILDER_INIT);
		List<Object> params = new ArrayList<Object>();

		if (datosinterop != null && datosinterop.getIdInterop19() != null) {
			where.append(" AND t1.ID_INTEROP_19 = ?");
			params.add(datosinterop.getIdInterop19());
		}
		if (datosinterop != null && datosinterop.getIdExpediente19() != null) {
			where.append(" AND t1.ID_EXPEDIENTE_19 = ?");
			params.add(datosinterop.getIdExpediente19());
		}
		if (datosinterop != null && datosinterop.getfConDgp19() != null) {
			where.append(" AND t1.F_CON_DGP_19 = ?");
			params.add(datosinterop.getfConDgp19());
		}
		if (datosinterop != null && datosinterop.getCodresulConDgp19() != null) {
			where.append(" AND UPPER(t1.CODRESUL_CON_DGP_19) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(datosinterop.getCodresulConDgp19().toUpperCase() + "%");
			} else {
				params.add("%" + datosinterop.getCodresulConDgp19().toUpperCase() + "%");
			}
			where.append(" AND t1.CODRESUL_CON_DGP_19 IS NOT NULL");
		}
		if (datosinterop != null && datosinterop.getResulConDgp19() != null) {
			where.append(" AND UPPER(t1.RESUL_CON_DGP_19) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(datosinterop.getResulConDgp19().toUpperCase() + "%");
			} else {
				params.add("%" + datosinterop.getResulConDgp19().toUpperCase() + "%");
			}
			where.append(" AND t1.RESUL_CON_DGP_19 IS NOT NULL");
		}
		if (datosinterop != null && datosinterop.getfinvokeConDgp19() != null) {
			where.append(" AND t1.FINVOKE_CON_DGP_19 = ?");
			params.add(datosinterop.getfinvokeConDgp19());
		}
		if (datosinterop != null && datosinterop.getIdtraConDgp19() != null) {
			where.append(" AND UPPER(t1.IDTRA_CON_DGP_19) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(datosinterop.getIdtraConDgp19().toUpperCase() + "%");
			} else {
				params.add("%" + datosinterop.getIdtraConDgp19().toUpperCase() + "%");
			}
			where.append(" AND t1.IDTRA_CON_DGP_19 IS NOT NULL");
		}
		if (datosinterop != null && datosinterop.getfConPadron19() != null) {
			where.append(" AND t1.F_CON_PADRON_19 = ?");
			params.add(datosinterop.getfConPadron19());
		}
		if (datosinterop != null && datosinterop.getCodresulConPadron19() != null) {
			where.append(" AND UPPER(t1.CODRESUL_CON_PADRON_19) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(datosinterop.getCodresulConPadron19().toUpperCase() + "%");
			} else {
				params.add("%" + datosinterop.getCodresulConPadron19().toUpperCase() + "%");
			}
			where.append(" AND t1.CODRESUL_CON_PADRON_19 IS NOT NULL");
		}
		if (datosinterop != null && datosinterop.getResulConPadron19() != null) {
			where.append(" AND UPPER(t1.RESUL_CON_PADRON_19) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(datosinterop.getResulConPadron19().toUpperCase() + "%");
			} else {
				params.add("%" + datosinterop.getResulConPadron19().toUpperCase() + "%");
			}
			where.append(" AND t1.RESUL_CON_PADRON_19 IS NOT NULL");
		}
		if (datosinterop != null && datosinterop.getfinvokeConPadron19() != null) {
			where.append(" AND t1.FINVOKE_CON_PADRON_19 = ?");
			params.add(datosinterop.getfinvokeConPadron19());
		}
		if (datosinterop != null && datosinterop.getIdtraConPadron19() != null) {
			where.append(" AND UPPER(t1.IDTRA_CON_PADRON_19) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(datosinterop.getIdtraConPadron19().toUpperCase() + "%");
			} else {
				params.add("%" + datosinterop.getIdtraConPadron19().toUpperCase() + "%");
			}
			where.append(" AND t1.IDTRA_CON_PADRON_19 IS NOT NULL");
		}
		if (datosinterop != null && datosinterop.getfConIrpf19() != null) {
			where.append(" AND t1.F_CON_IRPF_19 = ?");
			params.add(datosinterop.getfConIrpf19());
		}
		if (datosinterop != null && datosinterop.getCodresulConIrpf19() != null) {
			where.append(" AND UPPER(t1.CODRESUL_CON_IRPF_19) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(datosinterop.getCodresulConIrpf19().toUpperCase() + "%");
			} else {
				params.add("%" + datosinterop.getCodresulConIrpf19().toUpperCase() + "%");
			}
			where.append(" AND t1.CODRESUL_CON_IRPF_19 IS NOT NULL");
		}
		if (datosinterop != null && datosinterop.getResulConIrpf19() != null) {
			where.append(" AND UPPER(t1.RESUL_CON_IRPF_19) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(datosinterop.getResulConIrpf19().toUpperCase() + "%");
			} else {
				params.add("%" + datosinterop.getResulConIrpf19().toUpperCase() + "%");
			}
			where.append(" AND t1.RESUL_CON_IRPF_19 IS NOT NULL");
		}
		if (datosinterop != null && datosinterop.getfinvokeConIrpf19() != null) {
			where.append(" AND t1.FINVOKE_CON_IRPF_19 = ?");
			params.add(datosinterop.getfinvokeConIrpf19());
		}
		if (datosinterop != null && datosinterop.getIdtraConIrpf19() != null) {
			where.append(" AND UPPER(t1.IDTRA_CON_IRPF_19) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(datosinterop.getIdtraConIrpf19().toUpperCase() + "%");
			} else {
				params.add("%" + datosinterop.getIdtraConIrpf19().toUpperCase() + "%");
			}
			where.append(" AND t1.IDTRA_CON_IRPF_19 IS NOT NULL");
		}
		if (datosinterop != null && datosinterop.getfConImserso19() != null) {
			where.append(" AND t1.F_CON_IMSERSO_19 = ?");
			params.add(datosinterop.getfConImserso19());
		}
		if (datosinterop != null && datosinterop.getCodresulConImserso19() != null) {
			where.append(" AND UPPER(t1.CODRESUL_CON_IMSERSO_19) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(datosinterop.getCodresulConImserso19().toUpperCase() + "%");
			} else {
				params.add("%" + datosinterop.getCodresulConImserso19().toUpperCase() + "%");
			}
			where.append(" AND t1.CODRESUL_CON_IMSERSO_19 IS NOT NULL");
		}
		if (datosinterop != null && datosinterop.getResulConImserso19() != null) {
			where.append(" AND UPPER(t1.RESUL_CON_IMSERSO_19) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(datosinterop.getResulConImserso19().toUpperCase() + "%");
			} else {
				params.add("%" + datosinterop.getResulConImserso19().toUpperCase() + "%");
			}
			where.append(" AND t1.RESUL_CON_IMSERSO_19 IS NOT NULL");
		}
		if (datosinterop != null && datosinterop.getfinvokeConImserso19() != null) {
			where.append(" AND t1.FINVOKE_CON_IMSERSO_19 = ?");
			params.add(datosinterop.getfinvokeConImserso19());
		}
		if (datosinterop != null && datosinterop.getIdtraConImserso19() != null) {
			where.append(" AND UPPER(t1.IDTRA_CON_IMSERSO_19) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(datosinterop.getIdtraConImserso19().toUpperCase() + "%");
			} else {
				params.add("%" + datosinterop.getIdtraConImserso19().toUpperCase() + "%");
			}
			where.append(" AND t1.IDTRA_CON_IMSERSO_19 IS NOT NULL");
		}

		if (datosinterop != null && datosinterop.getfConConyuIrpf19() != null) {
			where.append(" AND t1.F_CON_CONYU_IRPF_19 = ?");
			params.add(datosinterop.getfConConyuIrpf19());
		}
		if (datosinterop != null && datosinterop.getCodresulConConyuIrpf19() != null) {
			where.append(" AND UPPER(t1.CODRESUL_CON_CONYU_IRPF_19) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(datosinterop.getCodresulConConyuIrpf19().toUpperCase() + "%");
			} else {
				params.add("%" + datosinterop.getCodresulConConyuIrpf19().toUpperCase() + "%");
			}
			where.append(" AND t1.CODRESUL_CON_CONYU_IRPF_19 IS NOT NULL");
		}
		if (datosinterop != null && datosinterop.getResulConConyuIrpf19() != null) {
			where.append(" AND UPPER(t1.RESUL_CON_CONYU_IRPF_19) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(datosinterop.getResulConConyuIrpf19().toUpperCase() + "%");
			} else {
				params.add("%" + datosinterop.getResulConConyuIrpf19().toUpperCase() + "%");
			}
			where.append(" AND t1.RESUL_CON_CONYU_IRPF_19 IS NOT NULL");
		}
		if (datosinterop != null && datosinterop.getfinvokeConConyuIrpf19() != null) {
			where.append(" AND t1.FINVOKE_CON_CONYU_IRPF_19 = ?");
			params.add(datosinterop.getfinvokeConConyuIrpf19());
		}
		if (datosinterop != null && datosinterop.getIdtraConConyuIrpf19() != null) {
			where.append(" AND UPPER(t1.IDTRA_CON_CONYU_IRPF_19) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(datosinterop.getIdtraConConyuIrpf19().toUpperCase() + "%");
			} else {
				params.add("%" + datosinterop.getIdtraConConyuIrpf19().toUpperCase() + "%");
			}
			where.append(" AND t1.IDTRA_CON_CONYU_IRPF_19 IS NOT NULL");
		}

		if (datosinterop != null && datosinterop.getfConDiscapa19() != null) {
			where.append(" AND t1.F_CON_DISCAPA_19 = ?");
			params.add(datosinterop.getfConDiscapa19());
		}
		if (datosinterop != null && datosinterop.getCodresulDiscapa19() != null) {
			where.append(" AND UPPER(t1.CODRESUL_DISCAPA_19) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(datosinterop.getCodresulDiscapa19().toUpperCase() + "%");
			} else {
				params.add("%" + datosinterop.getCodresulDiscapa19().toUpperCase() + "%");
			}
			where.append(" AND t1.CODRESUL_DISCAPA_19 IS NOT NULL");
		}
		if (datosinterop != null && datosinterop.getResulDiscapa19() != null) {
			where.append(" AND UPPER(t1.RESUL_DISCAPA_19) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(datosinterop.getResulDiscapa19().toUpperCase() + "%");
			} else {
				params.add("%" + datosinterop.getResulDiscapa19().toUpperCase() + "%");
			}
			where.append(" AND t1.RESUL_DISCAPA_19 IS NOT NULL");
		}
		if (datosinterop != null && datosinterop.getFinvokeDiscapa19() != null) {
			where.append(" AND t1.FINVOKE_DISCAPA_19 = ?");
			params.add(datosinterop.getFinvokeDiscapa19());
		}
		if (datosinterop != null && datosinterop.getIdtraDiscapa19() != null) {
			where.append(" AND UPPER(t1.IDTRA_DISCAPA_19) like ? ESCAPE  '\\'");
			if (startsWith) {
				params.add(datosinterop.getIdtraDiscapa19().toUpperCase() + "%");
			} else {
				params.add("%" + datosinterop.getIdtraDiscapa19().toUpperCase() + "%");
			}
			where.append(" AND t1.IDTRA_DISCAPA_19 IS NOT NULL");
		}

		Map<String, Object> mapWhere = new HashMap<String, Object>();
		mapWhere.put("query", where);
		mapWhere.put("params", params);

		return mapWhere;
	}
	// CHECKSTYLE:ON CyclomaticComplexity - Generación de código de UDA

	/**
	 * StringBuilder initilization value
	 */
	public static final int STRING_BUILDER_INIT = 4096;
}
