Files
sistema-caja/src/danielcortes/xyz/data/DAOManager.java
Daniel Cortés fab3950e07 Se comenzaron a realizar unit tests
Junto con ello se modificaron las clases para poder hacer la conexion a
una uri diferente para sqlite.
2019-03-30 00:01:31 -03:00

127 lines
4.7 KiB
Java

/*
* MIT License
*
* Copyright (c) 2018-2019 Daniel Cortes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package danielcortes.xyz.data;
import danielcortes.xyz.models.caja.CajaDAO;
import danielcortes.xyz.models.caja.SQLiteCajaDAO;
import danielcortes.xyz.models.calculo_fondo.CalculoFondoDAO;
import danielcortes.xyz.models.calculo_fondo.SQLiteCalculoFondoDAO;
import danielcortes.xyz.models.documentos.DocumentosDAO;
import danielcortes.xyz.models.documentos.SQLiteDocumentosDAO;
import danielcortes.xyz.models.efectivo.EfectivoDAO;
import danielcortes.xyz.models.efectivo.SQLiteEfectivoDAO;
import danielcortes.xyz.models.egreso.EgresoDAO;
import danielcortes.xyz.models.egreso.SQLiteEgresoDAO;
import danielcortes.xyz.models.estado_resultado.EstadoResultadoDAO;
import danielcortes.xyz.models.estado_resultado.SQLiteEstadoResultadoDAO;
import danielcortes.xyz.models.ingreso.IngresoDAO;
import danielcortes.xyz.models.ingreso.SQLiteIngresoDAO;
import danielcortes.xyz.models.tipo_egreso.SQLiteTipoEgresoDAO;
import danielcortes.xyz.models.tipo_egreso.TipoEgresoDAO;
import danielcortes.xyz.models.tipo_ingreso.SQLiteTipoIngresoDAO;
import danielcortes.xyz.models.tipo_ingreso.TipoIngresoDAO;
import danielcortes.xyz.models.version.SQLiteVersionDAO;
import danielcortes.xyz.models.version.VersionDAO;
public class DAOManager {
private static CajaDAO cajaDAO;
private static CalculoFondoDAO calculoFondoDAO;
private static DocumentosDAO documentosDAO;
private static EfectivoDAO efectivoDAO;
private static EgresoDAO egresoDAO;
private static IngresoDAO ingresoDAO;
private static TipoEgresoDAO tipoEgresoDAO;
private static TipoIngresoDAO tipoIngresoDAO;
private static EstadoResultadoDAO estadoResultadoDAO;
private static VersionDAO versionDAO;
public static void setup() {
cajaDAO = new SQLiteCajaDAO();
calculoFondoDAO = new SQLiteCalculoFondoDAO();
documentosDAO = new SQLiteDocumentosDAO();
efectivoDAO = new SQLiteEfectivoDAO();
egresoDAO = new SQLiteEgresoDAO();
ingresoDAO = new SQLiteIngresoDAO();
tipoEgresoDAO = new SQLiteTipoEgresoDAO();
tipoIngresoDAO = new SQLiteTipoIngresoDAO();
estadoResultadoDAO = new SQLiteEstadoResultadoDAO();
versionDAO = new SQLiteVersionDAO();
}
public static void setup(ConnectionHolder connectionHolder){
cajaDAO = new SQLiteCajaDAO(connectionHolder);
calculoFondoDAO = new SQLiteCalculoFondoDAO(connectionHolder);
documentosDAO = new SQLiteDocumentosDAO(connectionHolder);
efectivoDAO = new SQLiteEfectivoDAO(connectionHolder);
egresoDAO = new SQLiteEgresoDAO(connectionHolder);
ingresoDAO = new SQLiteIngresoDAO(connectionHolder);
tipoEgresoDAO = new SQLiteTipoEgresoDAO(connectionHolder);
tipoIngresoDAO = new SQLiteTipoIngresoDAO(connectionHolder);
estadoResultadoDAO = new SQLiteEstadoResultadoDAO(connectionHolder);
versionDAO = new SQLiteVersionDAO(connectionHolder);
}
public static CajaDAO getCajaDAO() {
return cajaDAO;
}
public static CalculoFondoDAO getCalculoFondoDAO() {
return calculoFondoDAO;
}
public static DocumentosDAO getDocumentosDAO() {
return documentosDAO;
}
public static EfectivoDAO getEfectivoDAO() {
return efectivoDAO;
}
public static EgresoDAO getEgresoDAO() {
return egresoDAO;
}
public static IngresoDAO getIngresoDAO() {
return ingresoDAO;
}
public static TipoEgresoDAO getTipoEgresoDAO() {
return tipoEgresoDAO;
}
public static TipoIngresoDAO getTipoIngresoDAO() {
return tipoIngresoDAO;
}
public static EstadoResultadoDAO getEstadoResultadoDAO() {
return estadoResultadoDAO;
}
public static VersionDAO getVersionDAO() {
return versionDAO;
}
}