Se agrego loggeo a esta clase

This commit is contained in:
Daniel Cortes
2019-03-08 01:16:15 -03:00
parent 3baa38e201
commit 26ec581f72
2 changed files with 14 additions and 4 deletions

BIN
dist/Programa Caja.jar vendored

Binary file not shown.

View File

@@ -35,8 +35,13 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
private static final Logger LOGGER = LogManager.getLogger(SQLiteCalculoFondoDAO.class);
private ConnectionHolder connectionHolder;
public SQLiteCalculoFondoDAO() {
@@ -64,8 +69,8 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
}
}
}
} catch (
SQLException e) {
} catch (SQLException e) {
LOGGER.error("Error al intentar conseguir todos los CalculoFondo", e);
}
return calculoFondoList;
}
@@ -73,7 +78,7 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
@Override
public List<CalculoFondo> getByCaja(Caja caja) {
List<CalculoFondo> calculoFondoList = new ArrayList<>();
if(Caja.EMPTY == caja){
if (Caja.EMPTY == caja) {
return calculoFondoList;
}
@@ -95,6 +100,7 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
}
}
} catch (SQLException e) {
LOGGER.error("Error al intentar conseguir los CalculoFondo de la caja " + caja, e);
}
return calculoFondoList;
}
@@ -120,6 +126,7 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
}
}
} catch (SQLException e) {
LOGGER.error("Error al intentar conseguir un CalculoFondo por su id " + id, e);
}
return Optional.ofNullable(calculoFondo);
}
@@ -143,6 +150,7 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
}
}
} catch (SQLException e) {
LOGGER.error("Error al intentar conseguir el total de calculo fondo de la caja " + caja, e);
}
return sum;
@@ -166,6 +174,7 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
}
}
} catch (SQLException e) {
LOGGER.error("Error al intentar insertar el CalculoFondo " + calculoFondo, e);
}
}
@@ -182,6 +191,7 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
ps.executeUpdate();
}
} catch (SQLException e) {
LOGGER.error("Error al intentar actualizar el CalculoFondo " + calculoFondo, e);
}
}
@@ -192,9 +202,9 @@ public class SQLiteCalculoFondoDAO implements CalculoFondoDAO {
try (PreparedStatement ps = conn.prepareStatement(query)) {
ps.setInt(1, calculoFondo.getId());
ps.executeUpdate();
}
} catch (SQLException e) {
LOGGER.error("Error al intentar eliminar el CalculoFondo " + calculoFondo, e);
}
}
}