Cambie LOGGER por log y los log.info y log.trace por log.debug
This commit is contained in:
BIN
dist/Programa Caja.jar
vendored
BIN
dist/Programa Caja.jar
vendored
Binary file not shown.
@@ -41,7 +41,7 @@ import org.apache.logging.log4j.Logger;
|
|||||||
* En especifico esta implementacion se comunica con la base de datos SQLite
|
* En especifico esta implementacion se comunica con la base de datos SQLite
|
||||||
*/
|
*/
|
||||||
public class SQLiteCajaDAO implements CajaDAO {
|
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;
|
private SQLiteConnectionHolder connectionHolder;
|
||||||
|
|
||||||
public SQLiteCajaDAO() {
|
public SQLiteCajaDAO() {
|
||||||
@@ -55,7 +55,7 @@ public class SQLiteCajaDAO implements CajaDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Caja> getAll() {
|
public List<Caja> getAll() {
|
||||||
LOGGER.info("Se intentara conseguir todas las Cajas");
|
log.debug("Se intentara conseguir todas las Cajas");
|
||||||
List<Caja> cajaList = new ArrayList<>();
|
List<Caja> cajaList = new ArrayList<>();
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
String query = "select * from caja";
|
String query = "select * from caja";
|
||||||
@@ -71,9 +71,9 @@ public class SQLiteCajaDAO implements CajaDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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;
|
return cajaList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ public class SQLiteCajaDAO implements CajaDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Optional<Caja> getById(int id) {
|
public Optional<Caja> 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;
|
Caja caja = null;
|
||||||
String query = "select * from caja where id = ?";
|
String query = "select * from caja where id = ?";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
@@ -102,9 +102,9 @@ public class SQLiteCajaDAO implements CajaDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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);
|
return Optional.ofNullable(caja);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ public class SQLiteCajaDAO implements CajaDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Optional<Caja> getByFecha(LocalDate fecha) {
|
public Optional<Caja> 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;
|
Caja caja = null;
|
||||||
String query = "select * from caja where fecha = ?";
|
String query = "select * from caja where fecha = ?";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
@@ -132,9 +132,9 @@ public class SQLiteCajaDAO implements CajaDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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);
|
return Optional.ofNullable(caja);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ public class SQLiteCajaDAO implements CajaDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void insert(Caja caja) {
|
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 (?, ?)";
|
String query = "insert into caja (fecha, fondo) values (?, ?)";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
||||||
@@ -161,9 +161,9 @@ public class SQLiteCajaDAO implements CajaDAO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} 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
|
@Override
|
||||||
public void update(Caja caja) {
|
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 = ?";
|
String query = "update caja set fecha = ?, fondo = ? where id = ?";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
||||||
@@ -182,8 +182,8 @@ public class SQLiteCajaDAO implements CajaDAO {
|
|||||||
ps.executeUpdate();
|
ps.executeUpdate();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import org.apache.logging.log4j.Logger;
|
|||||||
* En especifico esta implementacion se comunica con la base de datos SQLite
|
* En especifico esta implementacion se comunica con la base de datos SQLite
|
||||||
*/
|
*/
|
||||||
public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
|
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;
|
private ConnectionHolder connectionHolder;
|
||||||
|
|
||||||
public SQLiteCalculoFondoDAO() {
|
public SQLiteCalculoFondoDAO() {
|
||||||
@@ -57,7 +57,7 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<CalculoFondo> getAll() {
|
public List<CalculoFondo> getAll() {
|
||||||
LOGGER.info("Se intentara conseguir todos los CalculosFondo");
|
log.debug("Se intentara conseguir todos los CalculosFondo");
|
||||||
List<CalculoFondo> calculoFondoList = new ArrayList<>();
|
List<CalculoFondo> calculoFondoList = new ArrayList<>();
|
||||||
String query = "select * from calculo_fondo";
|
String query = "select * from calculo_fondo";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
@@ -78,9 +78,9 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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;
|
return calculoFondoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<CalculoFondo> getByCaja(Caja caja) {
|
public List<CalculoFondo> 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<CalculoFondo> calculoFondoList = new ArrayList<>();
|
List<CalculoFondo> calculoFondoList = new ArrayList<>();
|
||||||
if (Caja.EMPTY == caja) {
|
if (Caja.EMPTY == caja) {
|
||||||
return calculoFondoList;
|
return calculoFondoList;
|
||||||
@@ -119,9 +119,9 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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;
|
return calculoFondoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Optional<CalculoFondo> getById(int id) {
|
public Optional<CalculoFondo> 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;
|
CalculoFondo calculoFondo = null;
|
||||||
String query = "select * from calculo_fondo where id = ?";
|
String query = "select * from calculo_fondo where id = ?";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
@@ -153,9 +153,9 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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);
|
return Optional.ofNullable(calculoFondo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,11 +169,11 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getTotalCalculoFondo(Caja caja) {
|
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;
|
int sum = 0;
|
||||||
|
|
||||||
if (Caja.EMPTY == caja) {
|
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;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,10 +188,10 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,7 +202,7 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void insert(CalculoFondo calculoFondo) {
|
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 (?, ?, ?)";
|
String query = "insert into calculo_fondo (valor, descripcion, caja_id) values (?, ?, ?)";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
@@ -220,10 +220,10 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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
|
@Override
|
||||||
public void update(CalculoFondo calculoFondo) {
|
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 = ?";
|
String query = "update calculo_fondo set valor = ?, descripcion = ?, caja_id = ? where id = ?";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
||||||
@@ -245,9 +245,9 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
|
|||||||
ps.executeUpdate();
|
ps.executeUpdate();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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
|
@Override
|
||||||
public void delete(CalculoFondo calculoFondo) {
|
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 = ?";
|
String query = "delete from calculo_fondo where id = ?";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
||||||
@@ -265,8 +265,8 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
|
|||||||
ps.executeUpdate();
|
ps.executeUpdate();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import org.apache.logging.log4j.Logger;
|
|||||||
* En especifico esta implementacion se comunica con la base de datos SQLite
|
* En especifico esta implementacion se comunica con la base de datos SQLite
|
||||||
*/
|
*/
|
||||||
public class SQLiteDocumentosDAO implements DocumentosDAO {
|
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;
|
private ConnectionHolder connectionHolder;
|
||||||
|
|
||||||
public SQLiteDocumentosDAO() {
|
public SQLiteDocumentosDAO() {
|
||||||
@@ -56,7 +56,7 @@ public class SQLiteDocumentosDAO implements DocumentosDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Documentos> getAll() {
|
public List<Documentos> getAll() {
|
||||||
LOGGER.info("Se intentaran conseguir todos los Documentos");
|
log.debug("Se intentaran conseguir todos los Documentos");
|
||||||
List<Documentos> documentosList = new ArrayList<>();
|
List<Documentos> documentosList = new ArrayList<>();
|
||||||
String query = "select * from documentos";
|
String query = "select * from documentos";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
@@ -79,9 +79,9 @@ public class SQLiteDocumentosDAO implements DocumentosDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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;
|
return documentosList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ public class SQLiteDocumentosDAO implements DocumentosDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Optional<Documentos> getById(int id) {
|
public Optional<Documentos> 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;
|
Documentos documentos = null;
|
||||||
|
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
@@ -116,9 +116,9 @@ public class SQLiteDocumentosDAO implements DocumentosDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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);
|
return Optional.ofNullable(documentos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,11 +130,11 @@ public class SQLiteDocumentosDAO implements DocumentosDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Optional<Documentos> getByCaja(Caja caja) {
|
public Optional<Documentos> 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;
|
Documentos documentos = null;
|
||||||
|
|
||||||
if (Caja.EMPTY == caja) {
|
if (Caja.EMPTY == caja) {
|
||||||
LOGGER.trace("La caja entregada era Caja.EMPTY");
|
log.debug("La caja entregada era Caja.EMPTY");
|
||||||
return Optional.ofNullable(documentos);
|
return Optional.ofNullable(documentos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,10 +154,10 @@ public class SQLiteDocumentosDAO implements DocumentosDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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);
|
return Optional.ofNullable(documentos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,10 +169,10 @@ public class SQLiteDocumentosDAO implements DocumentosDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getTotalDocumentos(Caja caja) {
|
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;
|
int total = 0;
|
||||||
if (Caja.EMPTY == caja) {
|
if (Caja.EMPTY == caja) {
|
||||||
LOGGER.trace("La caja entregada era Caja.EMPTY");
|
log.debug("La caja entregada era Caja.EMPTY");
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,9 +187,9 @@ public class SQLiteDocumentosDAO implements DocumentosDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,7 +199,7 @@ public class SQLiteDocumentosDAO implements DocumentosDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void insert(Documentos documentos) {
|
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 (?,?,?,?)";
|
String query = "insert into documentos (cheques, tarjetas, retiros, caja_id) values (?,?,?,?)";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
||||||
@@ -218,9 +218,9 @@ public class SQLiteDocumentosDAO implements DocumentosDAO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} 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
|
@Override
|
||||||
public void insertDefault(Documentos documentos) {
|
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,?)";
|
String query = "insert into documentos (cheques, tarjetas, retiros, caja_id) values (0,0,0,?)";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
||||||
@@ -245,9 +245,9 @@ public class SQLiteDocumentosDAO implements DocumentosDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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
|
@Override
|
||||||
public void update(Documentos documentos) {
|
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 = ?";
|
String query = "update documentos set tarjetas = ?, cheques = ?, retiros = ?, caja_id = ? where id = ?";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
||||||
@@ -268,9 +268,9 @@ public class SQLiteDocumentosDAO implements DocumentosDAO {
|
|||||||
ps.executeUpdate();
|
ps.executeUpdate();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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
|
@Override
|
||||||
public void delete(Documentos documentos) {
|
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 = ?";
|
String query = "delete from documentos where id = ?";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
||||||
ps.setInt(1, documentos.getId());
|
ps.setInt(1, documentos.getId());
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import org.apache.logging.log4j.Logger;
|
|||||||
* En especifico esta implementacion se comunica con la base de datos SQLite
|
* En especifico esta implementacion se comunica con la base de datos SQLite
|
||||||
*/
|
*/
|
||||||
public class SQLiteEfectivoDAO implements EfectivoDAO {
|
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;
|
private ConnectionHolder connectionHolder;
|
||||||
|
|
||||||
public SQLiteEfectivoDAO() {
|
public SQLiteEfectivoDAO() {
|
||||||
@@ -57,7 +57,7 @@ public class SQLiteEfectivoDAO implements EfectivoDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Efectivo> getAll() {
|
public List<Efectivo> getAll() {
|
||||||
LOGGER.info("Se intentara conseguir todas los Efectivo");
|
log.debug("Se intentara conseguir todas los Efectivo");
|
||||||
List<Efectivo> efectivoList = new ArrayList<>();
|
List<Efectivo> efectivoList = new ArrayList<>();
|
||||||
String query = "select * from efectivos";
|
String query = "select * from efectivos";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
@@ -87,10 +87,10 @@ public class SQLiteEfectivoDAO implements EfectivoDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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;
|
return efectivoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ public class SQLiteEfectivoDAO implements EfectivoDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Optional<Efectivo> getById(int id) {
|
public Optional<Efectivo> 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;
|
Efectivo efectivo = null;
|
||||||
String query = "select * from efectivos where id = ?";
|
String query = "select * from efectivos where id = ?";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
@@ -131,9 +131,9 @@ public class SQLiteEfectivoDAO implements EfectivoDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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);
|
return Optional.ofNullable(efectivo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,10 +146,10 @@ public class SQLiteEfectivoDAO implements EfectivoDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Optional<Efectivo> getByCaja(Caja caja) {
|
public Optional<Efectivo> 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;
|
Efectivo efectivo = null;
|
||||||
if (Caja.EMPTY == caja) {
|
if (Caja.EMPTY == caja) {
|
||||||
LOGGER.trace("La caja entregada era Caja.EMPTY");
|
log.debug("La caja entregada era Caja.EMPTY");
|
||||||
return Optional.ofNullable(efectivo);
|
return Optional.ofNullable(efectivo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,10 +175,10 @@ public class SQLiteEfectivoDAO implements EfectivoDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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);
|
return Optional.ofNullable(efectivo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,11 +190,11 @@ public class SQLiteEfectivoDAO implements EfectivoDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getTotalEfectivo(Caja caja) {
|
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;
|
int total = 0;
|
||||||
|
|
||||||
if (Caja.EMPTY == caja) {
|
if (Caja.EMPTY == caja) {
|
||||||
LOGGER.trace("La caja entregada era Caja.EMPTY");
|
log.debug("La caja entregada era Caja.EMPTY");
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,10 +209,10 @@ public class SQLiteEfectivoDAO implements EfectivoDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +222,7 @@ public class SQLiteEfectivoDAO implements EfectivoDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void insert(Efectivo efectivo) {
|
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 (?,?,?,?,?,?,?,?,?,?)";
|
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 (Connection conn = connectionHolder.getConnection()) {
|
||||||
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
||||||
@@ -245,9 +245,9 @@ public class SQLiteEfectivoDAO implements EfectivoDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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
|
@Override
|
||||||
public void insertDefault(Efectivo efectivo) {
|
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,?)";
|
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 (Connection conn = connectionHolder.getConnection()) {
|
||||||
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
||||||
@@ -271,9 +271,9 @@ public class SQLiteEfectivoDAO implements EfectivoDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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
|
@Override
|
||||||
public void update(Efectivo efectivo) {
|
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 = ?";
|
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 (Connection conn = connectionHolder.getConnection()) {
|
||||||
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
||||||
@@ -301,9 +301,9 @@ public class SQLiteEfectivoDAO implements EfectivoDAO {
|
|||||||
ps.executeUpdate();
|
ps.executeUpdate();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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
|
@Override
|
||||||
public void delete(Efectivo efectivo) {
|
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 = ?";
|
String query = "delete from efectivos where id = ?";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
||||||
@@ -320,9 +320,9 @@ public class SQLiteEfectivoDAO implements EfectivoDAO {
|
|||||||
ps.executeUpdate();
|
ps.executeUpdate();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ import org.apache.logging.log4j.Logger;
|
|||||||
*/
|
*/
|
||||||
public class SQLiteEgresoDAO implements EgresoDAO {
|
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;
|
private ConnectionHolder connectionHolder;
|
||||||
|
|
||||||
public SQLiteEgresoDAO() {
|
public SQLiteEgresoDAO() {
|
||||||
@@ -63,7 +63,7 @@ public class SQLiteEgresoDAO implements EgresoDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Egreso> getAll() {
|
public List<Egreso> getAll() {
|
||||||
LOGGER.debug("Se intentara conseguir todos los Egreso");
|
log.debug("Se intentara conseguir todos los Egreso");
|
||||||
List<Egreso> egresoList = new ArrayList<>();
|
List<Egreso> egresoList = new ArrayList<>();
|
||||||
String query = "select * from egresos";
|
String query = "select * from egresos";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
@@ -94,9 +94,9 @@ public class SQLiteEgresoDAO implements EgresoDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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;
|
return egresoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ public class SQLiteEgresoDAO implements EgresoDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Optional<Egreso> getById(int id) {
|
public Optional<Egreso> 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;
|
Egreso egreso = null;
|
||||||
String query = "select * from egresos where id = ?";
|
String query = "select * from egresos where id = ?";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
@@ -138,9 +138,9 @@ public class SQLiteEgresoDAO implements EgresoDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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);
|
return Optional.ofNullable(egreso);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,11 +152,11 @@ public class SQLiteEgresoDAO implements EgresoDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Egreso> getByCaja(Caja caja) {
|
public List<Egreso> 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<Egreso> egresoList = new ArrayList<>();
|
List<Egreso> egresoList = new ArrayList<>();
|
||||||
|
|
||||||
if (Caja.EMPTY == caja) {
|
if (Caja.EMPTY == caja) {
|
||||||
LOGGER.debug("La caja entregada es Caja.EMPY");
|
log.debug("La caja entregada es Caja.EMPY");
|
||||||
return egresoList;
|
return egresoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,9 +185,9 @@ public class SQLiteEgresoDAO implements EgresoDAO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (SQLException e) {
|
} 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;
|
return egresoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,7 +199,7 @@ public class SQLiteEgresoDAO implements EgresoDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Egreso> getByNro(String nro) {
|
public List<Egreso> getByNro(String nro) {
|
||||||
LOGGER.debug("Se intentara conseguir los Egreso con nro " + nro);
|
log.debug("Se intentara conseguir los Egreso con nro " + nro);
|
||||||
List<Egreso> egresoList = new ArrayList<>();
|
List<Egreso> egresoList = new ArrayList<>();
|
||||||
String query = "select * from egresos where nro = ?";
|
String query = "select * from egresos where nro = ?";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
@@ -230,9 +230,9 @@ public class SQLiteEgresoDAO implements EgresoDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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;
|
return egresoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,11 +245,11 @@ public class SQLiteEgresoDAO implements EgresoDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Egreso> getByTipoEgreso(TipoEgreso tipoEgreso) {
|
public List<Egreso> getByTipoEgreso(TipoEgreso tipoEgreso) {
|
||||||
LOGGER.debug("Se intentara conseguir los Egreso con TipoEgreso " + tipoEgreso);
|
log.debug("Se intentara conseguir los Egreso con TipoEgreso " + tipoEgreso);
|
||||||
List<Egreso> egresoList = new ArrayList<>();
|
List<Egreso> egresoList = new ArrayList<>();
|
||||||
|
|
||||||
if (TipoEgreso.EMPTY == tipoEgreso) {
|
if (TipoEgreso.EMPTY == tipoEgreso) {
|
||||||
LOGGER.debug("El tipo egreso era TipoEgreso.EMPY");
|
log.debug("El tipo egreso era TipoEgreso.EMPY");
|
||||||
return egresoList;
|
return egresoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,9 +277,9 @@ public class SQLiteEgresoDAO implements EgresoDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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;
|
return egresoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,12 +292,12 @@ public class SQLiteEgresoDAO implements EgresoDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<Egreso> getByTipoEgresoEnCaja(TipoEgreso tipoEgreso, Caja caja) {
|
public List<Egreso> 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);
|
+ " y a la caja " + caja);
|
||||||
List<Egreso> egresoList = new ArrayList<>();
|
List<Egreso> egresoList = new ArrayList<>();
|
||||||
|
|
||||||
if (caja == Caja.EMPTY || tipoEgreso == TipoEgreso.EMPTY) {
|
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;
|
return egresoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,7 +321,7 @@ public class SQLiteEgresoDAO implements EgresoDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error(
|
log.error(
|
||||||
"Error al intentar conseguir los egresos pertenecientes al tipoEgreso " + tipoEgreso
|
"Error al intentar conseguir los egresos pertenecientes al tipoEgreso " + tipoEgreso
|
||||||
+ " y a la caja " + caja, e);
|
+ " y a la caja " + caja, e);
|
||||||
}
|
}
|
||||||
@@ -336,11 +336,11 @@ public class SQLiteEgresoDAO implements EgresoDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getTotalEgreso(Caja caja) {
|
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;
|
int total = 0;
|
||||||
|
|
||||||
if (Caja.EMPTY == caja) {
|
if (Caja.EMPTY == caja) {
|
||||||
LOGGER.debug("La caja era Caja.EMPTY");
|
log.debug("La caja era Caja.EMPTY");
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,10 +355,10 @@ public class SQLiteEgresoDAO implements EgresoDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,12 +372,12 @@ public class SQLiteEgresoDAO implements EgresoDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getTotalEgresoMesPorTipo(YearMonth mes, TipoEgreso tipo) {
|
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);
|
"Se intentara conseguir el total de egresos en el mes " + mes + " y del tipo " + tipo);
|
||||||
int total = 0;
|
int total = 0;
|
||||||
|
|
||||||
if (TipoEgreso.EMPTY == tipo) {
|
if (TipoEgreso.EMPTY == tipo) {
|
||||||
LOGGER.debug("El TipoEgreso era TipoEgreso.EMPTY");
|
log.debug("El TipoEgreso era TipoEgreso.EMPTY");
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -396,11 +396,11 @@ public class SQLiteEgresoDAO implements EgresoDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
LOGGER.error(
|
log.error(
|
||||||
"Error al intentar conseguir la suma de egresos en el mes " + mes + " y del tipo egreso "
|
"Error al intentar conseguir la suma de egresos en el mes " + mes + " y del tipo egreso "
|
||||||
+ tipo, e);
|
+ tipo, e);
|
||||||
}
|
}
|
||||||
LOGGER.debug("El total obtenido es " + total);
|
log.debug("El total obtenido es " + total);
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,7 +411,7 @@ public class SQLiteEgresoDAO implements EgresoDAO {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void insert(Egreso egreso) {
|
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 (?,?,?,?,?)";
|
String query = "insert into egresos (nro, descripcion, valor, tipo_egreso_id, caja_id) values (?,?,?,?,?)";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
||||||
@@ -429,9 +429,9 @@ public class SQLiteEgresoDAO implements EgresoDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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
|
@Override
|
||||||
public void update(Egreso egreso) {
|
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 = ? ";
|
String query = "update egresos set nro = ?, descripcion = ?, valor = ?, tipo_egreso_id = ?, caja_id = ? where id = ? ";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
||||||
@@ -453,9 +453,9 @@ public class SQLiteEgresoDAO implements EgresoDAO {
|
|||||||
ps.executeUpdate();
|
ps.executeUpdate();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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
|
@Override
|
||||||
public void delete(Egreso egreso) {
|
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 = ? ";
|
String query = "delete from egresos where id = ? ";
|
||||||
try (Connection conn = connectionHolder.getConnection()) {
|
try (Connection conn = connectionHolder.getConnection()) {
|
||||||
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
try (PreparedStatement ps = conn.prepareStatement(query)) {
|
||||||
@@ -472,8 +472,8 @@ public class SQLiteEgresoDAO implements EgresoDAO {
|
|||||||
ps.executeUpdate();
|
ps.executeUpdate();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user