diff --git a/dist/Programa Caja.jar b/dist/Programa Caja.jar index d9b72b1..915bb7e 100644 Binary files a/dist/Programa Caja.jar and b/dist/Programa Caja.jar differ diff --git a/src/danielcortes/xyz/models/caja/SQLiteCajaDAO.java b/src/danielcortes/xyz/models/caja/SQLiteCajaDAO.java index 669c76a..91d6af8 100644 --- a/src/danielcortes/xyz/models/caja/SQLiteCajaDAO.java +++ b/src/danielcortes/xyz/models/caja/SQLiteCajaDAO.java @@ -41,7 +41,7 @@ import org.apache.logging.log4j.Logger; * En especifico esta implementacion se comunica con la base de datos SQLite */ public class SQLiteCajaDAO implements CajaDAO { - private static final Logger LOGGER = LogManager.getLogger(SQLiteCajaDAO.class); + private static final Logger log = LogManager.getLogger(SQLiteCajaDAO.class); private SQLiteConnectionHolder connectionHolder; public SQLiteCajaDAO() { @@ -55,7 +55,7 @@ public class SQLiteCajaDAO implements CajaDAO { */ @Override public List getAll() { - LOGGER.info("Se intentara conseguir todas las Cajas"); + log.debug("Se intentara conseguir todas las Cajas"); List cajaList = new ArrayList<>(); try (Connection conn = connectionHolder.getConnection()) { String query = "select * from caja"; @@ -71,9 +71,9 @@ public class SQLiteCajaDAO implements CajaDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar obtener todas las Cajas", e); + log.error("Error al intentar obtener todas las Cajas", e); } - LOGGER.trace("Se encontraron " + cajaList.size() + " cajas"); + log.debug("Se encontraron " + cajaList.size() + " cajas"); return cajaList; } @@ -86,7 +86,7 @@ public class SQLiteCajaDAO implements CajaDAO { */ @Override public Optional getById(int id) { - LOGGER.info("Se intentara conseguir una Caja con el id " + id); + log.debug("Se intentara conseguir una Caja con el id " + id); Caja caja = null; String query = "select * from caja where id = ?"; try (Connection conn = connectionHolder.getConnection()) { @@ -102,9 +102,9 @@ public class SQLiteCajaDAO implements CajaDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar conseguir la caja con id " + id, e); + log.error("Error al intentar conseguir la caja con id " + id, e); } - LOGGER.trace("La caja que se consigio es " + caja); + log.debug("La caja que se consigio es " + caja); return Optional.ofNullable(caja); } @@ -116,7 +116,7 @@ public class SQLiteCajaDAO implements CajaDAO { */ @Override public Optional getByFecha(LocalDate fecha) { - LOGGER.info("Se intentara conseguir la caja con fecha " + fecha); + log.debug("Se intentara conseguir la caja con fecha " + fecha); Caja caja = null; String query = "select * from caja where fecha = ?"; try (Connection conn = connectionHolder.getConnection()) { @@ -132,9 +132,9 @@ public class SQLiteCajaDAO implements CajaDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar conseguir la caja con fecha " + fecha, e); + log.error("Error al intentar conseguir la caja con fecha " + fecha, e); } - LOGGER.trace("Se consiguio la caja " + caja); + log.debug("Se consiguio la caja " + caja); return Optional.ofNullable(caja); } @@ -144,7 +144,7 @@ public class SQLiteCajaDAO implements CajaDAO { */ @Override public void insert(Caja caja) { - LOGGER.info("Se intentara insertar la caja " + caja); + log.debug("Se intentara insertar la caja " + caja); String query = "insert into caja (fecha, fondo) values (?, ?)"; try (Connection conn = connectionHolder.getConnection()) { try (PreparedStatement ps = conn.prepareStatement(query)) { @@ -161,9 +161,9 @@ public class SQLiteCajaDAO implements CajaDAO { } } catch (SQLException e) { - LOGGER.error("Error al intentar insertar la caja " + caja, e); + log.error("Error al intentar insertar la caja " + caja, e); } - LOGGER.trace("Se inserto al caja " + caja); + log.debug("Se inserto al caja " + caja); } /** @@ -172,7 +172,7 @@ public class SQLiteCajaDAO implements CajaDAO { */ @Override public void update(Caja caja) { - LOGGER.info("Se intentara actualizar la caja " + caja); + log.debug("Se intentara actualizar la caja " + caja); String query = "update caja set fecha = ?, fondo = ? where id = ?"; try (Connection conn = connectionHolder.getConnection()) { try (PreparedStatement ps = conn.prepareStatement(query)) { @@ -182,8 +182,8 @@ public class SQLiteCajaDAO implements CajaDAO { ps.executeUpdate(); } } catch (SQLException e) { - LOGGER.error("Error al intentar actualizar la caja " + caja, e); + log.error("Error al intentar actualizar la caja " + caja, e); } - LOGGER.trace("Se actualizo la caja " + caja); + log.debug("Se actualizo la caja " + caja); } } diff --git a/src/danielcortes/xyz/models/calculo_fondo/SQLiteCalculoFondoDAO.java b/src/danielcortes/xyz/models/calculo_fondo/SQLiteCalculoFondoDAO.java index 8917fd3..7a5f26b 100644 --- a/src/danielcortes/xyz/models/calculo_fondo/SQLiteCalculoFondoDAO.java +++ b/src/danielcortes/xyz/models/calculo_fondo/SQLiteCalculoFondoDAO.java @@ -43,7 +43,7 @@ import org.apache.logging.log4j.Logger; * En especifico esta implementacion se comunica con la base de datos SQLite */ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO { - private static final Logger LOGGER = LogManager.getLogger(SQLiteCalculoFondoDAO.class); + private static final Logger log = LogManager.getLogger(SQLiteCalculoFondoDAO.class); private ConnectionHolder connectionHolder; public SQLiteCalculoFondoDAO() { @@ -57,7 +57,7 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO { */ @Override public List getAll() { - LOGGER.info("Se intentara conseguir todos los CalculosFondo"); + log.debug("Se intentara conseguir todos los CalculosFondo"); List calculoFondoList = new ArrayList<>(); String query = "select * from calculo_fondo"; try (Connection conn = connectionHolder.getConnection()) { @@ -78,9 +78,9 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar conseguir todos los CalculoFondo", e); + log.error("Error al intentar conseguir todos los CalculoFondo", e); } - LOGGER.trace("Se encontraron " + calculoFondoList.size() + " CalculosFondo"); + log.debug("Se encontraron " + calculoFondoList.size() + " CalculosFondo"); return calculoFondoList; } @@ -95,7 +95,7 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO { */ @Override public List getByCaja(Caja caja) { - LOGGER.info("Se intentara conseguir todos los calculos fondo de la caja " + caja); + log.debug("Se intentara conseguir todos los calculos fondo de la caja " + caja); List calculoFondoList = new ArrayList<>(); if (Caja.EMPTY == caja) { return calculoFondoList; @@ -119,9 +119,9 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar conseguir los CalculoFondo de la caja " + caja, e); + log.error("Error al intentar conseguir los CalculoFondo de la caja " + caja, e); } - LOGGER.trace("Se consiguieron " + calculoFondoList.size() + "CalculoFondo pertencientes a la caja " + caja); + log.debug("Se consiguieron " + calculoFondoList.size() + "CalculoFondo pertencientes a la caja " + caja); return calculoFondoList; } @@ -133,7 +133,7 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO { */ @Override public Optional getById(int id) { - LOGGER.info("Se intentara conseguir un CalculoFondo con id " + id); + log.debug("Se intentara conseguir un CalculoFondo con id " + id); CalculoFondo calculoFondo = null; String query = "select * from calculo_fondo where id = ?"; try (Connection conn = connectionHolder.getConnection()) { @@ -153,9 +153,9 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar conseguir un CalculoFondo por su id " + id, e); + log.error("Error al intentar conseguir un CalculoFondo por su id " + id, e); } - LOGGER.trace("El calculoFondo que se consiguio es " + calculoFondo); + log.debug("El calculoFondo que se consiguio es " + calculoFondo); return Optional.ofNullable(calculoFondo); } @@ -169,11 +169,11 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO { */ @Override public int getTotalCalculoFondo(Caja caja) { - LOGGER.info("Se intentara conseguir la suma de los valores de los CalculosFondo de la caja " + caja); + log.debug("Se intentara conseguir la suma de los valores de los CalculosFondo de la caja " + caja); int sum = 0; if (Caja.EMPTY == caja) { - LOGGER.trace("La caja que se entrego era Caja.EMPTY"); + log.debug("La caja que se entrego era Caja.EMPTY"); return sum; } @@ -188,10 +188,10 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar conseguir el total de calculo fondo de la caja " + caja, e); + log.error("Error al intentar conseguir el total de calculo fondo de la caja " + caja, e); } - LOGGER.trace("La suma conseguida de los CalculoFondo de la caja " + caja + " es " + sum); + log.debug("La suma conseguida de los CalculoFondo de la caja " + caja + " es " + sum); return sum; } @@ -202,7 +202,7 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO { */ @Override public void insert(CalculoFondo calculoFondo) { - LOGGER.info("Se intentara insertar el calculoFondo " + calculoFondo); + log.debug("Se intentara insertar el calculoFondo " + calculoFondo); String query = "insert into calculo_fondo (valor, descripcion, caja_id) values (?, ?, ?)"; try (Connection conn = connectionHolder.getConnection()) { @@ -220,10 +220,10 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar insertar el CalculoFondo " + calculoFondo, e); + log.error("Error al intentar insertar el CalculoFondo " + calculoFondo, e); } - LOGGER.trace("Se inserto el calculoFondo " + calculoFondo); + log.debug("Se inserto el calculoFondo " + calculoFondo); } /** @@ -233,7 +233,7 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO { */ @Override public void update(CalculoFondo calculoFondo) { - LOGGER.info("Se intentara actualizar el CalculoFondo " + calculoFondo); + log.debug("Se intentara actualizar el CalculoFondo " + calculoFondo); String query = "update calculo_fondo set valor = ?, descripcion = ?, caja_id = ? where id = ?"; try (Connection conn = connectionHolder.getConnection()) { try (PreparedStatement ps = conn.prepareStatement(query)) { @@ -245,9 +245,9 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO { ps.executeUpdate(); } } catch (SQLException e) { - LOGGER.error("Error al intentar actualizar el CalculoFondo " + calculoFondo, e); + log.error("Error al intentar actualizar el CalculoFondo " + calculoFondo, e); } - LOGGER.trace("Se actualizo el CalculoFondo " + calculoFondo); + log.debug("Se actualizo el CalculoFondo " + calculoFondo); } /** @@ -257,7 +257,7 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO { */ @Override public void delete(CalculoFondo calculoFondo) { - LOGGER.info("Se intentara eliminar el CalculoFondo" + calculoFondo); + log.debug("Se intentara eliminar el CalculoFondo" + calculoFondo); String query = "delete from calculo_fondo where id = ?"; try (Connection conn = connectionHolder.getConnection()) { try (PreparedStatement ps = conn.prepareStatement(query)) { @@ -265,8 +265,8 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO { ps.executeUpdate(); } } catch (SQLException e) { - LOGGER.error("Error al intentar eliminar el CalculoFondo " + calculoFondo, e); + log.error("Error al intentar eliminar el CalculoFondo " + calculoFondo, e); } - LOGGER.trace("El CalculoFondo " + calculoFondo + " fue eliminado de la base de datos"); + log.debug("El CalculoFondo " + calculoFondo + " fue eliminado de la base de datos"); } } diff --git a/src/danielcortes/xyz/models/documentos/SQLiteDocumentosDAO.java b/src/danielcortes/xyz/models/documentos/SQLiteDocumentosDAO.java index 13b2592..7b27de7 100644 --- a/src/danielcortes/xyz/models/documentos/SQLiteDocumentosDAO.java +++ b/src/danielcortes/xyz/models/documentos/SQLiteDocumentosDAO.java @@ -43,7 +43,7 @@ import org.apache.logging.log4j.Logger; * En especifico esta implementacion se comunica con la base de datos SQLite */ public class SQLiteDocumentosDAO implements DocumentosDAO { - private static final Logger LOGGER = LogManager.getLogger(SQLiteDocumentosDAO.class); + private static final Logger log = LogManager.getLogger(SQLiteDocumentosDAO.class); private ConnectionHolder connectionHolder; public SQLiteDocumentosDAO() { @@ -56,7 +56,7 @@ public class SQLiteDocumentosDAO implements DocumentosDAO { */ @Override public List getAll() { - LOGGER.info("Se intentaran conseguir todos los Documentos"); + log.debug("Se intentaran conseguir todos los Documentos"); List documentosList = new ArrayList<>(); String query = "select * from documentos"; try (Connection conn = connectionHolder.getConnection()) { @@ -79,9 +79,9 @@ public class SQLiteDocumentosDAO implements DocumentosDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar conseguir todos los Documentos de la base de datos", e); + log.error("Error al intentar conseguir todos los Documentos de la base de datos", e); } - LOGGER.trace("Se consiguieron " + documentosList.size() + " Documentos"); + log.debug("Se consiguieron " + documentosList.size() + " Documentos"); return documentosList; } @@ -93,7 +93,7 @@ public class SQLiteDocumentosDAO implements DocumentosDAO { */ @Override public Optional getById(int id) { - LOGGER.info("Se intentara conseguir el Documentos con id " + id); + log.debug("Se intentara conseguir el Documentos con id " + id); Documentos documentos = null; try (Connection conn = connectionHolder.getConnection()) { @@ -116,9 +116,9 @@ public class SQLiteDocumentosDAO implements DocumentosDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar conseguir el Documentos con id " + id, e); + log.error("Error al intentar conseguir el Documentos con id " + id, e); } - LOGGER.trace("Se consiguio el Documentos " + documentos); + log.debug("Se consiguio el Documentos " + documentos); return Optional.ofNullable(documentos); } @@ -130,11 +130,11 @@ public class SQLiteDocumentosDAO implements DocumentosDAO { */ @Override public Optional getByCaja(Caja caja) { - LOGGER.info("Se intentara conseguir el Documentos de la caja " + caja); + log.debug("Se intentara conseguir el Documentos de la caja " + caja); Documentos documentos = null; if (Caja.EMPTY == caja) { - LOGGER.trace("La caja entregada era Caja.EMPTY"); + log.debug("La caja entregada era Caja.EMPTY"); return Optional.ofNullable(documentos); } @@ -154,10 +154,10 @@ public class SQLiteDocumentosDAO implements DocumentosDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar conseguir el documentos de la caja " + caja, e); + log.error("Error al intentar conseguir el documentos de la caja " + caja, e); } - LOGGER.trace("Se consiguio el Documentos " + documentos); + log.debug("Se consiguio el Documentos " + documentos); return Optional.ofNullable(documentos); } @@ -169,10 +169,10 @@ public class SQLiteDocumentosDAO implements DocumentosDAO { */ @Override public int getTotalDocumentos(Caja caja) { - LOGGER.info("Se intentara conseguir el total de Documentos de la caja " + caja); + log.debug("Se intentara conseguir el total de Documentos de la caja " + caja); int total = 0; if (Caja.EMPTY == caja) { - LOGGER.trace("La caja entregada era Caja.EMPTY"); + log.debug("La caja entregada era Caja.EMPTY"); return total; } @@ -187,9 +187,9 @@ public class SQLiteDocumentosDAO implements DocumentosDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar conseguir la suma de los documentos de la caja " + caja); + log.error("Error al intentar conseguir la suma de los documentos de la caja " + caja); } - LOGGER.trace("La suma obtenida es " + total); + log.debug("La suma obtenida es " + total); return total; } @@ -199,7 +199,7 @@ public class SQLiteDocumentosDAO implements DocumentosDAO { */ @Override public void insert(Documentos documentos) { - LOGGER.info("Se intentara insertar un nuevo documentos " + documentos); + log.debug("Se intentara insertar un nuevo documentos " + documentos); String query = "insert into documentos (cheques, tarjetas, retiros, caja_id) values (?,?,?,?)"; try (Connection conn = connectionHolder.getConnection()) { try (PreparedStatement ps = conn.prepareStatement(query)) { @@ -218,9 +218,9 @@ public class SQLiteDocumentosDAO implements DocumentosDAO { } } catch (SQLException e) { - LOGGER.error("Error al intentar insertar el documentos " + documentos); + log.error("Error al intentar insertar el documentos " + documentos); } - LOGGER.trace("Se inserto el documentos " + documentos); + log.debug("Se inserto el documentos " + documentos); } /** @@ -231,7 +231,7 @@ public class SQLiteDocumentosDAO implements DocumentosDAO { */ @Override public void insertDefault(Documentos documentos) { - LOGGER.info("Se intentara insertar el documento default " + documentos); + log.debug("Se intentara insertar el documento default " + documentos); String query = "insert into documentos (cheques, tarjetas, retiros, caja_id) values (0,0,0,?)"; try (Connection conn = connectionHolder.getConnection()) { try (PreparedStatement ps = conn.prepareStatement(query)) { @@ -245,9 +245,9 @@ public class SQLiteDocumentosDAO implements DocumentosDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar insertar el documento por default " + documentos, e); + log.error("Error al intentar insertar el documento por default " + documentos, e); } - LOGGER.trace("Se inserto el documento por default " + documentos); + log.debug("Se inserto el documento por default " + documentos); } /** @@ -256,7 +256,7 @@ public class SQLiteDocumentosDAO implements DocumentosDAO { */ @Override public void update(Documentos documentos) { - LOGGER.info("Se intentara actualizar el documentos " + documentos); + log.debug("Se intentara actualizar el documentos " + documentos); String query = "update documentos set tarjetas = ?, cheques = ?, retiros = ?, caja_id = ? where id = ?"; try (Connection conn = connectionHolder.getConnection()) { try (PreparedStatement ps = conn.prepareStatement(query)) { @@ -268,9 +268,9 @@ public class SQLiteDocumentosDAO implements DocumentosDAO { ps.executeUpdate(); } } catch (SQLException e) { - LOGGER.error("Error al actualizar el documentos " + documentos, e); + log.error("Error al actualizar el documentos " + documentos, e); } - LOGGER.trace("Se actualizo el documentos " + documentos); + log.debug("Se actualizo el documentos " + documentos); } /** @@ -279,15 +279,15 @@ public class SQLiteDocumentosDAO implements DocumentosDAO { */ @Override public void delete(Documentos documentos) { - LOGGER.info("Se intentara eliminar el documentos " + documentos); + log.debug("Se intentara eliminar el documentos " + documentos); String query = "delete from documentos where id = ?"; try (Connection conn = connectionHolder.getConnection()) { try (PreparedStatement ps = conn.prepareStatement(query)) { ps.setInt(1, documentos.getId()); } } catch (SQLException e) { - LOGGER.error("Error al eliminar el documentos " + documentos, e); + log.error("Error al eliminar el documentos " + documentos, e); } - LOGGER.trace("Se elimino el documentos " + documentos); + log.debug("Se elimino el documentos " + documentos); } } diff --git a/src/danielcortes/xyz/models/efectivo/SQLiteEfectivoDAO.java b/src/danielcortes/xyz/models/efectivo/SQLiteEfectivoDAO.java index fc3971d..ca01bf2 100644 --- a/src/danielcortes/xyz/models/efectivo/SQLiteEfectivoDAO.java +++ b/src/danielcortes/xyz/models/efectivo/SQLiteEfectivoDAO.java @@ -44,7 +44,7 @@ import org.apache.logging.log4j.Logger; * En especifico esta implementacion se comunica con la base de datos SQLite */ public class SQLiteEfectivoDAO implements EfectivoDAO { - private static final Logger LOGGER = LogManager.getLogger(SQLiteEfectivoDAO.class); + private static final Logger log = LogManager.getLogger(SQLiteEfectivoDAO.class); private ConnectionHolder connectionHolder; public SQLiteEfectivoDAO() { @@ -57,7 +57,7 @@ public class SQLiteEfectivoDAO implements EfectivoDAO { */ @Override public List getAll() { - LOGGER.info("Se intentara conseguir todas los Efectivo"); + log.debug("Se intentara conseguir todas los Efectivo"); List efectivoList = new ArrayList<>(); String query = "select * from efectivos"; try (Connection conn = connectionHolder.getConnection()) { @@ -87,10 +87,10 @@ public class SQLiteEfectivoDAO implements EfectivoDAO { } } } catch (SQLException e) { - LOGGER.error("Erro al intentar conseguir todos los Efectivo", e); + log.error("Erro al intentar conseguir todos los Efectivo", e); } - LOGGER.trace("Se consiguieron " + efectivoList.size() + " Efectivo"); + log.debug("Se consiguieron " + efectivoList.size() + " Efectivo"); return efectivoList; } @@ -102,7 +102,7 @@ public class SQLiteEfectivoDAO implements EfectivoDAO { */ @Override public Optional getById(int id) { - LOGGER.info("Se intentara conseguir un Efectivo con id " + id); + log.debug("Se intentara conseguir un Efectivo con id " + id); Efectivo efectivo = null; String query = "select * from efectivos where id = ?"; try (Connection conn = connectionHolder.getConnection()) { @@ -131,9 +131,9 @@ public class SQLiteEfectivoDAO implements EfectivoDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar conseguir un Efectivo con id " + id); + log.error("Error al intentar conseguir un Efectivo con id " + id); } - LOGGER.trace("Se consiguio el efectivo " + efectivo); + log.debug("Se consiguio el efectivo " + efectivo); return Optional.ofNullable(efectivo); } @@ -146,10 +146,10 @@ public class SQLiteEfectivoDAO implements EfectivoDAO { */ @Override public Optional getByCaja(Caja caja) { - LOGGER.info("Se intentara conseguir un Efectivo perteneciente a la caja " + caja); + log.debug("Se intentara conseguir un Efectivo perteneciente a la caja " + caja); Efectivo efectivo = null; if (Caja.EMPTY == caja) { - LOGGER.trace("La caja entregada era Caja.EMPTY"); + log.debug("La caja entregada era Caja.EMPTY"); return Optional.ofNullable(efectivo); } @@ -175,10 +175,10 @@ public class SQLiteEfectivoDAO implements EfectivoDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar conseguir un Efectivo perteneciente a la caja " + caja ); + log.error("Error al intentar conseguir un Efectivo perteneciente a la caja " + caja ); } - LOGGER.trace("Se obtuvo el efectivo " + efectivo); + log.debug("Se obtuvo el efectivo " + efectivo); return Optional.ofNullable(efectivo); } @@ -190,11 +190,11 @@ public class SQLiteEfectivoDAO implements EfectivoDAO { */ @Override public int getTotalEfectivo(Caja caja) { - LOGGER.info("Se intentara conseguir la suma de efectivos de la caja " + caja); + log.debug("Se intentara conseguir la suma de efectivos de la caja " + caja); int total = 0; if (Caja.EMPTY == caja) { - LOGGER.trace("La caja entregada era Caja.EMPTY"); + log.debug("La caja entregada era Caja.EMPTY"); return total; } @@ -209,10 +209,10 @@ public class SQLiteEfectivoDAO implements EfectivoDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar conseguir la suma de efectivos con la caja " + caja); + log.error("Error al intentar conseguir la suma de efectivos con la caja " + caja); } - LOGGER.trace("La suma obtenida es " + total); + log.debug("La suma obtenida es " + total); return total; } @@ -222,7 +222,7 @@ public class SQLiteEfectivoDAO implements EfectivoDAO { */ @Override public void insert(Efectivo efectivo) { - LOGGER.info("Se intentara insertar el efectivo " + efectivo); + log.debug("Se intentara insertar el efectivo " + efectivo); String query = "insert into efectivos (veinte_mil, diez_mil, cinco_mil, dos_mil, mil, quinientos, cien, cincuenta, diez, caja_id) values (?,?,?,?,?,?,?,?,?,?)"; try (Connection conn = connectionHolder.getConnection()) { try (PreparedStatement ps = conn.prepareStatement(query)) { @@ -245,9 +245,9 @@ public class SQLiteEfectivoDAO implements EfectivoDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar insertar el efectivo " + efectivo, e); + log.error("Error al intentar insertar el efectivo " + efectivo, e); } - LOGGER.trace("Se inserto el efectivo " + efectivo); + log.debug("Se inserto el efectivo " + efectivo); } /** @@ -257,7 +257,7 @@ public class SQLiteEfectivoDAO implements EfectivoDAO { */ @Override public void insertDefault(Efectivo efectivo) { - LOGGER.info("Se intentara insertar el efectivo por default " + efectivo); + log.debug("Se intentara insertar el efectivo por default " + efectivo); String query = "insert into efectivos (veinte_mil, diez_mil, cinco_mil, dos_mil, mil, quinientos, cien, cincuenta, diez, caja_id) values (0,0,0,0,0,0,0,0,0,?)"; try (Connection conn = connectionHolder.getConnection()) { try (PreparedStatement ps = conn.prepareStatement(query)) { @@ -271,9 +271,9 @@ public class SQLiteEfectivoDAO implements EfectivoDAO { } } } catch (SQLException e) { - LOGGER.error("Error al insertar el efectivo por default " + efectivo, e); + log.error("Error al insertar el efectivo por default " + efectivo, e); } - LOGGER.trace("Se inserto el efectivo por default " + efectivo); + log.debug("Se inserto el efectivo por default " + efectivo); } /** @@ -282,7 +282,7 @@ public class SQLiteEfectivoDAO implements EfectivoDAO { */ @Override public void update(Efectivo efectivo) { - LOGGER.info("Se intentara actualizar el efectivo " + efectivo); + log.debug("Se intentara actualizar el efectivo " + efectivo); String query = "update efectivos set veinte_mil = ?, diez_mil = ?, cinco_mil = ?, dos_mil = ?, mil = ?, quinientos = ?, cien = ?, cincuenta = ?, diez = ?, caja_id = ? where id = ?"; try (Connection conn = connectionHolder.getConnection()) { try (PreparedStatement ps = conn.prepareStatement(query)) { @@ -301,9 +301,9 @@ public class SQLiteEfectivoDAO implements EfectivoDAO { ps.executeUpdate(); } } catch (SQLException e) { - LOGGER.error("Error al intentar actualizar el efectivo " + efectivo, e); + log.error("Error al intentar actualizar el efectivo " + efectivo, e); } - LOGGER.trace("Se actualizo el efectivo " + efectivo); + log.debug("Se actualizo el efectivo " + efectivo); } /** @@ -312,7 +312,7 @@ public class SQLiteEfectivoDAO implements EfectivoDAO { */ @Override public void delete(Efectivo efectivo) { - LOGGER.info("Se intentara eliminar el efectivo " + efectivo); + log.debug("Se intentara eliminar el efectivo " + efectivo); String query = "delete from efectivos where id = ?"; try (Connection conn = connectionHolder.getConnection()) { try (PreparedStatement ps = conn.prepareStatement(query)) { @@ -320,9 +320,9 @@ public class SQLiteEfectivoDAO implements EfectivoDAO { ps.executeUpdate(); } } catch (SQLException e) { - LOGGER.error("Error al intentar eliminar el efectivo " + efectivo, e); + log.error("Error al intentar eliminar el efectivo " + efectivo, e); } - LOGGER.trace("Se elimino el efectivo " + efectivo); + log.debug("Se elimino el efectivo " + efectivo); } } diff --git a/src/danielcortes/xyz/models/egreso/SQLiteEgresoDAO.java b/src/danielcortes/xyz/models/egreso/SQLiteEgresoDAO.java index d9e4324..0c754a6 100644 --- a/src/danielcortes/xyz/models/egreso/SQLiteEgresoDAO.java +++ b/src/danielcortes/xyz/models/egreso/SQLiteEgresoDAO.java @@ -49,7 +49,7 @@ import org.apache.logging.log4j.Logger; */ public class SQLiteEgresoDAO implements EgresoDAO { - private static final Logger LOGGER = LogManager.getLogger(SQLiteEgresoDAO.class); + private static final Logger log = LogManager.getLogger(SQLiteEgresoDAO.class); private ConnectionHolder connectionHolder; public SQLiteEgresoDAO() { @@ -63,7 +63,7 @@ public class SQLiteEgresoDAO implements EgresoDAO { */ @Override public List getAll() { - LOGGER.debug("Se intentara conseguir todos los Egreso"); + log.debug("Se intentara conseguir todos los Egreso"); List egresoList = new ArrayList<>(); String query = "select * from egresos"; try (Connection conn = connectionHolder.getConnection()) { @@ -94,9 +94,9 @@ public class SQLiteEgresoDAO implements EgresoDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar conseguir todos los Egreso"); + log.error("Error al intentar conseguir todos los Egreso"); } - LOGGER.debug("Se consiguieron " + egresoList.size() + " Egreso"); + log.debug("Se consiguieron " + egresoList.size() + " Egreso"); return egresoList; } @@ -109,7 +109,7 @@ public class SQLiteEgresoDAO implements EgresoDAO { */ @Override public Optional getById(int id) { - LOGGER.debug("Se intentara conseguir un Egreso con el id " + id); + log.debug("Se intentara conseguir un Egreso con el id " + id); Egreso egreso = null; String query = "select * from egresos where id = ?"; try (Connection conn = connectionHolder.getConnection()) { @@ -138,9 +138,9 @@ public class SQLiteEgresoDAO implements EgresoDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar conseguir el Egreso con id " + id, e); + log.error("Error al intentar conseguir el Egreso con id " + id, e); } - LOGGER.debug("Se consiguio el egreso " + egreso); + log.debug("Se consiguio el egreso " + egreso); return Optional.ofNullable(egreso); } @@ -152,11 +152,11 @@ public class SQLiteEgresoDAO implements EgresoDAO { */ @Override public List getByCaja(Caja caja) { - LOGGER.debug("Se intentara conseguir los egresos de la caja " + caja); + log.debug("Se intentara conseguir los egresos de la caja " + caja); List egresoList = new ArrayList<>(); if (Caja.EMPTY == caja) { - LOGGER.debug("La caja entregada es Caja.EMPY"); + log.debug("La caja entregada es Caja.EMPY"); return egresoList; } @@ -185,9 +185,9 @@ public class SQLiteEgresoDAO implements EgresoDAO { } } catch (SQLException e) { - LOGGER.error("Error al intentar conseguir los egreso de la caja " + caja, e); + log.error("Error al intentar conseguir los egreso de la caja " + caja, e); } - LOGGER.debug("Se consieron " + egresoList.size() + " Egreso"); + log.debug("Se consieron " + egresoList.size() + " Egreso"); return egresoList; } @@ -199,7 +199,7 @@ public class SQLiteEgresoDAO implements EgresoDAO { */ @Override public List getByNro(String nro) { - LOGGER.debug("Se intentara conseguir los Egreso con nro " + nro); + log.debug("Se intentara conseguir los Egreso con nro " + nro); List egresoList = new ArrayList<>(); String query = "select * from egresos where nro = ?"; try (Connection conn = connectionHolder.getConnection()) { @@ -230,9 +230,9 @@ public class SQLiteEgresoDAO implements EgresoDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar conseguir los Egreso con nro " + nro, e); + log.error("Error al intentar conseguir los Egreso con nro " + nro, e); } - LOGGER.debug("Se consiguieron " + egresoList.size() + " Egreso"); + log.debug("Se consiguieron " + egresoList.size() + " Egreso"); return egresoList; } @@ -245,11 +245,11 @@ public class SQLiteEgresoDAO implements EgresoDAO { */ @Override public List getByTipoEgreso(TipoEgreso tipoEgreso) { - LOGGER.debug("Se intentara conseguir los Egreso con TipoEgreso " + tipoEgreso); + log.debug("Se intentara conseguir los Egreso con TipoEgreso " + tipoEgreso); List egresoList = new ArrayList<>(); if (TipoEgreso.EMPTY == tipoEgreso) { - LOGGER.debug("El tipo egreso era TipoEgreso.EMPY"); + log.debug("El tipo egreso era TipoEgreso.EMPY"); return egresoList; } @@ -277,9 +277,9 @@ public class SQLiteEgresoDAO implements EgresoDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar conseguir los Egreso para el TipoEgreso " + tipoEgreso, e); + log.error("Error al intentar conseguir los Egreso para el TipoEgreso " + tipoEgreso, e); } - LOGGER.debug("Se consiguieron " + egresoList.size() + " Egresos"); + log.debug("Se consiguieron " + egresoList.size() + " Egresos"); return egresoList; } @@ -292,12 +292,12 @@ public class SQLiteEgresoDAO implements EgresoDAO { */ @Override public List getByTipoEgresoEnCaja(TipoEgreso tipoEgreso, Caja caja) { - LOGGER.debug("Se intentara conseguir los Egresos pertencienes al tipoEgreso " + tipoEgreso + log.debug("Se intentara conseguir los Egresos pertencienes al tipoEgreso " + tipoEgreso + " y a la caja " + caja); List egresoList = new ArrayList<>(); if (caja == Caja.EMPTY || tipoEgreso == TipoEgreso.EMPTY) { - LOGGER.debug("La caja o el tipoEgreso eran EMPTY"); + log.debug("La caja o el tipoEgreso eran EMPTY"); return egresoList; } @@ -321,7 +321,7 @@ public class SQLiteEgresoDAO implements EgresoDAO { } } } catch (SQLException e) { - LOGGER.error( + log.error( "Error al intentar conseguir los egresos pertenecientes al tipoEgreso " + tipoEgreso + " y a la caja " + caja, e); } @@ -336,11 +336,11 @@ public class SQLiteEgresoDAO implements EgresoDAO { */ @Override public int getTotalEgreso(Caja caja) { - LOGGER.debug("Se intentara conseguir la suma de egreso de la caja " + caja); + log.debug("Se intentara conseguir la suma de egreso de la caja " + caja); int total = 0; if (Caja.EMPTY == caja) { - LOGGER.debug("La caja era Caja.EMPTY"); + log.debug("La caja era Caja.EMPTY"); return total; } @@ -355,10 +355,10 @@ public class SQLiteEgresoDAO implements EgresoDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar conseguir la suma de egresos de la caja " + caja, e); + log.error("Error al intentar conseguir la suma de egresos de la caja " + caja, e); } - LOGGER.debug("El total obtenido es " + total); + log.debug("El total obtenido es " + total); return total; } @@ -372,12 +372,12 @@ public class SQLiteEgresoDAO implements EgresoDAO { */ @Override public int getTotalEgresoMesPorTipo(YearMonth mes, TipoEgreso tipo) { - LOGGER.debug( + log.debug( "Se intentara conseguir el total de egresos en el mes " + mes + " y del tipo " + tipo); int total = 0; if (TipoEgreso.EMPTY == tipo) { - LOGGER.debug("El TipoEgreso era TipoEgreso.EMPTY"); + log.debug("El TipoEgreso era TipoEgreso.EMPTY"); return total; } @@ -396,11 +396,11 @@ public class SQLiteEgresoDAO implements EgresoDAO { } } } catch (SQLException e) { - LOGGER.error( + log.error( "Error al intentar conseguir la suma de egresos en el mes " + mes + " y del tipo egreso " + tipo, e); } - LOGGER.debug("El total obtenido es " + total); + log.debug("El total obtenido es " + total); return total; } @@ -411,7 +411,7 @@ public class SQLiteEgresoDAO implements EgresoDAO { */ @Override public void insert(Egreso egreso) { - LOGGER.debug("Se intentara insertar el egreso " + egreso); + log.debug("Se intentara insertar el egreso " + egreso); String query = "insert into egresos (nro, descripcion, valor, tipo_egreso_id, caja_id) values (?,?,?,?,?)"; try (Connection conn = connectionHolder.getConnection()) { try (PreparedStatement ps = conn.prepareStatement(query)) { @@ -429,9 +429,9 @@ public class SQLiteEgresoDAO implements EgresoDAO { } } } catch (SQLException e) { - LOGGER.error("Error al intentar insertar el egreso " + egreso, e); + log.error("Error al intentar insertar el egreso " + egreso, e); } - LOGGER.debug("Se inserto el egreso " + egreso); + log.debug("Se inserto el egreso " + egreso); } /** @@ -440,7 +440,7 @@ public class SQLiteEgresoDAO implements EgresoDAO { */ @Override public void update(Egreso egreso) { - LOGGER.debug("Se intentara actualizar el egreso " + egreso); + log.debug("Se intentara actualizar el egreso " + egreso); String query = "update egresos set nro = ?, descripcion = ?, valor = ?, tipo_egreso_id = ?, caja_id = ? where id = ? "; try (Connection conn = connectionHolder.getConnection()) { try (PreparedStatement ps = conn.prepareStatement(query)) { @@ -453,9 +453,9 @@ public class SQLiteEgresoDAO implements EgresoDAO { ps.executeUpdate(); } } catch (SQLException e) { - LOGGER.error("Error al intentar actualizar el egreso " + egreso, e); + log.error("Error al intentar actualizar el egreso " + egreso, e); } - LOGGER.debug("Se actualizo el egreso " + egreso); + log.debug("Se actualizo el egreso " + egreso); } /** @@ -464,7 +464,7 @@ public class SQLiteEgresoDAO implements EgresoDAO { */ @Override public void delete(Egreso egreso) { - LOGGER.debug("Se intentara eliminar el egreso " + egreso); + log.debug("Se intentara eliminar el egreso " + egreso); String query = "delete from egresos where id = ? "; try (Connection conn = connectionHolder.getConnection()) { try (PreparedStatement ps = conn.prepareStatement(query)) { @@ -472,8 +472,8 @@ public class SQLiteEgresoDAO implements EgresoDAO { ps.executeUpdate(); } } catch (SQLException e) { - LOGGER.error("Error al intentar actualizar el egreso " + egreso); + log.error("Error al intentar actualizar el egreso " + egreso); } - LOGGER.debug("Se elimino el egreso " + egreso); + log.debug("Se elimino el egreso " + egreso); } }