104 lines
2.9 KiB
Java
104 lines
2.9 KiB
Java
/*
|
|
* Created on 24-nov-2005
|
|
*
|
|
* TODO To change the template for this generated file go to
|
|
* Window - Preferences - Java - Code Style - Code Templates
|
|
*/
|
|
package com.tarisan.control;
|
|
|
|
import java.sql.Connection;
|
|
import java.sql.ResultSet;
|
|
import java.sql.SQLException;
|
|
|
|
import com.tarisan.data.Taiguala;
|
|
import com.tarisan.excepcion.ExcepcionTarisan;
|
|
import com.tarisan.log.LogTarisan;
|
|
import com.tarisan.log.NivelLog;
|
|
|
|
|
|
/**
|
|
* @author Roumen
|
|
*
|
|
* TODO To change the template for this generated type comment go to
|
|
* Window - Preferences - Java - Code Style - Code Templates
|
|
*/
|
|
public class PersistenciaTaiguala {
|
|
|
|
|
|
/**
|
|
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
|
*/
|
|
private Paginacion objPaginacion = new Paginacion();
|
|
|
|
/**
|
|
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
|
* @return El objeto <code>Paginacion</code>
|
|
*/
|
|
public Paginacion getPaginacion()
|
|
{
|
|
return objPaginacion;
|
|
}
|
|
|
|
|
|
|
|
|
|
public int obtenerContrato(long colectivo, double poliza, int entidad) throws ExcepcionTarisan
|
|
{
|
|
|
|
int contrato = 0;
|
|
Taiguala taiguala;
|
|
StringBuffer strSql = new StringBuffer();
|
|
Object[] aCondiciones=null;
|
|
|
|
try
|
|
{
|
|
strSql.append("SELECT CONTRATO");
|
|
strSql.append(" FROM TTIGUALA");
|
|
strSql.append(" WHERE COLECTIVO=?");
|
|
strSql.append(" AND POLIZA=?");
|
|
strSql.append(" AND ENTIDAD=?");
|
|
|
|
aCondiciones = new Object[3];
|
|
aCondiciones[0] = Long.valueOf(colectivo);
|
|
aCondiciones[1] = Double.valueOf(poliza);
|
|
aCondiciones[2] = Integer.valueOf(entidad);
|
|
|
|
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
|
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
|
|
|
if(rs.next())
|
|
{
|
|
contrato = rs.getInt("CONTRATO");
|
|
}
|
|
|
|
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado " + rs.getRow() + " registros de la tabla TAIGUALA (" + strSql.toString() + ")");
|
|
rs.close();
|
|
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
|
}
|
|
catch (ExcepcionTarisan sqle)
|
|
{
|
|
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAIGUALA: " + sqle + " (" + strSql.toString() + ")");
|
|
throw (ExcepcionTarisan)sqle;
|
|
}
|
|
catch(SQLException sqle)
|
|
{
|
|
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAIGUALA: " + sqle + " (" + strSql.toString() + ")");
|
|
throw new ExcepcionTarisan(sqle.getMessage());
|
|
}
|
|
catch(Exception sqle)
|
|
{
|
|
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAIGUALA: " + sqle + " (" + strSql.toString() + ")");
|
|
throw new ExcepcionTarisan(sqle.getMessage());
|
|
}
|
|
catch(Throwable sqle)
|
|
{
|
|
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TACENTRO: " + sqle + " (" + strSql.toString() + ")");
|
|
throw new ExcepcionTarisan(sqle.getMessage());
|
|
}
|
|
|
|
|
|
return contrato;
|
|
}
|
|
|
|
}
|