Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
trismegisto-planilla
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Luis Gangas
trismegisto-planilla
Commits
04eb47a3
Commit
04eb47a3
authored
Nov 07, 2018
by
Juan José Rojas Rojas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ADD] sqlserver to mysql
parent
a8559080
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
244 additions
and
246 deletions
+244
-246
AreaCargoMysqlDAO.java
src/java/trismegistoplanilla/mysqldao/AreaCargoMysqlDAO.java
+2
-2
PersonaMysqlDAO.java
src/java/trismegistoplanilla/mysqldao/PersonaMysqlDAO.java
+85
-86
VacanteMysqlDAO.java
src/java/trismegistoplanilla/mysqldao/VacanteMysqlDAO.java
+2
-2
ConfiguracionFichaService.java
...istoplanilla/servicesMysql/ConfiguracionFichaService.java
+12
-12
PersonaService.java
...ava/trismegistoplanilla/servicesMysql/PersonaService.java
+56
-56
SedeService.java
src/java/trismegistoplanilla/servicesMysql/SedeService.java
+1
-1
TipoDocumentoService.java
...ismegistoplanilla/servicesMysql/TipoDocumentoService.java
+42
-42
ConfiguracionFichaServlet.java
...ismegistoplanilla/servlets/ConfiguracionFichaServlet.java
+0
-1
PersonaServlet.java
src/java/trismegistoplanilla/servlets/PersonaServlet.java
+0
-0
SedeServlet.java
src/java/trismegistoplanilla/servlets/SedeServlet.java
+44
-44
No files found.
src/java/trismegistoplanilla/mysqldao/AreaCargoMysqlDAO.java
View file @
04eb47a3
...
@@ -15,7 +15,7 @@ public class AreaCargoMysqlDAO implements AreaCargoDAO {
...
@@ -15,7 +15,7 @@ public class AreaCargoMysqlDAO implements AreaCargoDAO {
@Override
@Override
public
JSONObject
obtenerAreaCargo
(
AreaBean
a
,
CargoBean
c
)
{
public
JSONObject
obtenerAreaCargo
(
AreaBean
a
,
CargoBean
c
)
{
System
.
out
.
println
(
"AreaCargo
MysqlDAO: obtenerAreaCargo"
);
System
.
out
.
println
(
"AreaCargoMysqlDAO: obtenerAreaCargo"
);
JSONObject
JOObtenerAreaCargo
=
null
;
JSONObject
JOObtenerAreaCargo
=
null
;
ResponseHelper
response
=
new
ResponseHelper
();
ResponseHelper
response
=
new
ResponseHelper
();
...
@@ -75,7 +75,7 @@ public class AreaCargoMysqlDAO implements AreaCargoDAO {
...
@@ -75,7 +75,7 @@ public class AreaCargoMysqlDAO implements AreaCargoDAO {
@Override
@Override
public
JSONObject
asignarAreaCargo
(
JSONObject
datos
)
{
public
JSONObject
asignarAreaCargo
(
JSONObject
datos
)
{
System
.
out
.
println
(
"AreaCargo
MysqlDAO: asignarAreaCargo"
);
System
.
out
.
println
(
"AreaCargoMysqlDAO: asignarAreaCargo"
);
JSONObject
jObject
=
null
;
JSONObject
jObject
=
null
;
ResponseHelper
response
=
new
ResponseHelper
();
ResponseHelper
response
=
new
ResponseHelper
();
Connection
cnx
=
null
;
Connection
cnx
=
null
;
...
...
src/java/trismegistoplanilla/mysqldao/PersonaMysqlDAO.java
View file @
04eb47a3
...
@@ -28,11 +28,14 @@ public class PersonaMysqlDAO implements PersonaDAO {
...
@@ -28,11 +28,14 @@ public class PersonaMysqlDAO implements PersonaDAO {
ResponseHelper
response
=
new
ResponseHelper
();
ResponseHelper
response
=
new
ResponseHelper
();
int
existeNumeroDocumento
=
0
;
int
existeNumeroDocumento
=
0
;
String
sql
=
""
String
sql
=
"SELECT "
+
"select "
+
" count(1) existeNumeroDocumento "
+
"count(1) existeNumeroDocumento "
+
"FROM "
+
"from persona "
+
" personal "
+
"where estado_registro = 1 and codigo_tipo_documento = ? and numero_documento = ?"
;
+
"WHERE "
+
" retirado = 1 "
+
"AND codigo_tipo_documento = ? "
+
"AND dni = ?"
;
Connection
conexion
=
null
;
Connection
conexion
=
null
;
PreparedStatement
ps
=
null
;
PreparedStatement
ps
=
null
;
...
@@ -55,7 +58,7 @@ public class PersonaMysqlDAO implements PersonaDAO {
...
@@ -55,7 +58,7 @@ public class PersonaMysqlDAO implements PersonaDAO {
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
response
.
setStatus
(
false
);
response
.
setStatus
(
false
);
response
.
setMessage
(
"Error: "
+
e
.
getMessage
()
+
"
\n
Error Code: ["
+
e
.
getErrorCode
()
+
"]"
);
response
.
setMessage
(
"Error: "
+
e
.
getMessage
()
+
"
Error Code: ["
+
e
.
getErrorCode
()
+
"]"
);
}
finally
{
}
finally
{
try
{
try
{
if
(
rs
!=
null
)
{
if
(
rs
!=
null
)
{
...
@@ -71,6 +74,7 @@ public class PersonaMysqlDAO implements PersonaDAO {
...
@@ -71,6 +74,7 @@ public class PersonaMysqlDAO implements PersonaDAO {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
jsonObjValidarExistenciaNumeroDocumento
=
new
JSONObject
(
response
);
jsonObjValidarExistenciaNumeroDocumento
=
new
JSONObject
(
response
);
return
jsonObjValidarExistenciaNumeroDocumento
;
return
jsonObjValidarExistenciaNumeroDocumento
;
}
}
...
@@ -82,15 +86,18 @@ public class PersonaMysqlDAO implements PersonaDAO {
...
@@ -82,15 +86,18 @@ public class PersonaMysqlDAO implements PersonaDAO {
ResponseHelper
response
=
new
ResponseHelper
();
ResponseHelper
response
=
new
ResponseHelper
();
int
existeCorreoElectronico
=
0
;
int
existeCorreoElectronico
=
0
;
String
sql
=
""
String
sql
=
"SELECT "
+
"select "
+
" count(1) existeCorreoElectronico "
+
"count(1) existeCorreoElectronico "
+
"FROM "
+
"from persona "
+
" personal "
+
"where estado_registro = 1 and correo = ?"
;
+
"WHERE "
+
" retirado = 0 "
+
"AND email = ?"
;
Connection
conexion
=
null
;
Connection
conexion
=
null
;
PreparedStatement
ps
=
null
;
PreparedStatement
ps
=
null
;
ResultSet
rs
=
null
;
ResultSet
rs
=
null
;
try
{
try
{
conexion
=
MysqlDAOFactory
.
obtenerConexion
(
Variables
.
MYSQL_NUEVO_BD_NAME
);
conexion
=
MysqlDAOFactory
.
obtenerConexion
(
Variables
.
MYSQL_NUEVO_BD_NAME
);
ps
=
conexion
.
prepareStatement
(
sql
);
ps
=
conexion
.
prepareStatement
(
sql
);
...
@@ -108,7 +115,7 @@ public class PersonaMysqlDAO implements PersonaDAO {
...
@@ -108,7 +115,7 @@ public class PersonaMysqlDAO implements PersonaDAO {
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
response
.
setStatus
(
false
);
response
.
setStatus
(
false
);
response
.
setMessage
(
"Error: "
+
e
.
getMessage
()
+
"
\n
Error Code: ["
+
e
.
getErrorCode
()
+
"]"
);
response
.
setMessage
(
"Error: "
+
e
.
getMessage
()
+
"
Error Code: ["
+
e
.
getErrorCode
()
+
"]"
);
}
finally
{
}
finally
{
try
{
try
{
if
(
rs
!=
null
)
{
if
(
rs
!=
null
)
{
...
@@ -124,6 +131,7 @@ public class PersonaMysqlDAO implements PersonaDAO {
...
@@ -124,6 +131,7 @@ public class PersonaMysqlDAO implements PersonaDAO {
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
jsonObjValidarExistenciaCorreoElectronico
=
new
JSONObject
(
response
);
jsonObjValidarExistenciaCorreoElectronico
=
new
JSONObject
(
response
);
return
jsonObjValidarExistenciaCorreoElectronico
;
return
jsonObjValidarExistenciaCorreoElectronico
;
}
}
...
@@ -134,31 +142,32 @@ public class PersonaMysqlDAO implements PersonaDAO {
...
@@ -134,31 +142,32 @@ public class PersonaMysqlDAO implements PersonaDAO {
JSONObject
jsonObjRegistrarPersona
=
null
;
JSONObject
jsonObjRegistrarPersona
=
null
;
ResponseHelper
response
=
new
ResponseHelper
();
ResponseHelper
response
=
new
ResponseHelper
();
String
sqlPersona
=
""
String
sqlPersona
=
"INSERT INTO personal ( "
+
"insert into persona "
+
" apellidoPaterno, "
// apellido_paterno
+
"(apellido_paterno, "
+
" apellidoMaterno, "
// apellido_materno
+
"apellido_materno, "
+
" nombre, "
+
"nombre, "
+
" codigo_tipo_documento, "
+
"codigo_tipo_documento, "
+
" dni, "
// numero_documento
+
"numero_documento, "
+
" email, "
// correo
+
"correo, "
+
" is_default_mail, "
+
"is_default_mail, "
+
" retirado "
// estado_registro
+
"estado_registro) "
+
") "
+
"values "
+
"VALUES "
+
"("
+
" ( "
+
"upper(rtrim(ltrim(?))), "
+
" upper(rtrim(ltrim(?))), "
+
"upper(rtrim(ltrim(?))), "
+
" upper(rtrim(ltrim(?))), "
+
"upper(rtrim(ltrim(?))), "
+
" upper(rtrim(ltrim(?))), "
+
"upper(rtrim(ltrim(?))), "
+
" upper(rtrim(ltrim(?))), "
+
"upper(rtrim(ltrim(?))), "
+
" upper(rtrim(ltrim(?))), "
+
"upper(rtrim(ltrim(?))), "
+
" upper(rtrim(ltrim(?))), "
+
"upper(rtrim(ltrim(?))), "
+
" upper(rtrim(ltrim(?))), "
+
"1)"
;
+
" 0 "
+
" )"
;
Connection
conexion
=
null
;
Connection
conexion
=
null
;
PreparedStatement
psPersona
=
null
,
psFicha
=
null
,
psEstadoFicha
=
null
,
psTokenFicha
=
null
,
psObtenerToken
=
null
,
psObtenerCodigoFicha
=
null
;
PreparedStatement
psPersona
=
null
,
psFicha
=
null
,
psEstadoFicha
=
null
,
psTokenFicha
=
null
,
psObtenerToken
=
null
,
psObtenerCodigoFicha
=
null
;
ResultSet
rsPersona
=
null
,
rsFicha
=
null
,
rsEstadoFicha
=
null
,
rsTokenFicha
=
null
,
rsObtenerToken
=
null
,
rsObtenerCodigoFicha
=
null
;
ResultSet
rsPersona
=
null
,
rsFicha
=
null
,
rsEstadoFicha
=
null
,
rsTokenFicha
=
null
,
rsObtenerToken
=
null
,
rsObtenerCodigoFicha
=
null
;
try
{
try
{
conexion
=
MysqlDAOFactory
.
obtenerConexion
(
Variables
.
MYSQL_NUEVO_BD_NAME
);
conexion
=
MysqlDAOFactory
.
obtenerConexion
(
Variables
.
MYSQL_NUEVO_BD_NAME
);
conexion
.
setAutoCommit
(
false
);
conexion
.
setAutoCommit
(
false
);
...
@@ -178,15 +187,12 @@ public class PersonaMysqlDAO implements PersonaDAO {
...
@@ -178,15 +187,12 @@ public class PersonaMysqlDAO implements PersonaDAO {
int
codigoPersona
=
rsPersona
.
getInt
(
1
);
int
codigoPersona
=
rsPersona
.
getInt
(
1
);
/*-************ REGISTRAR FICHA **************-*/
/*-************ REGISTRAR FICHA **************-*/
String
sqlFicha
=
""
String
sqlFicha
=
"INSERT INTO ficha ( "
+
"insert into ficha ( "
+
" codigo_persona, "
+
"codigo_persona "
+
" estado_registro "
+
",estado_registro "
+
") "
+
") "
+
"values ( "
+
"VALUES "
+
"? "
+
" (?, 1)"
;
+
",1 "
+
")"
;
conexion
.
setAutoCommit
(
false
);
conexion
.
setAutoCommit
(
false
);
psFicha
=
conexion
.
prepareStatement
(
sqlFicha
,
Statement
.
RETURN_GENERATED_KEYS
);
psFicha
=
conexion
.
prepareStatement
(
sqlFicha
,
Statement
.
RETURN_GENERATED_KEYS
);
...
@@ -199,20 +205,15 @@ public class PersonaMysqlDAO implements PersonaDAO {
...
@@ -199,20 +205,15 @@ public class PersonaMysqlDAO implements PersonaDAO {
int
codigoFicha
=
rsFicha
.
getInt
(
1
);
int
codigoFicha
=
rsFicha
.
getInt
(
1
);
/*-************ REGISTRAR ESTADO DE FICHA **************-*/
/*-************ REGISTRAR ESTADO DE FICHA **************-*/
String
sqlEstadoFicha
=
""
String
sqlEstadoFicha
=
"INSERT INTO estado_ficha ( "
+
"insert into estado_ficha ( "
+
" codigo_ficha, "
+
"codigo_ficha "
+
" codigo_tipo_estado_ficha, "
+
",codigo_tipo_estado_ficha "
+
" fecha_registro, "
+
",fecha_registro "
+
" codigo_usuario, "
+
",codigo_usuario "
+
" estado_registro "
+
",estado_registro "
+
") "
+
") VALUES ( "
+
"VALUES "
+
"?, "
+
" (?, 1, NOW(), ?, 1)"
;
+
"1, "
+
"getdate(), "
+
"?, "
+
"1 "
+
")"
;
conexion
.
setAutoCommit
(
false
);
conexion
.
setAutoCommit
(
false
);
psEstadoFicha
=
conexion
.
prepareStatement
(
sqlEstadoFicha
);
psEstadoFicha
=
conexion
.
prepareStatement
(
sqlEstadoFicha
);
...
@@ -222,28 +223,24 @@ public class PersonaMysqlDAO implements PersonaDAO {
...
@@ -222,28 +223,24 @@ public class PersonaMysqlDAO implements PersonaDAO {
if
(
resultRegistrarEstadoFicha
>
0
)
{
if
(
resultRegistrarEstadoFicha
>
0
)
{
/*-************ REGISTRAR TOKEN DE FICHA **************-*/
/*-************ REGISTRAR TOKEN DE FICHA **************-*/
String
sqlTokenFicha
=
""
String
sqlTokenFicha
=
"INSERT INTO token_ficha ( "
+
"insert into token_ficha "
+
" codigo_ficha, "
+
" ( "
+
" codigo_verificacion, "
+
"codigo_ficha "
+
" fecha_creacion, "
+
",codigo_verificacion "
+
" fecha_expiracion, "
+
",fecha_creacion "
+
" token, "
+
",fecha_expiracion "
+
" codigo_sede_area, "
+
",token "
+
" codigo_area_cargo, "
+
",codigo_sede_area"
+
" estado_registro "
+
",codigo_area_cargo"
+
",estado_registro "
+
") "
+
") "
+
"values ( "
+
"VALUES "
+
"? "
+
" ( "
+
",? "
+
" ? ,?, "
+
",getdate() "
+
" now(), "
+
",dateadd(dd, 1, getdate()) "
+
" timestampadd (DAY, 1, now()), "
+
",lower(newid()) "
+
" lower(uuid()) ,? ,?, "
+
",?"
+
" 1 "
+
",?"
+
" )"
;
+
",1 "
+
")"
;
String
CodeVerification
=
GenerateCodeVerification
.
randomString
(
6
);
// almacenar el codigo de verificacion a enviar
String
CodeVerification
=
GenerateCodeVerification
.
randomString
(
6
);
// almacenar el codigo de verificacion a enviar
conexion
.
setAutoCommit
(
false
);
conexion
.
setAutoCommit
(
false
);
...
@@ -260,11 +257,13 @@ public class PersonaMysqlDAO implements PersonaDAO {
...
@@ -260,11 +257,13 @@ public class PersonaMysqlDAO implements PersonaDAO {
int
codigoTokenFicha
=
rsTokenFicha
.
getInt
(
1
);
int
codigoTokenFicha
=
rsTokenFicha
.
getInt
(
1
);
/*-************ OBTENER TOKEN FICHA **************-*/
/*-************ OBTENER TOKEN FICHA **************-*/
String
sqlGetToken
=
""
String
sqlGetToken
=
"SELECT "
+
"select "
+
" token "
+
"token "
+
"FROM "
+
"from token_ficha "
+
" token_ficha "
+
"where codigo_token_ficha = ? and estado_registro = 1"
;
+
"WHERE "
+
" codigo_token_ficha = ? "
+
"AND estado_registro = 1"
;
conexion
.
setAutoCommit
(
false
);
conexion
.
setAutoCommit
(
false
);
psObtenerToken
=
conexion
.
prepareStatement
(
sqlGetToken
);
psObtenerToken
=
conexion
.
prepareStatement
(
sqlGetToken
);
...
@@ -310,7 +309,7 @@ public class PersonaMysqlDAO implements PersonaDAO {
...
@@ -310,7 +309,7 @@ public class PersonaMysqlDAO implements PersonaDAO {
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
response
.
setStatus
(
false
);
response
.
setStatus
(
false
);
response
.
setMessage
(
"Error: "
+
e
.
getMessage
()
+
"
\n
Error Code: ["
+
e
.
getErrorCode
()
+
"]"
);
response
.
setMessage
(
"Error: "
+
e
.
getMessage
()
+
"
Error Code: ["
+
e
.
getErrorCode
()
+
"]"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
response
.
setStatus
(
false
);
response
.
setStatus
(
false
);
...
@@ -406,7 +405,7 @@ public class PersonaMysqlDAO implements PersonaDAO {
...
@@ -406,7 +405,7 @@ public class PersonaMysqlDAO implements PersonaDAO {
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
response
.
setStatus
(
false
);
response
.
setStatus
(
false
);
response
.
setMessage
(
"Error: "
+
e
.
getMessage
()
+
"
\n
Error Code: ["
+
e
.
getErrorCode
()
+
"]"
);
response
.
setMessage
(
"Error: "
+
e
.
getMessage
()
+
"
Error Code: ["
+
e
.
getErrorCode
()
+
"]"
);
}
finally
{
}
finally
{
try
{
try
{
if
(
rs
!=
null
)
{
if
(
rs
!=
null
)
{
...
@@ -460,7 +459,7 @@ public class PersonaMysqlDAO implements PersonaDAO {
...
@@ -460,7 +459,7 @@ public class PersonaMysqlDAO implements PersonaDAO {
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
response
.
setStatus
(
false
);
response
.
setStatus
(
false
);
response
.
setMessage
(
"Error: "
+
e
.
getMessage
()
+
"
\n
Error Code: ["
+
e
.
getErrorCode
()
+
"]"
);
response
.
setMessage
(
"Error: "
+
e
.
getMessage
()
+
"
Error Code: ["
+
e
.
getErrorCode
()
+
"]"
);
}
finally
{
}
finally
{
try
{
try
{
if
(
rsUpdatePersona
!=
null
)
{
if
(
rsUpdatePersona
!=
null
)
{
...
@@ -521,7 +520,7 @@ public class PersonaMysqlDAO implements PersonaDAO {
...
@@ -521,7 +520,7 @@ public class PersonaMysqlDAO implements PersonaDAO {
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
response
.
setStatus
(
false
);
response
.
setStatus
(
false
);
response
.
setMessage
(
"Error: "
+
e
.
getMessage
()
+
"
\n
Error Code: ["
+
e
.
getErrorCode
()
+
"]"
);
response
.
setMessage
(
"Error: "
+
e
.
getMessage
()
+
"
Error Code: ["
+
e
.
getErrorCode
()
+
"]"
);
}
finally
{
}
finally
{
try
{
try
{
if
(
rs
!=
null
)
{
if
(
rs
!=
null
)
{
...
@@ -596,7 +595,7 @@ public class PersonaMysqlDAO implements PersonaDAO {
...
@@ -596,7 +595,7 @@ public class PersonaMysqlDAO implements PersonaDAO {
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
response
.
setStatus
(
false
);
response
.
setStatus
(
false
);
response
.
setMessage
(
"Error: "
+
e
.
getMessage
()
+
"
\n
Error Code: ["
+
e
.
getErrorCode
()
+
"]"
);
response
.
setMessage
(
"Error: "
+
e
.
getMessage
()
+
"
Error Code: ["
+
e
.
getErrorCode
()
+
"]"
);
}
finally
{
}
finally
{
try
{
try
{
if
(
rs
!=
null
)
{
if
(
rs
!=
null
)
{
...
...
src/java/trismegistoplanilla/mysqldao/VacanteMysqlDAO.java
View file @
04eb47a3
...
@@ -332,7 +332,7 @@ public class VacanteMysqlDAO implements VacanteDAO {
...
@@ -332,7 +332,7 @@ public class VacanteMysqlDAO implements VacanteDAO {
+
" vacante.cantidad - ( "
+
" vacante.cantidad - ( "
+
" ( "
+
" ( "
+
" SELECT "
+
" SELECT "
+
" COUNT
(1) "
+
" COUNT(1) "
+
" FROM "
+
" FROM "
+
" ficha_laboral fl "
+
" ficha_laboral fl "
+
" WHERE "
+
" WHERE "
...
@@ -341,7 +341,7 @@ public class VacanteMysqlDAO implements VacanteDAO {
...
@@ -341,7 +341,7 @@ public class VacanteMysqlDAO implements VacanteDAO {
+
" AND fl.codigo_area_cargo = vacante.codigo_area_cargo "
+
" AND fl.codigo_area_cargo = vacante.codigo_area_cargo "
+
" ) + ( "
+
" ) + ( "
+
" SELECT "
+
" SELECT "
+
" COUNT
(1) "
+
" COUNT(1) "
+
" FROM "
+
" FROM "
+
" token_ficha tf "
+
" token_ficha tf "
+
" WHERE "
+
" WHERE "
...
...
src/java/trismegistoplanilla/servicesMysql/ConfiguracionFichaService.java
View file @
04eb47a3
...
@@ -6,17 +6,17 @@ import trismegistoplanilla.dao.DAOFactory;
...
@@ -6,17 +6,17 @@ import trismegistoplanilla.dao.DAOFactory;
public
class
ConfiguracionFichaService
{
public
class
ConfiguracionFichaService
{
DAOFactory
factory
=
DAOFactory
.
getDAOFactory
(
DAOFactory
.
SQL_SERVER
);
DAOFactory
factory
=
DAOFactory
.
getDAOFactory
(
DAOFactory
.
MYSQL
);
ConfiguracionFichaDAO
objConfiguracionFichaDAO
=
factory
.
getConfiguracionFichaDAO
();
ConfiguracionFichaDAO
objConfiguracionFichaDAO
=
factory
.
getConfiguracionFichaDAO
();
public
JSONObject
getDefaultMail
()
{
public
JSONObject
getDefaultMail
()
{
JSONObject
JOmail
=
null
;
JSONObject
JOmail
=
null
;
try
{
try
{
JOmail
=
objConfiguracionFichaDAO
.
getDefaultMail
();
JOmail
=
objConfiguracionFichaDAO
.
getDefaultMail
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
return
JOmail
;
return
JOmail
;
}
}
}
}
src/java/trismegistoplanilla/servicesMysql/PersonaService.java
View file @
04eb47a3
...
@@ -9,67 +9,67 @@ import trismegistoplanilla.dao.PersonaDAO;
...
@@ -9,67 +9,67 @@ import trismegistoplanilla.dao.PersonaDAO;
public
class
PersonaService
{
public
class
PersonaService
{
DAOFactory
factory
=
DAOFactory
.
getDAOFactory
(
DAOFactory
.
SQL_SERVER
);
DAOFactory
factory
=
DAOFactory
.
getDAOFactory
(
DAOFactory
.
MYSQL
);
PersonaDAO
objPersonaDAO
=
factory
.
getPersonaDAO
();
PersonaDAO
objPersonaDAO
=
factory
.
getPersonaDAO
();
public
JSONObject
validarExistenciaNumeroDocumento
(
PersonaBean
p
)
{
public
JSONObject
validarExistenciaNumeroDocumento
(
PersonaBean
p
)
{
JSONObject
jsonObjValidarExistenciaNumeroDocumento
=
null
;
JSONObject
jsonObjValidarExistenciaNumeroDocumento
=
null
;
try
{
try
{
jsonObjValidarExistenciaNumeroDocumento
=
objPersonaDAO
.
validarExistenciaNumeroDocumento
(
p
);
jsonObjValidarExistenciaNumeroDocumento
=
objPersonaDAO
.
validarExistenciaNumeroDocumento
(
p
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
return
jsonObjValidarExistenciaNumeroDocumento
;
return
jsonObjValidarExistenciaNumeroDocumento
;
}
}
public
JSONObject
validarExistenciaCorreoElectronico
(
PersonaBean
p
)
{
public
JSONObject
validarExistenciaCorreoElectronico
(
PersonaBean
p
)
{
JSONObject
jsonObjValidarExistenciaCorreoElectronico
=
null
;
JSONObject
jsonObjValidarExistenciaCorreoElectronico
=
null
;
try
{
try
{
jsonObjValidarExistenciaCorreoElectronico
=
objPersonaDAO
.
validarExistenciaCorreoElectronico
(
p
);
jsonObjValidarExistenciaCorreoElectronico
=
objPersonaDAO
.
validarExistenciaCorreoElectronico
(
p
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
return
jsonObjValidarExistenciaCorreoElectronico
;
return
jsonObjValidarExistenciaCorreoElectronico
;
}
}
public
JSONObject
registrarPersona
(
PersonaBean
p
,
EstadoFichaBean
ef
,
TokenFichaBean
tf
)
{
public
JSONObject
registrarPersona
(
PersonaBean
p
,
EstadoFichaBean
ef
,
TokenFichaBean
tf
)
{
JSONObject
jsonObjRegistrarPersona
=
null
;
JSONObject
jsonObjRegistrarPersona
=
null
;
try
{
try
{
jsonObjRegistrarPersona
=
objPersonaDAO
.
registrarPersona
(
p
,
ef
,
tf
);
jsonObjRegistrarPersona
=
objPersonaDAO
.
registrarPersona
(
p
,
ef
,
tf
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
return
jsonObjRegistrarPersona
;
return
jsonObjRegistrarPersona
;
}
}
public
JSONObject
verificarPersona
(
TokenFichaBean
tf
,
PersonaBean
p
)
{
public
JSONObject
verificarPersona
(
TokenFichaBean
tf
,
PersonaBean
p
)
{
JSONObject
jsonObjVerificarPersona
=
null
;
JSONObject
jsonObjVerificarPersona
=
null
;
try
{
try
{
jsonObjVerificarPersona
=
objPersonaDAO
.
verificarPersona
(
tf
,
p
);
jsonObjVerificarPersona
=
objPersonaDAO
.
verificarPersona
(
tf
,
p
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
return
jsonObjVerificarPersona
;
return
jsonObjVerificarPersona
;
}
}
public
JSONObject
obtenerCodigoPersona
(
TokenFichaBean
tf
)
{
public
JSONObject
obtenerCodigoPersona
(
TokenFichaBean
tf
)
{
JSONObject
jsonObjObtenerCodigoPersona
=
null
;
JSONObject
jsonObjObtenerCodigoPersona
=
null
;
try
{
try
{
jsonObjObtenerCodigoPersona
=
objPersonaDAO
.
obtenerCodigoPersona
(
tf
);
jsonObjObtenerCodigoPersona
=
objPersonaDAO
.
obtenerCodigoPersona
(
tf
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
return
jsonObjObtenerCodigoPersona
;
return
jsonObjObtenerCodigoPersona
;
}
}
public
JSONObject
obtenerPersonaSession
(
PersonaBean
p
)
{
public
JSONObject
obtenerPersonaSession
(
PersonaBean
p
)
{
JSONObject
jsonObjObtenerPersonaSession
=
null
;
JSONObject
jsonObjObtenerPersonaSession
=
null
;
try
{
try
{
jsonObjObtenerPersonaSession
=
objPersonaDAO
.
obtenerPersonaSession
(
p
);
jsonObjObtenerPersonaSession
=
objPersonaDAO
.
obtenerPersonaSession
(
p
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
return
jsonObjObtenerPersonaSession
;
return
jsonObjObtenerPersonaSession
;
}
}
}
}
src/java/trismegistoplanilla/servicesMysql/SedeService.java
View file @
04eb47a3
...
@@ -7,7 +7,7 @@ import trismegistoplanilla.dao.SedeDAO;
...
@@ -7,7 +7,7 @@ import trismegistoplanilla.dao.SedeDAO;
public
class
SedeService
{
public
class
SedeService
{
DAOFactory
factory
=
DAOFactory
.
getDAOFactory
(
DAOFactory
.
SQL_SERVER
);
DAOFactory
factory
=
DAOFactory
.
getDAOFactory
(
DAOFactory
.
MYSQL
);
SedeDAO
objSedeDAO
=
factory
.
getSedeDAO
();
SedeDAO
objSedeDAO
=
factory
.
getSedeDAO
();
public
JSONObject
listarSede
()
{
public
JSONObject
listarSede
()
{
...
...
src/java/trismegistoplanilla/servicesMysql/TipoDocumentoService.java
View file @
04eb47a3
...
@@ -8,47 +8,47 @@ import trismegistoplanilla.dao.TipoDocumentoDAO;
...
@@ -8,47 +8,47 @@ import trismegistoplanilla.dao.TipoDocumentoDAO;
public
class
TipoDocumentoService
{
public
class
TipoDocumentoService
{
DAOFactory
factory
=
DAOFactory
.
getDAOFactory
(
DAOFactory
.
SQL_SERVER
);
DAOFactory
factory
=
DAOFactory
.
getDAOFactory
(
DAOFactory
.
MYSQL
);
TipoDocumentoDAO
objTipoDocumentoDAO
=
factory
.
getTipoDocumentoDAO
();
TipoDocumentoDAO
objTipoDocumentoDAO
=
factory
.
getTipoDocumentoDAO
();
public
JSONObject
listarTipoDocumento
()
{
public
JSONObject
listarTipoDocumento
()
{
JSONObject
jsonObjListarTipoDocumento
=
null
;
JSONObject
jsonObjListarTipoDocumento
=
null
;
try
{
try
{
jsonObjListarTipoDocumento
=
objTipoDocumentoDAO
.
listarTipoDocumento
();
jsonObjListarTipoDocumento
=
objTipoDocumentoDAO
.
listarTipoDocumento
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
return
jsonObjListarTipoDocumento
;
return
jsonObjListarTipoDocumento
;
}
}
public
JSONObject
validarExistenciaTipoDocumento
(
TipoDocumentoBean
tipoDocumento
)
{
public
JSONObject
validarExistenciaTipoDocumento
(
TipoDocumentoBean
tipoDocumento
)
{
JSONObject
jsonObjValidarExistenciaTipoDocumento
=
null
;
JSONObject
jsonObjValidarExistenciaTipoDocumento
=
null
;
try
{
try
{
jsonObjValidarExistenciaTipoDocumento
=
objTipoDocumentoDAO
.
validarExistenciaTipoDocumento
(
tipoDocumento
);
jsonObjValidarExistenciaTipoDocumento
=
objTipoDocumentoDAO
.
validarExistenciaTipoDocumento
(
tipoDocumento
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
return
jsonObjValidarExistenciaTipoDocumento
;
return
jsonObjValidarExistenciaTipoDocumento
;
}
}
public
JSONObject
obtenerLongitudTipoEntrdadaTipoDocumento
(
TipoDocumentoBean
tipoDocumento
)
{
public
JSONObject
obtenerLongitudTipoEntrdadaTipoDocumento
(
TipoDocumentoBean
tipoDocumento
)
{
JSONObject
jsonObjObtenerLongitudTipoEntrdadaTipoDocumento
=
null
;
JSONObject
jsonObjObtenerLongitudTipoEntrdadaTipoDocumento
=
null
;
try
{
try
{
jsonObjObtenerLongitudTipoEntrdadaTipoDocumento
=
objTipoDocumentoDAO
.
obtenerLongitudTipoEntrdadaTipoDocumento
(
tipoDocumento
);
jsonObjObtenerLongitudTipoEntrdadaTipoDocumento
=
objTipoDocumentoDAO
.
obtenerLongitudTipoEntrdadaTipoDocumento
(
tipoDocumento
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
return
jsonObjObtenerLongitudTipoEntrdadaTipoDocumento
;
return
jsonObjObtenerLongitudTipoEntrdadaTipoDocumento
;
}
}
public
JSONObject
obtenerCodigoTipoDocumento
(
TokenFichaBean
tf
)
{
public
JSONObject
obtenerCodigoTipoDocumento
(
TokenFichaBean
tf
)
{
JSONObject
jsonObjObtenerCodigoTipoDocumento
=
null
;
JSONObject
jsonObjObtenerCodigoTipoDocumento
=
null
;
try
{
try
{
jsonObjObtenerCodigoTipoDocumento
=
objTipoDocumentoDAO
.
obtenerCodigoTipoDocumento
(
tf
);
jsonObjObtenerCodigoTipoDocumento
=
objTipoDocumentoDAO
.
obtenerCodigoTipoDocumento
(
tf
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
return
jsonObjObtenerCodigoTipoDocumento
;
return
jsonObjObtenerCodigoTipoDocumento
;
}
}
}
}
src/java/trismegistoplanilla/servlets/ConfiguracionFichaServlet.java
View file @
04eb47a3
...
@@ -20,7 +20,6 @@ public class ConfiguracionFichaServlet extends HttpServlet {
...
@@ -20,7 +20,6 @@ public class ConfiguracionFichaServlet extends HttpServlet {
if
(
accion
.
equals
(
"getDefaultMail"
))
{
if
(
accion
.
equals
(
"getDefaultMail"
))
{
getDefaultMail
(
request
,
response
);
getDefaultMail
(
request
,
response
);
}
}
}
}
private
void
getDefaultMail
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
private
void
getDefaultMail
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
...
...
src/java/trismegistoplanilla/servlets/PersonaServlet.java
View file @
04eb47a3
This diff is collapsed.
Click to expand it.
src/java/trismegistoplanilla/servlets/SedeServlet.java
View file @
04eb47a3
...
@@ -13,49 +13,49 @@ import trismegistoplanilla.utilities.ParamsValidation;
...
@@ -13,49 +13,49 @@ import trismegistoplanilla.utilities.ParamsValidation;
public
class
SedeServlet
extends
HttpServlet
{
public
class
SedeServlet
extends
HttpServlet
{
private
static
final
long
serialVersionUID
=
-
339375847638215388L
;
private
static
final
long
serialVersionUID
=
-
339375847638215388L
;
@Override
@Override
protected
void
service
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
protected
void
service
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
String
accion
=
request
.
getParameter
(
"accion"
);
String
accion
=
request
.
getParameter
(
"accion"
);
if
(
accion
.
equals
(
"listarSede"
))
{
if
(
accion
.
equals
(
"listarSede"
))
{
listarSede
(
request
,
response
);
listarSede
(
request
,
response
);
}
else
if
(
accion
.
equals
(
"validarExistenciaSede"
))
{
}
else
if
(
accion
.
equals
(
"validarExistenciaSede"
))
{
validarExistenciaSede
(
request
,
response
);
validarExistenciaSede
(
request
,
response
);
}
}
}
}
private
void
listarSede
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
private
void
listarSede
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
response
.
setContentType
(
"application/json"
);
response
.
setContentType
(
"application/json"
);
PrintWriter
out
=
response
.
getWriter
();
PrintWriter
out
=
response
.
getWriter
();
SedeService
service
=
new
SedeService
();
SedeService
service
=
new
SedeService
();
JSONObject
JObjectSede
=
service
.
listarSede
();
JSONObject
JObjectSede
=
service
.
listarSede
();
out
.
print
(
JObjectSede
);
out
.
print
(
JObjectSede
);
}
}
private
void
validarExistenciaSede
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
private
void
validarExistenciaSede
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
ServletException
,
IOException
{
response
.
setContentType
(
"application/json"
);
response
.
setContentType
(
"application/json"
);
PrintWriter
out
=
response
.
getWriter
();
PrintWriter
out
=
response
.
getWriter
();
JSONObject
JObjectValidarExistenciaSede
=
new
JSONObject
();
JSONObject
JObjectValidarExistenciaSede
=
new
JSONObject
();
if
(
request
.
getParameter
(
"codigoSede"
)
==
null
)
{
if
(
request
.
getParameter
(
"codigoSede"
)
==
null
)
{
JObjectValidarExistenciaSede
.
put
(
"message"
,
"Los datos llegaron nulos"
);
JObjectValidarExistenciaSede
.
put
(
"message"
,
"Los datos llegaron nulos"
);
JObjectValidarExistenciaSede
.
put
(
"status"
,
false
);
JObjectValidarExistenciaSede
.
put
(
"status"
,
false
);
out
.
print
(
JObjectValidarExistenciaSede
);
out
.
print
(
JObjectValidarExistenciaSede
);
}
else
{
}
else
{
if
(
ParamsValidation
.
validaSoloNumeros
(
Integer
.
parseInt
(
request
.
getParameter
(
"codigoSede"
))))
{
if
(
ParamsValidation
.
validaSoloNumeros
(
Integer
.
parseInt
(
request
.
getParameter
(
"codigoSede"
))))
{
int
codigoSede
=
Integer
.
parseInt
(
request
.
getParameter
(
"codigoSede"
));
int
codigoSede
=
Integer
.
parseInt
(
request
.
getParameter
(
"codigoSede"
));
SedeBean
s
=
new
SedeBean
();
SedeBean
s
=
new
SedeBean
();
s
.
setCodigoSede
(
codigoSede
);
s
.
setCodigoSede
(
codigoSede
);
SedeService
service
=
new
SedeService
();
SedeService
service
=
new
SedeService
();
JObjectValidarExistenciaSede
=
service
.
validarExistenciaSede
(
s
);
JObjectValidarExistenciaSede
=
service
.
validarExistenciaSede
(
s
);
out
.
print
(
JObjectValidarExistenciaSede
);
out
.
print
(
JObjectValidarExistenciaSede
);
}
else
{
}
else
{
JObjectValidarExistenciaSede
.
put
(
"message"
,
"El codigoSede solo aceptar numeros"
);
JObjectValidarExistenciaSede
.
put
(
"message"
,
"El codigoSede solo aceptar numeros"
);
JObjectValidarExistenciaSede
.
put
(
"status"
,
false
);
JObjectValidarExistenciaSede
.
put
(
"status"
,
false
);
out
.
print
(
JObjectValidarExistenciaSede
);
out
.
print
(
JObjectValidarExistenciaSede
);
}
}
}
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment