Añado los fuentes de java
This commit is contained in:
@@ -0,0 +1,210 @@
|
||||
/**
|
||||
* @(#) PersistenciattactmedGPC.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.TtactmedGPC;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.util.Utilidades;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>ttactmed</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaTtactmedGPC
|
||||
{
|
||||
|
||||
/**
|
||||
* 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 qué página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selecciona los registros de la tabla ttactmed en función de la sentencia SELECT indicada.
|
||||
* @param sqlSelect La sentencia SELECT de selección.
|
||||
* @param pagina Número de página a mostrar.
|
||||
* @param aCondiciones Array que contiene los parametros utilizados en la sentencia SELECT.
|
||||
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code>ttactmed</code>).
|
||||
* @throws
|
||||
*/
|
||||
public Vector seleccionar(String sqlSelect, int pagina, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
int elementosPaginacion=1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
TtactmedGPC ttactmed = null;
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect, aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
ttactmed = new TtactmedGPC();
|
||||
ttactmed.setDescripcion_gpc(rs.getString("DESCRIPCION"));
|
||||
ttactmed.setActo(rs.getInt("ACTO"));
|
||||
ttactmed.setOmc(rs.getInt("PRECIO"));
|
||||
vResultado.addElement(ttactmed);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TTACTMED_GPC (" + sqlSelect + ")");
|
||||
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTACTMED_GPC: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTACTMED_GPC: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTACTMED_GPC: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTACTMED_GPC: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public Vector listadoDeterminacionesAnaliticas(String strCampoNombre, int pagina) throws SQLException
|
||||
{
|
||||
Vector vResultado = new Vector();
|
||||
TtactmedGPC ttactmedGPC = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
int intPagina=1;
|
||||
Object aCondiciones[]=null;
|
||||
String consulta="";
|
||||
int elementosPaginacion=1;
|
||||
|
||||
strSql.append("SELECT *");
|
||||
strSql.append(" FROM TTACTMED_GPC");
|
||||
|
||||
//comprobamos si se trata de una busqueda de determinaciones analiticas
|
||||
if (!strCampoNombre.equalsIgnoreCase("")) //la sql tiene tres parametros
|
||||
{
|
||||
if (strCampoNombre.endsWith("*"))
|
||||
strCampoNombre=strCampoNombre.replace('*', '%');
|
||||
else
|
||||
strCampoNombre ="%" + strCampoNombre + "%";
|
||||
|
||||
//el array de objetos sera de tres elementos
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0] = strCampoNombre;
|
||||
|
||||
strSql.append(" WHERE TTACTMED_GPC.DESCRIPCION_GPC LIKE ?");
|
||||
}
|
||||
else //la sql solo tiene dos parametros
|
||||
aCondiciones = new Object[0];
|
||||
|
||||
strSql.append(" ORDER BY TTACTMED_GPC.DESCRIPCION_GPC");
|
||||
|
||||
try {
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
ttactmedGPC = new TtactmedGPC();
|
||||
ttactmedGPC.setDescripcion_gpc(rs.getString("DESCRIPCION_GPC"));
|
||||
ttactmedGPC.setActo(rs.getInt("ACTO"));
|
||||
ttactmedGPC.setOmc(rs.getInt("OMC"));
|
||||
vResultado.addElement(ttactmedGPC);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TTACTMED_GPC (" + strSql.toString() + ")");
|
||||
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de las determinaciones analiticas: " + e + " (" + strSql.toString() + ")");
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public Vector actosPorPeticion(long autorizacion) throws SQLException
|
||||
{
|
||||
Vector vResultado = new Vector();
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
TtactmedGPC ttactmed = null;
|
||||
|
||||
//strSql.append("select tapresca_tarisan.acto,descripcion_gpc ");
|
||||
strSql.append("select *");
|
||||
strSql.append(" from tapresca_tarisan, ttactmed_gpc ");
|
||||
strSql.append(" where tapresca_tarisan.acto=ttactmed_gpc.acto");
|
||||
strSql.append(" and autorizacion=?");
|
||||
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0] = autorizacion;
|
||||
|
||||
try {
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
ttactmed = new TtactmedGPC();
|
||||
ttactmed.setDescripcion_gpc(rs.getString("DESCRIPCION_GPC"));
|
||||
ttactmed.setActo(rs.getInt("ACTO"));
|
||||
ttactmed.setJustificacionInforme(rs.getString("TEXTO"));
|
||||
ttactmed.setJustificacionPrescripcion(rs.getString("JUSTIFICACION"));
|
||||
ttactmed.setJustifi_deter(rs.getString("JUSTIFY_DETER"));
|
||||
vResultado.addElement(ttactmed);
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TTACTMED_GPC (" + strSql.toString() + ")");
|
||||
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de las determinaciones analiticas: " + e + " (" + strSql.toString() + ")");
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user