Commit 1aa253ee by wrosado

[edit] tipo de usuario

parent 332fecdd
/dist/
\ No newline at end of file
/dist/
/build/
/nbproject/private/
\ No newline at end of file
/* global bootbox */
let nombreTipoUsuario = "";
let codProyectoDetalle = 0;
function activarDesactivarAccion(cod){
return new Promise((resolve, reject) => {
$.ajax({
type: 'POST',
url: "../servlet/TipoUsuarioServlet?accion=activarDesactivarAccion",
dataType: 'json',
data:{
codAccionDetalle: cod
},
success: function (data, textStatus, jqXHR) {
resolve(data);
}, error: function (jqXHR, textStatus, errorThrown) {
reject("Error al listar las asignaciones.");
}
});
}).then(data => {
if (data.status) {
$("#tblDetalleAcciones").DataTable().ajax.reload();
}
});
}
function activarDesactivarTipoUsuario(cod){
return new Promise((resolve, reject) => {
$.ajax({
type: 'POST',
url: "../servlet/TipoUsuarioServlet?accion=activarDesactivarTipoUsuario",
dataType: 'json',
data:{
codProyectoDetalle: cod
},
success: function (data, textStatus, jqXHR) {
resolve(data);
}, error: function (jqXHR, textStatus, errorThrown) {
reject("Error al listar las asignaciones.");
}
});
}).then(data => {
if (data.status) {
$("#tblTipoUsuario").DataTable().ajax.reload();
}
});
}
//tabla de listar acciones
function listarTablaAcciones(cod){
var jsonAcciones = {
"codProyDetalle": cod
};
tablaDetalleAcciones = $("#tblDetalleAcciones").DataTable({
"language": {
"lengthMenu": "Mostrar: _MENU_",
"zeroRecords": "    No se encontraron resultados",
"info": "    Mostrando del _START_ al _END_ de un total de _TOTAL_ Tipos de Usuarios",
"infoEmpty": "    Mostrando 0 de 0 registros",
"search": "Filtrar:",
"loadingRecords": "Cargando...",
"processing": '<span style="width:100%;"><img src="http://www.snacklocal.com/images/ajaxload.gif"></span>',
"scrollY": false,
"paginate": {
"first": "First",
"last": "Last",
"next": "Siguiente",
"previous": "Anterior"
}
},
dom: '<"datatable-scroll"t>r<"datatable-footers"ip>',
"ajax": {
type: 'POST',
"url": '../servlet/TipoUsuarioServlet?accion=listarAcciones',
data: jsonAcciones
},
"bSort": false,
"bFilter": false,
"serverSide": true,
"processing": true,
"aaSorting": [],
"ordering": false,
"bLengthChange": false,
"bInfo": true,
"paging": true,
"iDisplayLength": 5,
"columnDefs": [
{targets: 0, orderable: false, width: "7%", className: "text-center"},
{targets: 1, orderable: false, width: "30%", className: "text-left"},
{targets: 2, orderable: false, width: "10%", className: "text-center"},
{targets: 3, orderable: false, width: "10%", className: "text-center"}
],
"columns": [
{"data": "numeral"},
{"data": "Accion"},
{"data": "estado_detalle",
render: function (data, type, row) {
var retorno;
if (data === 0) {
retorno = "<span class='label label-danger' style='color: white'>INACTIVO</span>";
} else if (data === 1) {
retorno = '<span class="label label-success" style="color: white">ACTIVO</span>';
}
return retorno;
}
},
{"data": "estado_detalle",
render: function (data, type, row) {
var retorno;
if (data === 0) {
retorno = '<span data-toggle="tooltip" title="Activar" style="color:green;cursor:pointer;" class="bttnActivarAccion" style="cursor: pointer"> <i class="glyphicon glyphicon-off text-green-800"></i> &nbsp;&nbsp;&nbsp; </span>';
} else if (data === 1) {
retorno = '<span data-toggle="tooltip" title="Desactivar" style="color:red;cursor:pointer;" class="bttnDesactivarAccion" style="cursor: pointer"> <i class="glyphicon glyphicon-off text-red-800"></i> &nbsp;&nbsp;&nbsp; </span>';
}
return retorno;
}
}
]
});
obtenener_data_tablaAcciones("#tblDetalleAcciones tbody",tablaDetalleAcciones);
}
var obtenener_data_tablaAcciones = function(tbody, tabla){
var table = $('#tblDetalleAcciones').DataTable();
$('#tblDetalleAcciones tbody').off('click');
$("tbody").on('click', '.bttnDesactivarAccion', function() {
var data = tabla.row($(this).parents('tr')).data();
activarDesactivarAccion(data.cod_accion_detalle);
});
$("tbody").on('click', '.bttnActivarAccion', function() {
var data = tabla.row($(this).parents('tr')).data();
activarDesactivarAccion(data.cod_accion_detalle);
});
}
//cargar el combo de tipo de usuario dependiendo del proyecto elegido
$("#cboProyectos").on("change", function(){
let codProy = $("#cboProyectos").val();
if(codProy != 0){
cargarTiposUsuarioPorProyecto(parseInt(codProy));
}
});
function segundaCarga() {
datosTipoUsuario.listarTipoUsuario();
cargarProyectos();
//datosTipoUsuario.listarTipoUsuario();
soloLetras('txtTipoDeUsuario');
editarTipoUsuario();
desactivarTipoUsuario();
activarTipoUsuario();
submitKey('formTipoUsuario', '#btnBuscar');
}
function cargarProyectos(){
return new Promise((resolve, reject) => {
$.ajax({
type: 'POST',
url: '../servlet/TipoUsuarioServlet?accion=listarProyectos',
dataType: "json",
success: function (data, textStatus, jqXHR) {
resolve(data);
},
error: function (jqXHR, textStatus, errorThrown) {
reject('Error en la petición');
}
});
})
.then(data => {
let print = '';
if (data.status) {
let print = "";
print += '<option value="0">[TODOS]</option>';
var lista = data.data;
lista.forEach(v => {
print += '<option value="' + v.codigoProyecto +'">'+v.nombreProyecto+'</option>';
});
$("#cboProyectos").html(print);
$("#cboProyectos").prop("disabled", false);
}
});
}
function cargarTiposUsuarioPorProyecto(codigoProyecto){
return new Promise((resolve, reject) => {
$.ajax({
type: 'POST',
url: '../servlet/TipoUsuarioServlet?accion=listarTiposUsuarios',
dataType: "json",
data: {
codigoProy:codigoProyecto
},
success: function (data, textStatus, jqXHR) {
resolve(data);
},
error: function (jqXHR, textStatus, errorThrown) {
reject('Error en la petición');
}
});
})
.then(data => {
let print = '';
if (data.status) {
let print = "";
print += '<option value="0">[TODOS]</option>';
var lista = data.data;
lista.forEach(v => {
print += '<option value="' + v.codTipoUsuario +'">'+v.nomTipoUsuario+'</option>';
});
$("#cboTipoUsuarios").html(print);
}
});
}
var datosTipoUsuario = {listarTipoUsuario: function () {
var filtro = $('#txtTipoDeUsuario').val();
var datosTipoUsuario = {
listarTipoUsuario: function () {
var filtro = $('#cboTipoUsuarios').val();
var cboProyecto = $("#cboProyectos").val();
var tipoFiltrado = 0;
if(filtro == 0 && cboProyecto != 0){
tipoFiltrado = 1;//solo buscara por proyecto
}else if(filtro != 0 && cboProyecto == 0){
tipoFiltrado = 2;//solo buscara por proyecto y tipodeusuario
}
var json = {
"filtro": filtro
"filtro": filtro,
"filtrado":tipoFiltrado,
"valorCboProyecto":cboProyecto
};
$("#tblTipoUsuario").DataTable({
tabla = $("#tblTipoUsuario").DataTable({
"language": {
"lengthMenu": "Mostrar: _MENU_",
"zeroRecords": "&nbsp;&nbsp;&nbsp; No se encontraron resultados",
......@@ -34,7 +271,7 @@
dom: '<"datatable-scroll"t>r<"datatable-footers"ip>',
"ajax": {
type: 'POST',
"url": '../servlet/TipoUsuarioServlet?accion=listarTipoUsuario',
"url": '../servlet/TipoUsuarioServlet?accion=listadoPrincipal',
data: json
},
"bSort": false,
......@@ -49,35 +286,37 @@
"iDisplayLength": 15,
"columnDefs": [
{targets: 0, orderable: false, width: "7%", className: "text-center"},
{targets: 1, orderable: false, width: "20%"},
{targets: 2, orderable: false, width: "10%", className: "text-center"},
{targets: 3, orderable: false, width: "7%", className: "text-center"}
{targets: 1, orderable: false, width: "10%", className: "text-center"},
{targets: 2, orderable: false, width: "20%"},
{targets: 3, orderable: false, width: "10%", className: "text-center"},
{targets: 4, orderable: false, width: "7%", className: "text-center"}
],
"columns": [
{"data": "numeral"},
{"data": "nombreTipoUsuario"},
{"data": "estadoTipoUsuario",
{"data": "Proyecto"},
{"data": "Tipo_Usuario"},
{"data": "est",
render: function (data, type, row) {
var retorno;
if (data === 0) {
if (data === false) {
retorno = "<span class='label label-danger' style='color: white'>INACTIVO</span>";
} else if (data === 1) {
} else if (data === true) {
retorno = '<span class="label label-success" style="color: white">ACTIVO</span>';
}
return retorno;
}
},
{"data": "estadoTipoUsuario", "render": function (data, type, row) {
{"data": "est", "render": function (data, type, row) {
let retorno = ``;
retorno = `
<span data-toggle="tooltip" title="Editar" style="cursor: pointer"> <i class='editar click${row.numeral} glyphicon glyphicon-pencil text-blue-800'></i> &nbsp;&nbsp;&nbsp; </span>`;
if (data === 1) {
if (data === true) {
retorno += `
<span data-toggle="tooltip" title="Desactivar" style="cursor: pointer"> <i class='desactivar icon-user-block text-danger-800'></i> </span>`;
<span data-toggle="tooltip" class="bttnDesactivarTipUsuario" title="Desactivar" style="cursor: pointer"> <i class='desactivar icon-user-block text-danger-800'></i> </span>`;
} else {
retorno += `
<span data-toggle="tooltip" title="Activar" style="cursor: pointer"> <i class='activar icon-user-check text-success-800'></i> </span>`;
<span data-toggle="tooltip" class="bttnActivarTipUsuario" title="Activar" style="cursor: pointer"> <i class='activar icon-user-check text-success-800'></i> </span>`;
}
retorno += `
<span data-toggle="tooltip" title="Detalle" style="cursor: pointer"> <i class='bttnDetalle glyphicon glyphicon-cog text-success-800'></i> </span>`;
return retorno;
}
......@@ -85,9 +324,87 @@
]
});
obtenener_data("#tblTipoUsuario tbody",tabla);
}
};
var obtenener_data = function(tbody, tabla){
var table = $('#tblTipoUsuario').DataTable();
$('#tblTipoUsuario tbody').off('click');
$("tbody").on('click', '.bttnDetalle', function() {
var data = tabla.row($(this).parents('tr')).data();
nombreTipoUsuario = data.Tipo_Usuario;
codProyectoDetalle = data.cod_proyecto_detalle;
modalListadoAcciones(data.cod_proyecto_detalle, data.Tipo_Usuario);
});
$("tbody").on('click', '.bttnActivarTipUsuario', function() {
var data = tabla.row($(this).parents('tr')).data();
activarDesactivarTipoUsuario(data.cod_proyecto_detalle);
});
$("tbody").on('click', '.bttnDesactivarTipUsuario', function() {
var data = tabla.row($(this).parents('tr')).data();
activarDesactivarTipoUsuario(data.cod_proyecto_detalle);
});
}
function modalListadoAcciones(codProyDetalle, nomTipoUsuario){
var listaDetalleAcciones = bootbox.dialog({
title: "<span><i class='ace-icon fa fa-tags'></i> ASIGNAR ACCIONES POR TIPO DE USUARIO</span>",
headerClass: "modal-bg-primary",
className: "tablaListadoAcciones",
size: "large",
message: `<div class="panel panel-primary">
<div class="panel-heading" style="padding: 8px 15px">
<h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="fa fa-list"></i>&nbsp; ${nomTipoUsuario}</h6>
<div class="heading-elements">
<button id="bttnAsignarAcciones" type="button" class="btn bg-slate-600 border-slate-800 btn-xs" onclick="asignarAcciones(${codProyDetalle})"><i class="glyphicon glyphicon-plus"></i>&nbsp; Asignar Acciones</button>
</div>
</div>
<div class="table-responsive">
<table class="table table-responsive table-striped table-hover table-bordered" style ="width: 100%" id="tblDetalleAcciones">
<thead class="">
<tr>
<th class="text-center">Nº</th>
<th class="text-center">ACCIONES</th>
<th class="text-center">ESTADO</th>
<th class="text-center">ACCIONES</th>
</tr>
</thead>
</table>
</div>
</div>`,
buttons: {
si: {
label: "<i class='fa fa-times bigger-110'></i>&nbsp; Cerrar",
className: "btn bg-danger border-danger-600 btn-xs",
callback: function () {
}
}
}
});
listaDetalleAcciones.init(function () {
listarTablaAcciones(codProyDetalle);
});
}
let flagBusqueda = false;
$('#tblTipoUsuario').on('draw.dt', function () {
$('[data-toggle="tooltip"]').tooltip();
......@@ -120,7 +437,8 @@
});
$('#btnLimpiar').click(function () {
$('#txtTipoDeUsuario').val("");
$("#cboProyectos").val("0");
$("#cboTipoUsuarios").val("0");
if (validar !== 0) {
validar.resetForm();
}
......@@ -586,4 +904,140 @@
});
});
}
function listarCboAcciones(){
return new Promise((resolve, reject) => {
$.ajax({
type: 'POST',
url: "../servlet/TipoUsuarioServlet?accion=listarCboAcciones",
dataType: 'json',
success: function (data, textStatus, jqXHR) {
resolve(data);
}, error: function (jqXHR, textStatus, errorThrown) {
reject("Error al listar las asignaciones.");
}
});
}).then(data => {
let print = '';
if (data.status) {
let print = "";
var lista = data.data;
lista.forEach(v => {
print += '<option value="' + v.codAccion +'">'+v.nombreAccion+'</option>';
});
$("#cboListadoAcciones").html(print);
$("#cboListadoAcciones").editableSelect();
}
});
}
function asignarAcciones(codDetalleProyecto){
$(".tablaListadoAcciones").addClass("hide");
var listadoAcciones = bootbox.dialog({
title: "<span><i class='ace-icon fa fa-tags'></i> ASIGNAR ACCION - "+nombreTipoUsuario+"</span>",
headerClass: "modal-bg-primary",
size: "small",
message: `<form id="formCrearTipoUsuario" onsubmit="return false" autocomplete="off">
<div class='col-md-12'>
<div class="form-group">
<label style="font-size: small">
Acciones:
</label>
<span id="spanAterik" class="asterisk"> (*)</span>
<select class="form-control" id="cboListadoAcciones" name="cboListAcciones">
</select>
<br>
<div class="text-right" style="font-size: small">
<span class="text-danger">(*) </span> Campo obligatorio
</div>
</div>
</div>
</form>`,
buttons: {
confirm: {
label: "<i class='fa fa-check bigger-110'></i>&nbsp; Asignar",
className: "btn-primary buttonOk",
callback: function () {
//var cboNomAccion = $('select[name="cboListAcciones"] option:selected').text();
var cboNomAccion = $('#cboListadoAcciones').val();
if(cboNomAccion !== ""){
crearAcciones(codDetalleProyecto,cboNomAccion);
}else{
alert("Tienes que asignar una accion valida.");
$(".tablaListadoAcciones").removeClass("hide");
}
}
},
cancel: {
label: "<i class='fa fa-times bigger-110'></i>&nbsp; Cancelar",
className: "btn-danger",
callback: function () {
$(".tablaListadoAcciones").removeClass("hide");
}
}
}
});
listadoAcciones.init(function () {
//cargar el combo de acciones
listarCboAcciones();
});
}
function crearAcciones(codProyDetalle, accion){
return new Promise((resolve, reject) => {
$.ajax({
type: 'POST',
url: "../servlet/TipoUsuarioServlet?accion=asignarAcciones",
dataType: 'json',
data:{
codigoProyDetalle: codProyDetalle,
nomAccion: accion
},
success: function (data, textStatus, jqXHR) {
resolve(data);
}, error: function (jqXHR, textStatus, errorThrown) {
reject("Error al listar las asignaciones.");
}
});
}).then(data => {
if (data.status) {
bootbox.dialog({
className: "dialogExtraSmall",
title: "<i class='ace-icon fa fa-tags white'></i> <span class='white'>Notificación</span>",
headerClass: "modal-bg-success",
message: data.message,
buttons: {
si: {
label: "<i class='fa fa-check bigger-110'></i>&nbsp; OK",
className: "btn-success",
callback: function () {
//modalListadoAcciones(codProyDetalle, nombreTipoUsuario);
$(".tablaListadoAcciones").removeClass("hide");
$("#tblDetalleAcciones").DataTable().ajax.reload();
}
}
}
});
}else{
bootbox.dialog({
title: "<i class='ace-icon fa fa-exclamation-circle white'></i> <span class='white'>Advertencia</span>",
headerClass: "modal-bg-warning",
message: "Ha ocurrido un error",
buttons: {
si: {
label: "<i class='fa fa-check bigger-110'></i>&nbsp; OK",
className: "btn-warning",
callback: function () {
$(".tablaListadoAcciones").removeClass("hide");
$("#tblDetalleAcciones").DataTable().ajax.reload();
}
}
}
});
}
});
}
......@@ -8,6 +8,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link href="../css/lib/jquery-editable-select.min.css" rel="stylesheet" type="text/css"/>
<%@include file="templates/header.jsp" %>
<!--template-core-->
......@@ -19,7 +20,7 @@
<%@include file="templates/header-body.jsp" %>
<!-- content -->
<div class="row animated fadeIn">
<div class="col-sm-12 col-md-12 col-lg-3 col-centered">
<div class="col-sm-12 col-md-12 col-lg-5 col-centered">
<div class="panel panel-primary card-3" style="margin-top: 30px">
<div class="panel-heading" style="padding: 8px 15px">
<h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="icon icon-search4"></i>&nbsp; Búsqueda de Tipos de Usuario</h6>
......@@ -32,13 +33,27 @@
<div class="panel-body" id="panelSearch">
<form id="formTipoUsuario" onsubmit="return false" autocomplete="off">
<div class="row">
<div class='col-md-12' id="div-busq-tipo">
<div class='col-md-6'>
<div class="form-group">
<label>
Tipo de Usuario:
Proyecto
</label>
<span class="asterisk">(*)</span>
<input type="text" id="txtTipoDeUsuario" name="txtBusqueda" class="form-control" value="" placeholder="INGRESE NOMBRE DEL TIPO DE USUARIO" style="text-transform:uppercase;">
<select class="form-control" id="cboProyectos">
</select>
</div>
</div>
<div class='col-md-6' id="div-busq-tipo">
<div class="form-group">
<label>
Tipo de Usuario:
</label>
<select class="form-control" id="cboTipoUsuarios">
</select>
<!--<span class="asterisk">(*)</span>-->
<!--<input type="text" id="txtTipoDeUsuario" name="txtBusqueda" class="form-control" value="" placeholder="INGRESE NOMBRE DEL TIPO DE USUARIO" style="text-transform:uppercase;">-->
</div>
</div>
</div>
......@@ -64,12 +79,12 @@
</div>
</div>
<div class="col-sm-12 col-md-12 col-lg-9 col-centered">
<div class="col-sm-12 col-md-12 col-lg-10 col-centered">
<div class="panel panel-primary card-3" style="margin-top: 30px">
<div class="panel-heading" style="padding: 8px 15px">
<h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="fa fa-list"></i>&nbsp; Listado de Tipos de Usuario</h6>
<div class="heading-elements">
<button type="button" id="btnNuevoTipoUsuario" class="btn bg-slate border-slate-600 btn-xs"><i class="glyphicon glyphicon-plus"></i>&nbsp;Nuevo Tipo de Usuario</button>
</div>
</div>
<div class="table-responsive">
......@@ -77,7 +92,8 @@
<thead>
<tr>
<th class="text-center"></th>
<th class="text-center">NOMBRE</th>
<th class="text-center">PROYECTO</th>
<th class="text-center">TIPO DE USUARIO</th>
<th class="text-center">ESTADO</th>
<th class="text-center">ACCIONES</th>
</tr>
......@@ -85,11 +101,13 @@
</table>
</div>
</div>
</div>
</div>
</div>
<!-- / content -->
<%@include file="templates/footer-body.jsp" %>
<!--js-->
<script src="../js/lib/jquery-editable-select.min.js" type="text/javascript"></script>
<script src="../js/pages/tipoUsuario.js" type="text/javascript"></script>
<!--js-->
</body>
......
No preview for this file type
......@@ -998,6 +998,7 @@ exists or setup the property manually. For example like this:
</target>
<target depends="init,compile,compile-jsps,-pre-dist,-do-dist-with-manifest,-do-dist-without-manifest" name="do-dist"/>
<target depends="init" if="dist.ear.dir" name="library-inclusion-in-manifest">
<copyfiles files="${file.reference.json-20171018.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.sqljdbc42.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.commons-codec-1.10.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.json-20160212.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
......@@ -1005,6 +1006,7 @@ exists or setup the property manually. For example like this:
<manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update"/>
</target>
<target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir">
<copyfiles files="${file.reference.json-20171018.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.sqljdbc42.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.commons-codec-1.10.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.json-20160212.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
......@@ -1418,32 +1420,32 @@ exists or setup the property manually. For example like this:
<target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
<!--
CLEANUP SECTION
-->
<target depends="init" name="deps-clean" unless="no.deps"/>
<target depends="init" name="do-clean">
<condition property="build.dir.to.clean" value="${build.web.dir}">
<isset property="dist.ear.dir"/>
</condition>
<property name="build.dir.to.clean" value="${build.web.dir}"/>
<delete includeEmptyDirs="true" quiet="true">
<fileset dir="${build.dir.to.clean}/WEB-INF/lib"/>
</delete>
<delete dir="${build.dir}"/>
<available file="${build.dir.to.clean}/WEB-INF/lib" property="status.clean-failed" type="dir"/>
<delete dir="${dist.dir}"/>
</target>
<target depends="do-clean" if="status.clean-failed" name="check-clean">
<echo message="Warning: unable to delete some files in ${build.web.dir}/WEB-INF/lib - they are probably locked by the J2EE server. "/>
<echo level="info" message="To delete all files undeploy the module from Server Registry in Runtime tab and then use Clean again."/>
</target>
<target depends="init" if="netbeans.home" name="undeploy-clean">
<nbundeploy failOnError="false" startServer="false"/>
</target>
<target name="-post-clean">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,undeploy-clean,deps-clean,do-clean,check-clean,-post-clean" description="Clean build products." name="clean"/>
<target depends="clean" description="Clean build products." name="clean-ear"/>
CLEANUP SECTION
-->
<target depends="init" name="deps-clean" unless="no.deps"/>
<target depends="init" name="do-clean">
<condition property="build.dir.to.clean" value="${build.web.dir}">
<isset property="dist.ear.dir"/>
</condition>
<property name="build.dir.to.clean" value="${build.web.dir}"/>
<delete includeEmptyDirs="true" quiet="true">
<fileset dir="${build.dir.to.clean}/WEB-INF/lib"/>
</delete>
<delete dir="${build.dir}"/>
<available file="${build.dir.to.clean}/WEB-INF/lib" property="status.clean-failed" type="dir"/>
<delete dir="${dist.dir}"/>
</target>
<target depends="do-clean" if="status.clean-failed" name="check-clean">
<echo message="Warning: unable to delete some files in ${build.web.dir}/WEB-INF/lib - they are probably locked by the J2EE server. "/>
<echo level="info" message="To delete all files undeploy the module from Server Registry in Runtime tab and then use Clean again."/>
</target>
<target depends="init" if="netbeans.home" name="undeploy-clean">
<nbundeploy failOnError="false" startServer="false"/>
</target>
<target name="-post-clean">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,undeploy-clean,deps-clean,do-clean,check-clean,-post-clean" description="Clean build products." name="clean"/>
<target depends="clean" description="Clean build products." name="clean-ear"/>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
For the purpose of easier reading the script
is divided into following sections:
- initialization
- compilation
- dist
- execution
- debugging
- javadoc
- test compilation
- test execution
- test debugging
- cleanup
-->
<project xmlns:webproject1="http://www.netbeans.org/ns/web-project/1" xmlns:webproject2="http://www.netbeans.org/ns/web-project/2" xmlns:webproject3="http://www.netbeans.org/ns/web-project/3" basedir=".." default="default" name="moduloSeguridad-impl">
<import file="jaxws-build.xml"/>
<import file="ant-deploy.xml"/>
<fail message="Please build using Ant 1.7.1 or higher.">
<condition>
<not>
<antversion atleast="1.7.1"/>
</not>
</condition>
</fail>
<target depends="dist,javadoc" description="Build whole project." name="default"/>
<!--
INITIALIZATION SECTION
-->
<target name="-pre-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="-pre-init" name="-init-private">
<property file="nbproject/private/private.properties"/>
</target>
<target depends="-pre-init,-init-private" name="-init-user">
<property file="${user.properties.file}"/>
<!-- The two properties below are usually overridden -->
<!-- by the active platform. Just a fallback. -->
<property name="default.javac.source" value="1.4"/>
<property name="default.javac.target" value="1.4"/>
</target>
<target depends="-pre-init,-init-private,-init-user" name="-init-project">
<property file="nbproject/project.properties"/>
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" if="dist.ear.dir" name="-do-ear-init"/>
<target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
<condition property="have.tests">
<or>
<available file="${test.src.dir}"/>
</or>
</condition>
<condition property="have.sources">
<or>
<available file="${src.dir}"/>
</or>
</condition>
<condition property="netbeans.home+have.tests">
<and>
<isset property="netbeans.home"/>
<isset property="have.tests"/>
</and>
</condition>
<condition property="no.javadoc.preview">
<isfalse value="${javadoc.preview}"/>
</condition>
<property name="javac.compilerargs" value=""/>
<condition property="no.deps">
<and>
<istrue value="${no.dependencies}"/>
</and>
</condition>
<condition property="no.dist.ear.dir">
<not>
<isset property="dist.ear.dir"/>
</not>
</condition>
<property name="build.web.excludes" value="${build.classes.excludes}"/>
<condition property="do.compile.jsps">
<istrue value="${compile.jsps}"/>
</condition>
<condition property="do.debug.server">
<or>
<not>
<isset property="debug.server"/>
</not>
<istrue value="${debug.server}"/>
<and>
<not>
<istrue value="${debug.server}"/>
</not>
<not>
<istrue value="${debug.client}"/>
</not>
</and>
</or>
</condition>
<condition property="do.debug.client">
<istrue value="${debug.client}"/>
</condition>
<condition property="do.display.browser">
<istrue value="${display.browser}"/>
</condition>
<condition property="do.display.browser.debug.old">
<and>
<isset property="do.display.browser"/>
<not>
<isset property="do.debug.client"/>
</not>
<not>
<isset property="browser.context"/>
</not>
</and>
</condition>
<condition property="do.display.browser.debug">
<and>
<isset property="do.display.browser"/>
<not>
<isset property="do.debug.client"/>
</not>
<isset property="browser.context"/>
</and>
</condition>
<available file="${conf.dir}/MANIFEST.MF" property="has.custom.manifest"/>
<available file="${persistence.xml.dir}/persistence.xml" property="has.persistence.xml"/>
<condition property="do.war.package.with.custom.manifest">
<isset property="has.custom.manifest"/>
</condition>
<condition property="do.war.package.without.custom.manifest">
<not>
<isset property="has.custom.manifest"/>
</not>
</condition>
<condition property="do.tmp.war.package.with.custom.manifest">
<and>
<isset property="has.custom.manifest"/>
<or>
<isfalse value="${directory.deployment.supported}"/>
<isset property="dist.ear.dir"/>
</or>
</and>
</condition>
<condition property="do.tmp.war.package.without.custom.manifest">
<and>
<not>
<isset property="has.custom.manifest"/>
</not>
<or>
<isfalse value="${directory.deployment.supported}"/>
<isset property="dist.ear.dir"/>
</or>
</and>
</condition>
<condition property="do.tmp.war.package">
<or>
<isfalse value="${directory.deployment.supported}"/>
<isset property="dist.ear.dir"/>
</or>
</condition>
<property name="build.meta.inf.dir" value="${build.web.dir}/META-INF"/>
<condition else="" property="application.args.param" value="${application.args}">
<and>
<isset property="application.args"/>
<not>
<equals arg1="${application.args}" arg2="" trim="true"/>
</not>
</and>
</condition>
<property name="source.encoding" value="${file.encoding}"/>
<condition property="javadoc.encoding.used" value="${javadoc.encoding}">
<and>
<isset property="javadoc.encoding"/>
<not>
<equals arg1="${javadoc.encoding}" arg2=""/>
</not>
</and>
</condition>
<property name="javadoc.encoding.used" value="${source.encoding}"/>
<property name="includes" value="**"/>
<property name="excludes" value=""/>
<property name="runmain.jvmargs" value=""/>
<path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
<condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
<and>
<isset property="endorsed.classpath"/>
<length length="0" string="${endorsed.classpath}" when="greater"/>
</and>
</condition>
<condition else="false" property="jdkBug6558476">
<and>
<matches pattern="1\.[56]" string="${java.specification.version}"/>
<not>
<os family="unix"/>
</not>
</and>
</condition>
<property name="javac.fork" value="${jdkBug6558476}"/>
<condition property="junit.available">
<or>
<available classname="org.junit.Test" classpath="${run.test.classpath}"/>
<available classname="junit.framework.Test" classpath="${run.test.classpath}"/>
</or>
</condition>
<condition property="testng.available">
<available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/>
</condition>
<condition property="junit+testng.available">
<and>
<istrue value="${junit.available}"/>
<istrue value="${testng.available}"/>
</and>
</condition>
<condition else="testng" property="testng.mode" value="mixed">
<istrue value="${junit+testng.available}"/>
</condition>
<condition else="" property="testng.debug.mode" value="-mixed">
<istrue value="${junit+testng.available}"/>
</condition>
</target>
<target depends="init" name="-init-cos" unless="deploy.on.save">
<condition property="deploy.on.save" value="true">
<or>
<istrue value="${j2ee.deploy.on.save}"/>
<istrue value="${j2ee.compile.on.save}"/>
</or>
</condition>
</target>
<target name="-post-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
<fail unless="src.dir">Must set src.dir</fail>
<fail unless="test.src.dir">Must set test.src.dir</fail>
<fail unless="build.dir">Must set build.dir</fail>
<fail unless="build.web.dir">Must set build.web.dir</fail>
<fail unless="build.generated.dir">Must set build.generated.dir</fail>
<fail unless="dist.dir">Must set dist.dir</fail>
<fail unless="build.classes.dir">Must set build.classes.dir</fail>
<fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
<fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
<fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
<fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
<fail unless="dist.war">Must set dist.war</fail>
<condition property="missing.j2ee.server.home">
<and>
<matches pattern="j2ee.server.home" string="${j2ee.platform.classpath}"/>
<not>
<isset property="j2ee.server.home"/>
</not>
</and>
</condition>
<fail if="missing.j2ee.server.home">
The Java EE server classpath is not correctly set up - server home directory is missing.
Either open the project in the IDE and assign the server or setup the server classpath manually.
For example like this:
ant -Dj2ee.server.home=&lt;app_server_installation_directory&gt;
</fail>
<fail unless="j2ee.platform.classpath">
The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}.
Either open the project in the IDE and assign the server or setup the server classpath manually.
For example like this:
ant -Duser.properties.file=&lt;path_to_property_file&gt; (where you put the property "j2ee.platform.classpath" in a .properties file)
or ant -Dj2ee.platform.classpath=&lt;server_classpath&gt; (where no properties file is used)
</fail>
</target>
<target name="-init-macrodef-property">
<macrodef name="property" uri="http://www.netbeans.org/ns/web-project/1">
<attribute name="name"/>
<attribute name="value"/>
<sequential>
<property name="@{name}" value="${@{value}}"/>
</sequential>
</macrodef>
</target>
<target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
<macrodef name="javac" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${src.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/>
<attribute default="${javac.processorpath}" name="processorpath"/>
<attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="${javac.debug}" name="debug"/>
<attribute default="${empty.dir}" name="gensrcdir"/>
<element name="customize" optional="true"/>
<sequential>
<property location="${build.dir}/empty" name="empty.dir"/>
<mkdir dir="${empty.dir}"/>
<mkdir dir="@{apgeneratedsrcdir}"/>
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" srcdir="@{srcdir}" target="${javac.target}">
<src>
<dirset dir="@{gensrcdir}" erroronmissingdir="false">
<include name="*"/>
</dirset>
</src>
<classpath>
<path path="@{classpath}"/>
</classpath>
<compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
<compilerarg line="${javac.compilerargs}"/>
<compilerarg value="-processorpath"/>
<compilerarg path="@{processorpath}:${empty.dir}"/>
<compilerarg line="${ap.processors.internal}"/>
<compilerarg value="-s"/>
<compilerarg path="@{apgeneratedsrcdir}"/>
<compilerarg line="${ap.proc.none.internal}"/>
<customize/>
</javac>
</sequential>
</macrodef>
</target>
<target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
<macrodef name="javac" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${src.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/>
<attribute default="${javac.processorpath}" name="processorpath"/>
<attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="${javac.debug}" name="debug"/>
<attribute default="${empty.dir}" name="gensrcdir"/>
<element name="customize" optional="true"/>
<sequential>
<property location="${build.dir}/empty" name="empty.dir"/>
<mkdir dir="${empty.dir}"/>
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" srcdir="@{srcdir}" target="${javac.target}">
<src>
<dirset dir="@{gensrcdir}" erroronmissingdir="false">
<include name="*"/>
</dirset>
</src>
<classpath>
<path path="@{classpath}"/>
</classpath>
<compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
<compilerarg line="${javac.compilerargs}"/>
<customize/>
</javac>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
<macrodef name="depend" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${src.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/>
<sequential>
<depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
<classpath>
<path path="@{classpath}"/>
</classpath>
</depend>
</sequential>
</macrodef>
<macrodef name="force-recompile" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${build.classes.dir}" name="destdir"/>
<sequential>
<fail unless="javac.includes">Must set javac.includes</fail>
<pathconvert pathsep="${line.separator}" property="javac.includes.binary">
<path>
<filelist dir="@{destdir}" files="${javac.includes}"/>
</path>
<globmapper from="*.java" to="*.class"/>
</pathconvert>
<tempfile deleteonexit="true" property="javac.includesfile.binary"/>
<echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/>
<delete>
<files includesfile="${javac.includesfile.binary}"/>
</delete>
<delete file="${javac.includesfile.binary}"/>
</sequential>
</macrodef>
</target>
<target if="${junit.available}" name="-init-macrodef-junit-init">
<condition else="false" property="nb.junit.batch" value="true">
<and>
<istrue value="${junit.available}"/>
<not>
<isset property="test.method"/>
</not>
</and>
</condition>
<condition else="false" property="nb.junit.single" value="true">
<and>
<istrue value="${junit.available}"/>
<isset property="test.method"/>
</and>
</condition>
</target>
<target name="-init-test-properties">
<property name="test.binaryincludes" value="&lt;nothing&gt;"/>
<property name="test.binarytestincludes" value=""/>
<property name="test.binaryexcludes" value=""/>
</target>
<target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}">
<macrodef name="junit" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element name="customize" optional="true"/>
<sequential>
<junit dir="${basedir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${java.io.tmpdir}">
<test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg value="-ea"/>
<customize/>
</junit>
</sequential>
</macrodef>
</target>
<target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
<macrodef name="junit" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element name="customize" optional="true"/>
<sequential>
<property name="run.jvmargs.ide" value=""/>
<junit dir="${basedir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}">
<batchtest todir="${build.test.results.dir}">
<fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
<fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
<filename name="${test.binarytestincludes}"/>
</fileset>
</batchtest>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg value="-ea"/>
<jvmarg line="${run.jvmargs.ide}"/>
<customize/>
</junit>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/>
<target if="${testng.available}" name="-init-macrodef-testng">
<macrodef name="testng" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element name="customize" optional="true"/>
<sequential>
<condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}">
<isset property="test.method"/>
</condition>
<union id="test.set">
<fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
</union>
<taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
<testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="moduloSeguridad" testname="TestNG tests" workingDir="${basedir}">
<xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
<propertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</propertyset>
<customize/>
</testng>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-test-impl">
<macrodef name="test-impl" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element implicit="true" name="customize" optional="true"/>
<sequential>
<echo>No tests executed.</echo>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl">
<macrodef name="test-impl" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element implicit="true" name="customize" optional="true"/>
<sequential>
<webproject2:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
<customize/>
</webproject2:junit>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl">
<macrodef name="test-impl" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element implicit="true" name="customize" optional="true"/>
<sequential>
<webproject2:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
<customize/>
</webproject2:testng>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test">
<macrodef name="test" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<sequential>
<webproject2:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
<customize>
<classpath>
<path path="${run.test.classpath}:${j2ee.platform.classpath}:${j2ee.platform.embeddableejb.classpath}"/>
</classpath>
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg line="${runmain.jvmargs}"/>
</customize>
</webproject2:test-impl>
</sequential>
</macrodef>
</target>
<target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}">
<macrodef name="junit-debug" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element name="customize" optional="true"/>
<sequential>
<junit dir="${basedir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${java.io.tmpdir}">
<test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg value="-ea"/>
<jvmarg line="${debug-args-line}"/>
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
<customize/>
</junit>
</sequential>
</macrodef>
</target>
<target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch">
<macrodef name="junit-debug" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element name="customize" optional="true"/>
<sequential>
<property name="run.jvmargs.ide" value=""/>
<junit dir="${basedir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}">
<batchtest todir="${build.test.results.dir}">
<fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
<fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
<filename name="${test.binarytestincludes}"/>
</fileset>
</batchtest>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg value="-ea"/>
<jvmarg line="${run.jvmargs.ide}"/>
<jvmarg line="${debug-args-line}"/>
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
<customize/>
</junit>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
<macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<element implicit="true" name="customize" optional="true"/>
<sequential>
<webproject2:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
<customize/>
</webproject2:junit-debug>
</sequential>
</macrodef>
</target>
<target if="${testng.available}" name="-init-macrodef-testng-debug">
<macrodef name="testng-debug" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${main.class}" name="testClass"/>
<attribute default="" name="testMethod"/>
<element name="customize2" optional="true"/>
<sequential>
<condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}">
<isset property="test.method"/>
</condition>
<condition else="-suitename moduloSeguridad -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
<matches pattern=".*\.xml" string="@{testClass}"/>
</condition>
<delete dir="${build.test.results.dir}" quiet="true"/>
<mkdir dir="${build.test.results.dir}"/>
<webproject1:debug args="${testng.cmd.args}" classname="org.testng.TestNG" classpath="${debug.test.classpath}:${j2ee.platform.embeddableejb.classpath}">
<customize>
<customize2/>
<jvmarg value="-ea"/>
<arg line="${testng.debug.mode}"/>
<arg line="-d ${build.test.results.dir}"/>
<arg line="-listener org.testng.reporters.VerboseReporter"/>
</customize>
</webproject1:debug>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl">
<macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${main.class}" name="testClass"/>
<attribute default="" name="testMethod"/>
<element implicit="true" name="customize2" optional="true"/>
<sequential>
<webproject2:testng-debug testClass="@{testClass}" testMethod="@{testMethod}">
<customize2/>
</webproject2:testng-debug>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit">
<macrodef name="test-debug" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<attribute default="${main.class}" name="testClass"/>
<attribute default="" name="testMethod"/>
<sequential>
<webproject2:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
<customize>
<classpath>
<path path="${run.test.classpath}:${j2ee.platform.classpath}:${j2ee.platform.embeddableejb.classpath}"/>
</classpath>
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg line="${runmain.jvmargs}"/>
</customize>
</webproject2:test-debug-impl>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng">
<macrodef name="test-debug" uri="http://www.netbeans.org/ns/web-project/2">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<attribute default="" name="testmethods"/>
<attribute default="${main.class}" name="testClass"/>
<attribute default="" name="testMethod"/>
<sequential>
<webproject2:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}">
<customize2>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
</customize2>
</webproject2:testng-debug-impl>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/>
<target name="-init-macrodef-java">
<macrodef name="java" uri="http://www.netbeans.org/ns/web-project/1">
<attribute default="${main.class}" name="classname"/>
<attribute default="${debug.classpath}" name="classpath"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" fork="true">
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg line="${runmain.jvmargs}"/>
<classpath>
<path path="@{classpath}:${j2ee.platform.classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<customize/>
</java>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-nbjsdebug">
<macrodef name="nbjsdebugstart" uri="http://www.netbeans.org/ns/web-project/1">
<attribute default="${client.url}" name="webUrl"/>
<sequential>
<nbjsdebugstart urlPart="${client.urlPart}" webUrl="@{webUrl}"/>
</sequential>
</macrodef>
</target>
<target depends="-init-debug-args" name="-init-macrodef-nbjpda">
<macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/web-project/1">
<attribute default="${main.class}" name="name"/>
<attribute default="${debug.classpath}:${j2ee.platform.classpath}" name="classpath"/>
<sequential>
<nbjpdastart addressproperty="jpda.address" name="@{name}" transport="${debug-transport}">
<classpath>
<path path="@{classpath}"/>
</classpath>
</nbjpdastart>
</sequential>
</macrodef>
<macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/web-project/1">
<attribute default="${build.classes.dir}" name="dir"/>
<sequential>
<nbjpdareload>
<fileset dir="@{dir}" includes="${fix.classes}">
<include name="${fix.includes}*.class"/>
</fileset>
</nbjpdareload>
</sequential>
</macrodef>
<macrodef name="nbjpdaappreloaded" uri="http://www.netbeans.org/ns/web-project/1">
<sequential>
<nbjpdaappreloaded/>
</sequential>
</macrodef>
</target>
<target name="-init-debug-args">
<property name="version-output" value="java version &quot;${ant.java.version}"/>
<condition property="have-jdk-older-than-1.4">
<or>
<contains string="${version-output}" substring="java version &quot;1.0"/>
<contains string="${version-output}" substring="java version &quot;1.1"/>
<contains string="${version-output}" substring="java version &quot;1.2"/>
<contains string="${version-output}" substring="java version &quot;1.3"/>
</or>
</condition>
<condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
<istrue value="${have-jdk-older-than-1.4}"/>
</condition>
<condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
<os family="windows"/>
</condition>
<condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
<isset property="debug.transport"/>
</condition>
</target>
<target depends="-init-debug-args" name="-init-macrodef-debug">
<macrodef name="debug" uri="http://www.netbeans.org/ns/web-project/1">
<attribute default="${main.class}" name="classname"/>
<attribute default="${debug.classpath}:${j2ee.platform.classpath}" name="classpath"/>
<attribute default="${application.args.param}" name="args"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" fork="true">
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg line="${debug-args-line}"/>
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
<jvmarg line="${runmain.jvmargs}"/>
<classpath>
<path path="@{classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<arg line="@{args}"/>
<customize/>
</java>
</sequential>
</macrodef>
</target>
<target name="-init-taskdefs">
<fail unless="libs.CopyLibs.classpath">
The libs.CopyLibs.classpath property is not set up.
This property must point to
org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part
of NetBeans IDE installation and is usually located at
&lt;netbeans_installation&gt;/java&lt;version&gt;/ant/extra folder.
Either open the project in the IDE and make sure CopyLibs library
exists or setup the property manually. For example like this:
ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar
</fail>
<taskdef classpath="${libs.CopyLibs.classpath}" resource="org/netbeans/modules/java/j2seproject/copylibstask/antlib.xml"/>
</target>
<target name="-init-ap-cmdline-properties">
<property name="annotation.processing.enabled" value="true"/>
<property name="annotation.processing.processors.list" value=""/>
<property name="annotation.processing.run.all.processors" value="true"/>
<property name="javac.processorpath" value="${javac.classpath}"/>
<property name="javac.test.processorpath" value="${javac.test.classpath}"/>
<condition property="ap.supported.internal" value="true">
<not>
<matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
</not>
</condition>
</target>
<target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
<condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
<isfalse value="${annotation.processing.run.all.processors}"/>
</condition>
<condition else="" property="ap.proc.none.internal" value="-proc:none">
<isfalse value="${annotation.processing.enabled}"/>
</condition>
</target>
<target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
<property name="ap.cmd.line.internal" value=""/>
</target>
<!--
pre NB7.2 profiling section; consider it deprecated
-->
<target depends="-profile-pre-init, init, -profile-post-init, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/>
<target if="profiler.info.jvmargs.agent" name="-profile-pre-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target if="profiler.info.jvmargs.agent" name="-profile-post-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="-profile-pre-init, init, -profile-post-init" if="profiler.info.jvmargs.agent" name="-profile-init-check">
<fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
<fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
</target>
<!--
end of pre NB7.2 profiling section
-->
<target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-java,-init-macrodef-nbjpda,-init-macrodef-nbjsdebug,-init-macrodef-debug,-init-taskdefs,-init-ap-cmdline" name="init"/>
<!--
COMPILATION SECTION
-->
<target depends="init" if="no.dist.ear.dir" name="deps-module-jar" unless="no.deps"/>
<target depends="init" if="dist.ear.dir" name="deps-ear-jar" unless="no.deps"/>
<target depends="init, deps-module-jar, deps-ear-jar" name="deps-jar" unless="no.deps"/>
<target depends="init,deps-jar,wsimport-client-generate" name="-pre-pre-compile">
<mkdir dir="${build.classes.dir}"/>
</target>
<target name="-pre-compile">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target name="-copy-webdir">
<copy todir="${build.web.dir}">
<fileset dir="${web.docbase.dir}" excludes="${build.web.excludes},${excludes}" includes="${includes}"/>
</copy>
<copy todir="${build.web.dir}/WEB-INF">
<fileset dir="${webinf.dir}" excludes="${build.web.excludes}"/>
</copy>
</target>
<target depends="init, deps-jar, -pre-pre-compile, -pre-compile, -copy-manifest, -copy-persistence-xml, -copy-webdir, library-inclusion-in-archive,library-inclusion-in-manifest" if="have.sources" name="-do-compile">
<webproject2:javac destdir="${build.classes.dir}" gensrcdir="${build.generated.sources.dir}"/>
<copy todir="${build.classes.dir}">
<fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target if="has.custom.manifest" name="-copy-manifest">
<mkdir dir="${build.meta.inf.dir}"/>
<copy todir="${build.meta.inf.dir}">
<fileset dir="${conf.dir}" includes="MANIFEST.MF"/>
</copy>
</target>
<target if="has.persistence.xml" name="-copy-persistence-xml">
<mkdir dir="${build.web.dir}/WEB-INF/classes/META-INF"/>
<copy todir="${build.web.dir}/WEB-INF/classes/META-INF">
<fileset dir="${persistence.xml.dir}" includes="persistence.xml orm.xml"/>
</copy>
</target>
<target name="-post-compile">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
<target name="-pre-compile-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<webproject2:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}"/>
<copy todir="${build.classes.dir}">
<fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
<property name="jspc.schemas" value="/resources/schemas/"/>
<property name="jspc.dtds" value="/resources/dtds/"/>
<target depends="compile" description="Test compile JSP pages to expose compilation errors." if="do.compile.jsps" name="compile-jsps">
<mkdir dir="${build.generated.dir}/src"/>
<java classname="org.netbeans.modules.web.project.ant.JspC" failonerror="true" fork="true">
<arg value="-uriroot"/>
<arg file="${basedir}/${build.web.dir}"/>
<arg value="-d"/>
<arg file="${basedir}/${build.generated.dir}/src"/>
<arg value="-die1"/>
<arg value="-schemas ${jspc.schemas}"/>
<arg value="-dtds ${jspc.dtds}"/>
<arg value="-compilerSourceVM ${javac.source}"/>
<arg value="-compilerTargetVM ${javac.target}"/>
<arg value="-javaEncoding ${source.encoding}"/>
<arg value="-sysClasspath ${libs.jsp-compilation-syscp.classpath}"/>
<classpath path="${java.home}/../lib/tools.jar:${libs.jsp-compiler.classpath}:${libs.jsp-compilation.classpath}"/>
</java>
<mkdir dir="${build.generated.dir}/classes"/>
<webproject2:javac classpath="${build.classes.dir}:${libs.jsp-compilation.classpath}:${javac.classpath}:${j2ee.platform.classpath}" destdir="${build.generated.dir}/classes" srcdir="${build.generated.dir}/src"/>
</target>
<target depends="compile" if="jsp.includes" name="-do-compile-single-jsp">
<fail unless="javac.jsp.includes">Must select some files in the IDE or set javac.jsp.includes</fail>
<mkdir dir="${build.generated.dir}/src"/>
<java classname="org.netbeans.modules.web.project.ant.JspCSingle" failonerror="true" fork="true">
<arg value="-uriroot"/>
<arg file="${basedir}/${build.web.dir}"/>
<arg value="-d"/>
<arg file="${basedir}/${build.generated.dir}/src"/>
<arg value="-die1"/>
<arg value="-schemas ${jspc.schemas}"/>
<arg value="-dtds ${jspc.dtds}"/>
<arg value="-sysClasspath ${libs.jsp-compilation-syscp.classpath}"/>
<arg value="-jspc.files"/>
<arg path="${jsp.includes}"/>
<arg value="-compilerSourceVM ${javac.source}"/>
<arg value="-compilerTargetVM ${javac.target}"/>
<arg value="-javaEncoding ${source.encoding}"/>
<classpath path="${java.home}/../lib/tools.jar:${libs.jsp-compiler.classpath}:${libs.jsp-compilation.classpath}"/>
</java>
<mkdir dir="${build.generated.dir}/classes"/>
<webproject2:javac classpath="${build.classes.dir}:${libs.jsp-compilation.classpath}:${javac.classpath}:${j2ee.platform.classpath}" destdir="${build.generated.dir}/classes" srcdir="${build.generated.dir}/src">
<customize>
<patternset includes="${javac.jsp.includes}"/>
</customize>
</webproject2:javac>
</target>
<target name="compile-single-jsp">
<fail unless="jsp.includes">Must select a file in the IDE or set jsp.includes</fail>
<antcall target="-do-compile-single-jsp"/>
</target>
<!--
DIST BUILDING SECTION
-->
<target name="-pre-dist">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,compile-jsps,-pre-dist" if="do.war.package.without.custom.manifest" name="-do-dist-without-manifest">
<dirname file="${dist.war}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<jar compress="${jar.compress}" jarfile="${dist.war}">
<fileset dir="${build.web.dir}" excludes="WEB-INF/classes/.netbeans_*,${dist.archive.excludes}"/>
</jar>
</target>
<target depends="init,compile,compile-jsps,-pre-dist" if="do.war.package.with.custom.manifest" name="-do-dist-with-manifest">
<dirname file="${dist.war}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<jar compress="${jar.compress}" jarfile="${dist.war}" manifest="${build.meta.inf.dir}/MANIFEST.MF">
<fileset dir="${build.web.dir}" excludes="WEB-INF/classes/.netbeans_*,${dist.archive.excludes}"/>
</jar>
</target>
<target depends="init,compile,compile-jsps,-pre-dist" if="do.tmp.war.package.without.custom.manifest" name="-do-tmp-dist-without-manifest">
<dirname file="${dist.war}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<jar compress="${jar.compress}" jarfile="${dist.war}">
<fileset dir="${build.web.dir}" excludes="WEB-INF/classes/.netbeans_*,${dist.archive.excludes}"/>
</jar>
</target>
<target depends="init,compile,compile-jsps,-pre-dist" if="do.tmp.war.package.with.custom.manifest" name="-do-tmp-dist-with-manifest">
<dirname file="${dist.war}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<jar compress="${jar.compress}" jarfile="${dist.war}" manifest="${build.meta.inf.dir}/MANIFEST.MF">
<fileset dir="${build.web.dir}" excludes="WEB-INF/classes/.netbeans_*,${dist.archive.excludes}"/>
</jar>
</target>
<target depends="init,compile,compile-jsps,-pre-dist,-do-dist-with-manifest,-do-dist-without-manifest" name="do-dist"/>
<target depends="init" if="dist.ear.dir" name="library-inclusion-in-manifest">
<copyfiles files="${file.reference.sqljdbc42.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.commons-codec-1.10.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.json-20160212.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<mkdir dir="${build.web.dir}/META-INF"/>
<manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update"/>
</target>
<target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir">
<copyfiles files="${file.reference.sqljdbc42.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.commons-codec-1.10.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.json-20160212.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
</target>
<target depends="init" if="dist.ear.dir" name="-clean-webinf-lib">
<delete dir="${build.web.dir}/WEB-INF/lib"/>
</target>
<target depends="init,-clean-webinf-lib,compile,compile-jsps,-pre-dist,library-inclusion-in-manifest" if="do.tmp.war.package" name="do-ear-dist">
<dirname file="${dist.ear.war}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<jar compress="${jar.compress}" jarfile="${dist.ear.war}" manifest="${build.web.dir}/META-INF/MANIFEST.MF">
<fileset dir="${build.web.dir}" excludes="WEB-INF/classes/.netbeans_*,${dist.archive.excludes}"/>
</jar>
</target>
<target name="-post-dist">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-dist,do-dist,-post-dist" description="Build distribution (WAR)." name="dist"/>
<target depends="init,-clean-webinf-lib,-init-cos,compile,-pre-dist,do-ear-dist,-post-dist" description="Build distribution (WAR) to be packaged into an EAR." name="dist-ear"/>
<!--
EXECUTION SECTION
-->
<target depends="run-deploy,run-display-browser" description="Deploy to server and show in browser." name="run"/>
<target name="-pre-run-deploy">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target name="-post-run-deploy">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target name="-pre-nbmodule-run-deploy">
<!-- Empty placeholder for easier customization. -->
<!-- This target can be overriden by NetBeans modules. Don't override it directly, use -pre-run-deploy task instead. -->
</target>
<target name="-post-nbmodule-run-deploy">
<!-- Empty placeholder for easier customization. -->
<!-- This target can be overriden by NetBeans modules. Don't override it directly, use -post-run-deploy task instead. -->
</target>
<target name="-run-deploy-am">
<!-- Task to deploy to the Access Manager runtime. -->
</target>
<target depends="init,-init-cos,compile,compile-jsps,-do-compile-single-jsp,-pre-dist,-do-tmp-dist-with-manifest,-do-tmp-dist-without-manifest,-pre-run-deploy,-pre-nbmodule-run-deploy,-run-deploy-nb,-init-deploy-ant,-deploy-ant,-run-deploy-am,-post-nbmodule-run-deploy,-post-run-deploy,-do-update-breakpoints" name="run-deploy"/>
<target if="netbeans.home" name="-run-deploy-nb">
<nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>
</target>
<target name="-init-deploy-ant" unless="netbeans.home">
<property name="deploy.ant.archive" value="${dist.war}"/>
<property name="deploy.ant.docbase.dir" value="${web.docbase.dir}"/>
<property name="deploy.ant.resource.dir" value="${resource.dir}"/>
<property name="deploy.ant.enabled" value="true"/>
</target>
<target depends="dist,-run-undeploy-nb,-init-deploy-ant,-undeploy-ant" name="run-undeploy"/>
<target if="netbeans.home" name="-run-undeploy-nb">
<fail message="Undeploy is not supported from within the IDE"/>
</target>
<target depends="init,-pre-dist,dist,-post-dist" name="verify">
<nbverify file="${dist.war}"/>
</target>
<target depends="run-deploy,-init-display-browser,-display-browser-nb-old,-display-browser-nb,-display-browser-cl" name="run-display-browser"/>
<target if="do.display.browser" name="-init-display-browser">
<condition property="do.display.browser.nb.old">
<and>
<isset property="netbeans.home"/>
<not>
<isset property="browser.context"/>
</not>
</and>
</condition>
<condition property="do.display.browser.nb">
<and>
<isset property="netbeans.home"/>
<isset property="browser.context"/>
</and>
</condition>
<condition property="do.display.browser.cl">
<isset property="deploy.ant.enabled"/>
</condition>
</target>
<target if="do.display.browser.nb.old" name="-display-browser-nb-old">
<nbbrowse url="${client.url}"/>
</target>
<target if="do.display.browser.nb" name="-display-browser-nb">
<nbbrowse context="${browser.context}" url="${client.url}" urlPath="${client.urlPart}"/>
</target>
<target if="do.display.browser.cl" name="-get-browser" unless="browser">
<condition property="browser" value="rundll32">
<os family="windows"/>
</condition>
<condition else="" property="browser.args" value="url.dll,FileProtocolHandler">
<os family="windows"/>
</condition>
<condition property="browser" value="/usr/bin/open">
<os family="mac"/>
</condition>
<property environment="env"/>
<condition property="browser" value="${env.BROWSER}">
<isset property="env.BROWSER"/>
</condition>
<condition property="browser" value="/usr/bin/firefox">
<available file="/usr/bin/firefox"/>
</condition>
<condition property="browser" value="/usr/local/firefox/firefox">
<available file="/usr/local/firefox/firefox"/>
</condition>
<condition property="browser" value="/usr/bin/mozilla">
<available file="/usr/bin/mozilla"/>
</condition>
<condition property="browser" value="/usr/local/mozilla/mozilla">
<available file="/usr/local/mozilla/mozilla"/>
</condition>
<condition property="browser" value="/usr/sfw/lib/firefox/firefox">
<available file="/usr/sfw/lib/firefox/firefox"/>
</condition>
<condition property="browser" value="/opt/csw/bin/firefox">
<available file="/opt/csw/bin/firefox"/>
</condition>
<condition property="browser" value="/usr/sfw/lib/mozilla/mozilla">
<available file="/usr/sfw/lib/mozilla/mozilla"/>
</condition>
<condition property="browser" value="/opt/csw/bin/mozilla">
<available file="/opt/csw/bin/mozilla"/>
</condition>
</target>
<target depends="-get-browser" if="do.display.browser.cl" name="-display-browser-cl">
<fail unless="browser">
Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable.
</fail>
<property name="browse.url" value="${deploy.ant.client.url}${client.urlPart}"/>
<echo>Launching ${browse.url}</echo>
<exec executable="${browser}" spawn="true">
<arg line="${browser.args} ${browse.url}"/>
</exec>
</target>
<target depends="init,-init-cos,compile-single" name="run-main">
<fail unless="run.class">Must select one file in the IDE or set run.class</fail>
<webproject1:java classname="${run.class}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single" name="run-test-with-main">
<fail unless="run.class">Must select one file in the IDE or set run.class</fail>
<webproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
</target>
<target depends="init" if="netbeans.home" name="-do-update-breakpoints">
<webproject1:nbjpdaappreloaded/>
</target>
<!--
DEBUGGING SECTION
-->
<target depends="init,-init-cos,compile,compile-jsps,-do-compile-single-jsp,-pre-dist,-do-tmp-dist-with-manifest,-do-tmp-dist-without-manifest" description="Debug project in IDE." if="netbeans.home" name="debug">
<nbstartserver debugmode="true"/>
<antcall target="connect-debugger"/>
<nbdeploy clientUrlPart="${client.urlPart}" debugmode="true" forceRedeploy="true"/>
<antcall target="debug-display-browser-old"/>
<antcall target="debug-display-browser"/>
<antcall target="connect-client-debugger"/>
</target>
<target if="do.debug.server" name="connect-debugger" unless="is.debugged">
<condition property="listeningcp" value="sourcepath">
<istrue value="${j2ee.compile.on.save}"/>
</condition>
<nbjpdaconnect address="${jpda.address}" host="${jpda.host}" listeningcp="${listeningcp}" name="${name}" transport="${jpda.transport}">
<classpath>
<path path="${debug.classpath}:${j2ee.platform.classpath}"/>
</classpath>
<sourcepath>
<path path="${web.docbase.dir}"/>
</sourcepath>
</nbjpdaconnect>
</target>
<target if="do.display.browser.debug.old" name="debug-display-browser-old">
<nbbrowse url="${client.url}"/>
</target>
<target if="do.display.browser.debug" name="debug-display-browser">
<nbbrowse context="${browser.context}" url="${client.url}" urlPath="${client.urlPart}"/>
</target>
<target if="do.debug.client" name="connect-client-debugger">
<webproject1:nbjsdebugstart webUrl="${client.url}"/>
</target>
<target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
<fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
<webproject1:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
</target>
<target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
<target depends="init,compile,compile-jsps,-do-compile-single-jsp,debug" if="netbeans.home" name="debug-single"/>
<target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
<webproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
</target>
<target depends="init" if="netbeans.home" name="-debug-start-debugger">
<webproject1:nbjpdastart name="${debug.class}"/>
</target>
<target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
<fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
<webproject1:debug classname="${debug.class}"/>
</target>
<target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single-main"/>
<target depends="init" name="-pre-debug-fix">
<fail unless="fix.includes">Must set fix.includes</fail>
<property name="javac.includes" value="${fix.includes}.java"/>
</target>
<target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
<webproject1:nbjpdareload/>
</target>
<target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
<!--
=================
PROFILING SECTION
=================
-->
<!--
pre NB7.2 profiling section; consider it deprecated
-->
<target description="Profile a J2EE project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72">
<condition else="start-profiled-server" property="profiler.startserver.target" value="start-profiled-server-extraargs">
<isset property="profiler.info.jvmargs.extra"/>
</condition>
<antcall target="${profiler.startserver.target}"/>
<antcall target="run"/>
<antcall target="-profile-start-loadgen"/>
</target>
<target if="profiler.info.jvmargs.agent" name="start-profiled-server">
<nbstartprofiledserver forceRestart="${profiler.j2ee.serverForceRestart}" javaPlatform="${profiler.info.javaPlatform}" startupTimeout="${profiler.j2ee.serverStartupTimeout}">
<jvmarg value="${profiler.info.jvmargs.agent}"/>
<jvmarg value="${profiler.j2ee.agentID}"/>
</nbstartprofiledserver>
</target>
<target if="profiler.info.jvmargs.agent" name="start-profiled-server-extraargs">
<nbstartprofiledserver forceRestart="${profiler.j2ee.serverForceRestart}" javaPlatform="${profiler.info.javaPlatform}" startupTimeout="${profiler.j2ee.serverStartupTimeout}">
<jvmarg value="${profiler.info.jvmargs.extra}"/>
<jvmarg value="${profiler.info.jvmargs.agent}"/>
<jvmarg value="${profiler.j2ee.agentID}"/>
</nbstartprofiledserver>
</target>
<target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72">
<fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
<nbprofiledirect>
<classpath>
<path path="${run.test.classpath}"/>
<path path="${j2ee.platform.classpath}"/>
</classpath>
</nbprofiledirect>
<junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true">
<env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
<jvmarg value="${profiler.info.jvmargs.agent}"/>
<jvmarg line="${profiler.info.jvmargs}"/>
<test name="${profile.class}"/>
<classpath>
<path path="${run.test.classpath}"/>
<path path="${j2ee.platform.classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
</junit>
</target>
<target if="netbeans.home" name="-profile-check">
<condition property="profiler.configured">
<or>
<contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/>
<contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/>
</or>
</condition>
</target>
<target depends="init,-init-cos,compile,compile-jsps,-do-compile-single-jsp,-pre-dist,-do-tmp-dist-with-manifest,-do-tmp-dist-without-manifest" name="-do-profile">
<startprofiler/>
<nbstartserver profilemode="true"/>
<nbdeploy clientUrlPart="${client.urlPart}" forceRedeploy="true" profilemode="true"/>
<antcall target="debug-display-browser-old"/>
<antcall target="debug-display-browser"/>
<antcall target="-profile-start-loadgen"/>
</target>
<target depends="-profile-check,-profile-pre72" description="Profile a J2EE project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent">
<antcall target="-do-profile"/>
</target>
<target depends="-profile-test-single-pre72" name="profile-test-single"/>
<target depends="-profile-check" if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs.agent">
<startprofiler/>
<antcall target="test-single"/>
</target>
<target if="profiler.loadgen.path" name="-profile-start-loadgen">
<loadgenstart path="${profiler.loadgen.path}"/>
</target>
<!--
JAVADOC SECTION
-->
<target depends="init" if="have.sources" name="javadoc-build">
<mkdir dir="${dist.javadoc.dir}"/>
<javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
<classpath>
<path path="${javac.classpath}:${j2ee.platform.classpath}"/>
</classpath>
<fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/*.java"/>
</fileset>
<fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
<include name="**/*.java"/>
</fileset>
</javadoc>
<copy todir="${dist.javadoc.dir}">
<fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/doc-files/**"/>
</fileset>
<fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
<include name="**/doc-files/**"/>
</fileset>
</copy>
</target>
<target depends="init,javadoc-build" if="netbeans.home" name="javadoc-browse" unless="no.javadoc.preview">
<nbbrowse file="${dist.javadoc.dir}/index.html"/>
</target>
<target depends="init,javadoc-build,javadoc-browse" description="Build Javadoc." name="javadoc"/>
<!--
TEST COMPILATION SECTION
-->
<target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
<mkdir dir="${build.test.classes.dir}"/>
<property name="j2ee.platform.embeddableejb.classpath" value=""/>
</target>
<target name="-pre-compile-test">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test" if="have.tests" name="-do-compile-test">
<webproject2:javac classpath="${javac.test.classpath}:${j2ee.platform.classpath}:${j2ee.platform.embeddableejb.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-test">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
<target name="-pre-compile-test-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<webproject2:javac classpath="${javac.test.classpath}:${j2ee.platform.classpath}:${j2ee.platform.embeddableejb.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" srcdir="${test.src.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-test-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
<!--
TEST EXECUTION SECTION
-->
<target depends="init" if="have.tests" name="-pre-test-run">
<mkdir dir="${build.test.results.dir}"/>
</target>
<target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
<webproject2:test includes="${includes}" testincludes="**/*Test.java"/>
</target>
<target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
</target>
<target depends="init" if="have.tests" name="test-report"/>
<target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
<target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
<target depends="init" if="have.tests" name="-pre-test-run-single">
<mkdir dir="${build.test.results.dir}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
<fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
<webproject2:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method">
<fail unless="test.class">Must select some files in the IDE or set test.class</fail>
<fail unless="test.method">Must select some method in the IDE or set test.method</fail>
<webproject2:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method">
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/>
<!--
TEST DEBUGGING SECTION
-->
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test">
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
<webproject2:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method">
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
<fail unless="test.method">Must select some method in the IDE or set test.method</fail>
<webproject2:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/>
</target>
<target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
<webproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
</target>
<target depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
<target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/>
<target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
<webproject1:nbjpdareload dir="${build.test.classes.dir}"/>
</target>
<target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
<!--
CLEANUP SECTION
-->
<target depends="init" name="deps-clean" unless="no.deps"/>
<target depends="init" name="do-clean">
<condition property="build.dir.to.clean" value="${build.web.dir}">
<isset property="dist.ear.dir"/>
</condition>
<property name="build.dir.to.clean" value="${build.web.dir}"/>
<delete includeEmptyDirs="true" quiet="true">
<fileset dir="${build.dir.to.clean}/WEB-INF/lib"/>
</delete>
<delete dir="${build.dir}"/>
<available file="${build.dir.to.clean}/WEB-INF/lib" property="status.clean-failed" type="dir"/>
<delete dir="${dist.dir}"/>
</target>
<target depends="do-clean" if="status.clean-failed" name="check-clean">
<echo message="Warning: unable to delete some files in ${build.web.dir}/WEB-INF/lib - they are probably locked by the J2EE server. "/>
<echo level="info" message="To delete all files undeploy the module from Server Registry in Runtime tab and then use Clean again."/>
</target>
<target depends="init" if="netbeans.home" name="undeploy-clean">
<nbundeploy failOnError="false" startServer="false"/>
</target>
<target name="-post-clean">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,undeploy-clean,deps-clean,do-clean,check-clean,-post-clean" description="Clean build products." name="clean"/>
<target depends="clean" description="Clean build products." name="clean-ear"/>
</project>
deploy.ant.properties.file=C:\\Users\\sistem02user\\AppData\\Roaming\\NetBeans\\8.2\\config\\GlassFishEE6\\Properties\\gfv3258829979.properties
file.reference.commons-codec-1.10.jar=D:\\LIBRERIAS\\commons-codec-1.10.jar
file.reference.json-20171018.jar=D:\\LIBRERIAS\\json-20160810.jar
file.reference.sqljdbc42.jar=D:\\LIBRERIAS\\sqljdbc42.jar
j2ee.platform.is.jsr109=true
j2ee.server.domain=C:/Users/sistem02user/AppData/Roaming/NetBeans/8.2/config/GF_4.1.1/domain1
j2ee.server.home=C:/Program Files/glassfish-4.1.1/glassfish
......
......@@ -2,6 +2,10 @@
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group/>
<group>
<file>file:/E:/maven/securityRemake/web/js/pages/tipoUsuario.js</file>
<file>file:/E:/maven/securityRemake/src/java/moduloSeguridad/sqlserverdao/TipoUsuarioSqlServerDAO.java</file>
<file>file:/E:/maven/securityRemake/web/vistas/mantenimientoTipoUsuario.jsp</file>
</group>
</open-files>
</project-private>
......@@ -28,7 +28,10 @@ dist.war=${dist.dir}/${war.name}
endorsed.classpath=\
${libs.javaee-endorsed-api-7.0.classpath}
excludes=
file.reference.json-20160212.jar=D:\\LIBRERIAS\\json-20160212.jar
file.reference.commons-codec-1.10.jar=E:\\LIBRERIAS\\commons-codec-1.10.jar
file.reference.json-20160212.jar=E:\\LIBRERIAS\\json-20160212.jar
file.reference.json-20171018.jar=E:\\LIBRERIAS\\json-20171018.jar
file.reference.sqljdbc42.jar=E:\\LIBRERIAS\\sqljdbc42.jar
includes=**
j2ee.compile.on.save=true
j2ee.copy.static.files.on.save=true
......
......@@ -12,8 +12,22 @@ import org.json.JSONObject;
* @author sistem17user
*/
public interface TipoUsuarioDAO {
public JSONObject listarTipoUsuario(String filtro, int vstart, int vlength, String draw) throws Exception;
public JSONObject listarProyectos() throws Exception;
public JSONObject listarTiposUsuarios(int codigoProyecto) throws Exception;
public JSONObject asignarAcciones(JSONObject datos) throws Exception;
public JSONObject activarDesactivarAccion(JSONObject datos) throws Exception;
public JSONObject activarDesactivarTipoUsuario(JSONObject datos) throws Exception;
public JSONObject listarAcciones(JSONObject datos) throws Exception;
public JSONObject listarCboAcciones() throws Exception;
public JSONObject listadoPrincipal(String filtro, int filtrado, int proyecto, int vstart, int vlength, String draw) throws Exception;
public int activarTipoUsuario(int codigo) throws Exception;
......
......@@ -17,11 +17,81 @@ public class TipoUsuarioService {
DAOFactory fabrica = DAOFactory.getDAOFactory(DAOFactory.SQLSERVER);
TipoUsuarioDAO dao = fabrica.getTipoUsuario();
public JSONObject listarProyectos() {
JSONObject obj = null;
try {
obj = dao.listarProyectos();
} catch (Exception e) {
e.printStackTrace();
}
return obj;
}
public JSONObject listarTiposUsuarios(int codigoProyecto) {
JSONObject obj = null;
try {
obj = dao.listarTiposUsuarios(codigoProyecto);
} catch (Exception e) {
e.printStackTrace();
}
return obj;
}
public JSONObject asignarAcciones(JSONObject datos) {
JSONObject obj = null;
try {
obj = dao.asignarAcciones(datos);
} catch (Exception e) {
e.printStackTrace();
}
return obj;
}
public JSONObject listarAcciones(JSONObject datos) {
JSONObject obj = null;
try {
obj = dao.listarAcciones(datos);
} catch (Exception e) {
e.printStackTrace();
}
return obj;
}
public JSONObject listarCboAcciones() {
JSONObject obj = null;
try {
obj = dao.listarCboAcciones();
} catch (Exception e) {
e.printStackTrace();
}
return obj;
}
public JSONObject activarDesactivarAccion(JSONObject datos) {
JSONObject obj = null;
try {
obj = dao.activarDesactivarAccion(datos);
} catch (Exception e) {
e.printStackTrace();
}
return obj;
}
public JSONObject activarDesactivarTipoUsuario(JSONObject datos) {
JSONObject obj = null;
try {
obj = dao.activarDesactivarTipoUsuario(datos);
} catch (Exception e) {
e.printStackTrace();
}
return obj;
}
public JSONObject listarTipoUsuario(String filtro, int vstart, int vlength, String draw) {
public JSONObject listadoPrincipal(String filtro,int filtrado, int proyecto, int vstart, int vlength, String draw) {
JSONObject obj = null;
try {
obj = dao.listarTipoUsuario(filtro, vstart, vlength, draw);
obj = dao.listadoPrincipal(filtro,filtrado, proyecto, vstart, vlength, draw);
} catch (Exception e) {
e.printStackTrace();
}
......
......@@ -25,11 +25,29 @@ public class TipoUsuarioServlet extends HttpServlet {
response.setContentType("text/html");
String accion = request.getParameter("accion");
switch (accion) {
case "listarTipoUsuario":
listarTipoUsuario(request, response);
case "listarProyectos":
listarProyectos(request, response);
break;
case "activarTipoUsuario":
activarTipoUsuario(request, response);
case "listarTiposUsuarios":
listarTiposUsuarios(request, response);
break;
case "asignarAcciones":
asignarAcciones(request, response);
break;
case "listarAcciones":
listarAcciones(request, response);
break;
case "listarCboAcciones":
listarCboAcciones(request, response);
break;
case "listadoPrincipal":
listadoPrincipal(request, response);
break;
case "activarDesactivarAccion":
activarDesactivarAccion(request, response);
break;
case "activarDesactivarTipoUsuario":
activarDesactivarTipoUsuario(request, response);
break;
case "desactivarTipoUsuario":
desactivarTipoUsuario(request, response);
......@@ -50,16 +68,103 @@ public class TipoUsuarioServlet extends HttpServlet {
break;
}
}
private void listarProyectos(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("application/json");
PrintWriter out = response.getWriter();
TipoUsuarioService service = new TipoUsuarioService();
JSONObject json = service.listarProyectos();
out.println(json);
}
private void listarTiposUsuarios(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("application/json");
PrintWriter out = response.getWriter();
int codigoProyecto = Integer.parseInt(request.getParameter("codigoProy"));
TipoUsuarioService service = new TipoUsuarioService();
JSONObject json = service.listarTiposUsuarios(codigoProyecto);
out.println(json);
}
private void asignarAcciones(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("application/json");
PrintWriter out = response.getWriter();
JSONObject obj = new JSONObject()
.put("codProyectoDetalle", Integer.parseInt(request.getParameter("codigoProyDetalle")))
.put("nomAccion", request.getParameter("nomAccion"));
TipoUsuarioService service = new TipoUsuarioService();
JSONObject json = service.asignarAcciones(obj);
out.println(json);
}
private void activarDesactivarAccion(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("application/json");
PrintWriter out = response.getWriter();
JSONObject obj = new JSONObject().put("codigoAccionDetalle", Integer.parseInt(request.getParameter("codAccionDetalle")));
TipoUsuarioService service = new TipoUsuarioService();
JSONObject json = service.activarDesactivarAccion(obj);
out.println(json);
}
private void activarDesactivarTipoUsuario(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("application/json");
PrintWriter out = response.getWriter();
JSONObject obj = new JSONObject().put("codigoProyectoDetalle", Integer.parseInt(request.getParameter("codProyectoDetalle")));
TipoUsuarioService service = new TipoUsuarioService();
JSONObject json = service.activarDesactivarTipoUsuario(obj);
out.println(json);
}
private void listarCboAcciones(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("application/json");
PrintWriter out = response.getWriter();
TipoUsuarioService service = new TipoUsuarioService();
JSONObject json = service.listarCboAcciones();
out.println(json);
}
private void listarAcciones(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("application/json");
PrintWriter out = response.getWriter();
String draw = request.getParameter("draw");
int vstart = Integer.parseInt(request.getParameter("start"));
int vlength = Integer.parseInt(request.getParameter("length"));
JSONObject obj = new JSONObject()
.put("draw",draw)
.put("start",vstart)
.put("length",vlength)
.put("proyectoDetalle", Integer.parseInt(request.getParameter("codProyDetalle")));
TipoUsuarioService service = new TipoUsuarioService();
JSONObject json = service.listarAcciones(obj);
out.println(json);
}
private void listarTipoUsuario(HttpServletRequest request, HttpServletResponse response) throws IOException {
private void listadoPrincipal(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("application/json");
PrintWriter out = response.getWriter();
TipoUsuarioService service = new TipoUsuarioService();
String filtro = request.getParameter("filtro");
int filtrado = Integer.parseInt(request.getParameter("filtrado"));
int cboProyecto = Integer.parseInt(request.getParameter("valorCboProyecto"));
String draw = request.getParameter("draw");
int vstart = Integer.parseInt(request.getParameter("start"));
int vlength = Integer.parseInt(request.getParameter("length"));
JSONObject json = service.listarTipoUsuario(filtro, vstart, vlength, draw);
JSONObject json = service.listadoPrincipal(filtro, filtrado, cboProyecto, vstart, vlength, draw);
out.println(json);
}
......
......@@ -12,6 +12,7 @@ import java.sql.ResultSet;
import moduloSeguridad.utilities.GeneralMethods;
//import static moduloSeguridad.utilities.GeneralMethods.getMaxSize;
import moduloSeguridad.dao.TipoUsuarioDAO;
import moduloSeguridad.utilities.DAOHelper;
import org.json.JSONArray;
import org.json.JSONObject;
......@@ -20,9 +21,9 @@ import org.json.JSONObject;
* @author sistem17user
*/
public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
@Override
public JSONObject listarTipoUsuario(String filtro, int vstart, int vlength, String draw) throws Exception {
public JSONObject listarProyectos() throws Exception {
String base = "security";
Connection con = null;
PreparedStatement pst = null;
......@@ -31,48 +32,287 @@ public class TipoUsuarioSqlServerDAO implements TipoUsuarioDAO {
String busqueda = "";
JSONObject jsonReturn = new JSONObject();
JSONArray lista = new JSONArray();
int conta = vstart;
try {
if (filtro.equals("")) {
busqueda = "";
} else {
busqueda = " and nom like '%" + filtro + "%'";
query = "select cod_proyecto, nom from proyecto where proyecto.est = 1;";
con = SqlServerDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query);
rs = pst.executeQuery();
while (rs.next()) {
JSONObject obj = new JSONObject();
obj.put("codigoProyecto", rs.getString(1));
obj.put("nombreProyecto", rs.getString(2));
lista.put(obj);
}
query = " select TOP " + vlength + " cod_tipo_usuario, nom, est from tipo_usuario "
+ " where cod_tipo_usuario NOT IN"
+ "( "
+ " SELECT top " + vstart + " "
+ " cod_tipo_usuario from tipo_usuario ORDER BY cod_tipo_usuario ) "
+ " " + busqueda + " ";
jsonReturn.put("data", lista);
jsonReturn.put("status", true);
} catch (Exception e) {
e.printStackTrace();
} finally {
con.close();
pst.close();
}
return jsonReturn;
}
@Override
public JSONObject listarTiposUsuarios(int codigoProyecto) throws Exception {
String base = "security";
Connection con = null;
PreparedStatement pst = null;
ResultSet rs = null;
String query = "";
String busqueda = "";
JSONObject jsonReturn = new JSONObject();
JSONArray lista = new JSONArray();
try {
query = "select proyecto_detalle.cod_tipo_usuario, tipo_usuario.nom\n" +
"from proyecto_detalle \n" +
"inner join tipo_usuario on proyecto_detalle.cod_tipo_usuario = tipo_usuario.cod_tipo_usuario\n" +
"where proyecto_detalle.cod_proyecto = " + codigoProyecto;
con = SqlServerDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query);
rs = pst.executeQuery();
while (rs.next()) {
conta++;
JSONObject obj = new JSONObject();
obj.put("numeral", conta);
obj.put("codigoTipoUsuario", rs.getString(1));
obj.put("nombreTipoUsuario", rs.getString(2));
obj.put("estadoTipoUsuario", rs.getInt(3));
lista.put(obj);
JSONObject obj = new JSONObject();
obj.put("codTipoUsuario", rs.getString(1));
obj.put("nomTipoUsuario", rs.getString(2));
lista.put(obj);
}
int cantRegistro = 0;
String query2 = " select count(*) as cant "
+ " from tipo_usuario "
+ " where 1 = 1 "
+ " " + busqueda + " ";
PreparedStatement pst2 = null;
ResultSet rs2 = null;
jsonReturn.put("data", lista);
jsonReturn.put("status", true);
} catch (Exception e) {
e.printStackTrace();
} finally {
con.close();
pst.close();
}
return jsonReturn;
}
@Override
public JSONObject listadoPrincipal(String filtro, int filtrado, int proyecto, int vstart, int vlength, String draw) throws Exception {
String base = "security";
Connection cnx = null;
String query = "";
JSONArray arrayjson = new JSONArray();
JSONObject response = new JSONObject();
int total = 0;
try {
cnx = SqlServerDAOFactory.getConnectionSQL(base);
String sql = "{CALL SP_TA_GESTIÓN_USUARIO(?,?,?,?,?,?,?,?,?)}";
JSONArray params = new JSONArray()
.put(1)
.put(proyecto)
.put(filtro)
.put(0)
.put(0)
.put(0)
.put(vstart)
.put(vlength)
.put(String.class);
arrayjson = DAOHelper.queryProcedure(cnx, sql, params);
//Obtiene el total de los registros del array que devuelve el procedimiento para el paginado en JS.
if(!arrayjson.getJSONObject(0).isNull("Total")){
total = arrayjson.getJSONObject(0).getInt("Total");
}
response.put("data", arrayjson.length() == 0?new JSONArray():arrayjson);
response.put("draw", draw);
response.put("recordsTotal", total);
response.put("recordsFiltered", total);
response.put("status", true);
response.put("message", "Se ha ejecutado el litado principal correctamente.");
} catch (Exception e) {
e.printStackTrace();
}
return response;
}
@Override
public JSONObject asignarAcciones(JSONObject datos) throws Exception {
String base = "security";
Connection cnx = null;
String query = "";
JSONArray arrayjson = new JSONArray();
JSONObject response = new JSONObject();
String mensaje = "";
try {
cnx = SqlServerDAOFactory.getConnectionSQL(base);
String sql = "{CALL SP_TA_GESTIÓN_USUARIO(?,?,?,?,?,?,?,?,?)}";
JSONArray params = new JSONArray()
.put(3)
.put(0)
.put(0)
.put(datos.getInt("codProyectoDetalle"))
.put(datos.getString("nomAccion"))
.put(0)
.put(0)
.put(0)
.put(String.class);
arrayjson = DAOHelper.queryProcedure(cnx, sql, params);
mensaje = params.getString(0);
response.put("status", true);
response.put("message", mensaje);
} catch (Exception e) {
e.printStackTrace();
}
return response;
}
@Override
public JSONObject listarAcciones(JSONObject datos) throws Exception {
String base = "security";
Connection cnx = null;
String query = "";
JSONArray arrayjson = new JSONArray();
JSONObject response = new JSONObject();
int total = 0;
try {
cnx = SqlServerDAOFactory.getConnectionSQL(base);
String sql = "{CALL SP_TA_GESTIÓN_USUARIO(?,?,?,?,?,?,?,?)}";
JSONArray params = new JSONArray()
.put(2)
.put(0)
.put(0)
.put(datos.getInt("proyectoDetalle"))
.put(0)
.put(0)
.put(datos.getInt("start"))
.put(datos.getInt("length"));
arrayjson = DAOHelper.queryProcedure(cnx, sql, params);
//Obtiene el total de los registros del array que devuelve el procedimiento para el paginado en JS.
if(!arrayjson.getJSONObject(0).isNull("Total")){
total = arrayjson.getJSONObject(0).getInt("Total");
}
response.put("data", arrayjson.length() == 0?new JSONArray():arrayjson);
response.put("draw", datos.getInt("draw"));
response.put("recordsTotal", total);
response.put("recordsFiltered", total);
response.put("status", true);
response.put("message", "Se ha ejecutado el litado de acciones correctamente.");
} catch (Exception e) {
e.printStackTrace();
}
return response;
}
@Override
public JSONObject activarDesactivarAccion(JSONObject datos) throws Exception {
String base = "security";
Connection cnx = null;
String query = "";
JSONArray arrayjson = new JSONArray();
JSONObject response = new JSONObject();
try {
cnx = SqlServerDAOFactory.getConnectionSQL(base);
String sql = "{CALL SP_TA_GESTIÓN_USUARIO(?,?,?,?,?,?,?,?)}";
JSONArray params = new JSONArray()
.put(4)
.put(0)
.put(0)
.put(0)
.put(0)
.put(datos.getInt("codigoAccionDetalle"))
.put(0)
.put(0);
arrayjson = DAOHelper.queryProcedure(cnx, sql, params);
response.put("status", true);
response.put("message", "Se ha cambiado el estado correctamente.");
} catch (Exception e) {
e.printStackTrace();
}
return response;
}
@Override
public JSONObject activarDesactivarTipoUsuario(JSONObject datos) throws Exception {
String base = "security";
Connection cnx = null;
String query = "";
JSONArray arrayjson = new JSONArray();
JSONObject response = new JSONObject();
try {
cnx = SqlServerDAOFactory.getConnectionSQL(base);
String sql = "{CALL SP_TA_GESTIÓN_USUARIO(?,?,?,?,?,?,?,?)}";
JSONArray params = new JSONArray()
.put(5)
.put(0)
.put(0)
.put(datos.getInt("codigoProyectoDetalle"))
.put(0)
.put(0)
.put(0)
.put(0);
arrayjson = DAOHelper.queryProcedure(cnx, sql, params);
response.put("status", true);
response.put("message", "Se ha cambiado el estado correctamente.");
} catch (Exception e) {
e.printStackTrace();
}
return response;
}
@Override
public JSONObject listarCboAcciones() throws Exception {
String base = "security";
Connection con = null;
PreparedStatement pst = null;
ResultSet rs = null;
String query = "";
String busqueda = "";
JSONObject jsonReturn = new JSONObject();
JSONArray lista = new JSONArray();
try {
query = "select *from accion;";
con = SqlServerDAOFactory.getConnectionSQL(base);
pst = con.prepareStatement(query2);
pst = con.prepareStatement(query);
rs = pst.executeQuery();
rs.next();
cantRegistro = rs.getInt("cant");
while (rs.next()) {
JSONObject obj = new JSONObject();
obj.put("codAccion", rs.getString(1));
obj.put("nombreAccion", rs.getString(2));
lista.put(obj);
}
jsonReturn.put("data", lista);
jsonReturn.put("recordsTotal", cantRegistro);
jsonReturn.put("recordsFiltered", cantRegistro);
jsonReturn.put("draw", draw);
jsonReturn.put("status", true);
} catch (Exception e) {
e.printStackTrace();
} finally {
......
package moduloSeguridad.utilities;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Types;
import org.json.JSONArray;
import org.json.JSONObject;
public final class DAOHelper {
//********************************************** STATEMENT **************************************************************
public static JSONArray queryPS(Connection connection, String query, JSONArray... params) throws Exception {
return queryPS(connection, query, false, params);
}
public static JSONArray queryPS(Connection connection, String query, boolean mode, JSONArray... params) throws Exception {
JSONArray list = new JSONArray();
try (PreparedStatement ps = connection.prepareStatement(query);){
if (params != null && params.length > 0) {
JSONArray _params = params[0];
int index = 1;
//Recorremos la lista de parametros y lo seteamos en el preparedstatement
for (Object p : _params) {
setPreparedStatement(ps, index++, p);
}
}
System.out.println("Query ejecutado con queryPS ---->>> " + ps);
ResultSet rs = ps.executeQuery();
ResultSetMetaData rm = rs.getMetaData();
int numCols = rm.getColumnCount();
while (rs.next()) {
JSONObject obj = new JSONObject();
for (int i = 1; i <= numCols; i++) {
setJSONObject(rs, rm, i, obj, mode);
}
list.put(obj);
}
} catch (Exception ex) {
ex.printStackTrace();
System.out.println(""+ex.getMessage());
throw ex;
}
return list;
}
public static JSONObject executePS(Connection connection, String query, JSONArray... params) {
JSONObject obj = new JSONObject();
try (PreparedStatement ps = connection.prepareStatement(query);){
if (params != null && params.length > 0) {
JSONArray _params = params[0];
int index = 1;
for (Object parametro : _params) {
setPreparedStatement(ps, index++, parametro);
}
}
int filas = ps.executeUpdate();
obj.put("status", filas > 0);
obj.put("message", "OK");
obj.put("data", filas);
} catch (Exception ex) {
ex.printStackTrace();
obj.put("status", false);
obj.put("message", ex);
obj.put("data", JSONObject.NULL);
}
return obj;
}
//*************************************** PROCEDIMIENTOS ALMACENADOS ****************************************************
public static JSONArray queryProcedure(Connection cn, String query, JSONArray... parameters) throws Exception {
return queryProcedure(cn, query, false, parameters);
}
public static JSONArray queryProcedure(Connection cn, String query, boolean mode, JSONArray... parameters) throws Exception {
JSONArray result = new JSONArray();
JSONObject outputParamTypes = new JSONObject();
JSONArray params = null;
try (CallableStatement cs = cn.prepareCall(query);){
if (parameters != null && parameters.length > 0) {
params = parameters[0];
int index = 1;
for (Object parameter : params) {
if (parameter instanceof Class) {
registerOutputParameter(cs, index++, parameter, outputParamTypes);
} else {
setPreparedStatement(cs, index++, parameter);
}
}
}
boolean isResultSet = cs.execute();
if (isResultSet) {
try(final ResultSet rs = cs.getResultSet()){
ResultSetMetaData rm = rs.getMetaData();
int columnCount = rm.getColumnCount();
while (rs.next()) {
JSONObject obj = new JSONObject();
for (int columnIndex = 1; columnIndex <= columnCount; columnIndex++) {
setJSONObject(rs, rm, columnIndex, obj, mode);
}
result.put(obj);
}
}
} else {
int rowsAffected = cs.getUpdateCount();
JSONObject obj = new JSONObject();
obj.put("rowsAffected", rowsAffected);
result.put(obj);
}
if (outputParamTypes.length() > 0) {
clearJSONArray(params);
}
for (String key : outputParamTypes.keySet()) {
int indexOutputParams = Integer.parseInt(key);
int type = outputParamTypes.getInt(key);
getOutputParameter(cs, indexOutputParams, type, params);
}
System.out.println("CONSULTA\n" + cs.toString());
} catch (Exception ex) {
ex.printStackTrace();
System.out.println(""+ex.getMessage());
}
return result;
}
public static JSONObject queryWithPaging(Connection cn, String query, JSONObject data) throws Exception {
/*
- En la descripción se hace referencia a queryWithPaging como MÉTODO y al procedimiento almacenado o función de base de datos como FUNCIÓN.
El método sirve para obtener los datos necesarios para un datatable y permite también listar todos los registros
de una función que recibe limit y offset como parámetros (paginado)
- En la función los últimos parámetros deben ser LIMIT y OFFSET en ese orden.
- La consulta debe retornar una columna con el total de registros y esta debe llamarse "records_total".
- Este método trabaja con length y start que son parámetros que envía el datatable para realizar el paginado(serverSide);
ambos son asignados(pst.set()) a la función en ese mismo orden(primero LENGTH para LIMIT y luego START para OFFSET).
- Si no se manda length ni start se asigna null a ambos parámetros de la función y se listan todos los registros disponibles.
- El método retorna lo siguiente:
- recordsTotal = "records_total" de la consulta
- recordsFiltered = "records_total" de la consulta
- draw = recibido del mismo datatable
- data = de tipo JSONArray y es la lista de datos recibida de la función
- EJEMPLO:
String sql = "SELECT * FROM \"general\".func_listar_solicitudes_descuento_mora(?,?,?)";
return PostgreSqlDAOFactory.queryWithPaging(DatabaseConfig.SIIAA, sql, datos);
Donde se envían y reciben los valores mencionados anteriormente.
*/
JSONObject salida = new JSONObject();
JSONArray jsonArray = new JSONArray();//objeto que almacena todas las filas obtenidas por el query
int recordsTotal = 0;
try {
try (PreparedStatement ps = cn.prepareStatement(query)) {
int paramsCount = countChar(query, '?'); // obtenido de Utils.StringUtils
JSONArray _params = data.has("params") ? data.getJSONArray("params") : new JSONArray();
if (data.has("length") && data.has("start")) {
_params
.put(paramsCount - 2, data.getInt("length"))
.put(paramsCount - 1, data.getInt("start"));
}
if (data.has("draw")) {
salida.put("draw", data.getInt("draw"));
}
for (int i = 0; i < paramsCount; i++) {
if (!_params.isNull(i)) {
setPreparedStatement(ps, i + 1, _params.get(i));
} else {
ps.setNull(i + 1, java.sql.Types.NULL); // Modificado 08/02/2020 JCYL, el conector de MySql actúa diferente al de PostgreSql, no permite setear null con el método general
// setPreparedStatement(ps, i + 1, JSONObject.NULL);
}
}
System.out.println("Query ejecutado con queryWithPaging ---->>> \n" + ps);
try (ResultSet rs = ps.executeQuery()) {
ResultSetMetaData rm = rs.getMetaData();
int numCols = rm.getColumnCount();
while (rs.next()) {
JSONObject obj = new JSONObject();
for (int i = 1; i <= numCols; i++) {
setJSONObject(rs, rm, i, obj, false);
}
if (obj.has("records_total") && !obj.isNull("records_total")) {
if (recordsTotal == 0) {
recordsTotal = Integer.parseInt(String.valueOf(obj.get("records_total")));
}
obj.remove("records_total");
}
jsonArray.put(obj);
}
}
}
salida.put("status", true);
salida.put("message", "Consulta realizada correctamente");
} catch (Exception ex) {
salida.put("status", false);
salida.put("message", "Hubo un error al realizar la consulta");
throw ex;
} finally {
try {
if (cn != null) {
cn.close();
}
} catch (SQLException e) {
System.out.println("Error al liberar memoria " + e.getMessage());
}
}
salida.put("recordsTotal", recordsTotal);
salida.put("recordsFiltered", recordsTotal);
salida.put("data", jsonArray);
return salida;
}
public static JSONObject queryPSSingle(Connection cn, String query, JSONArray... params) throws Exception {
JSONObject json = new JSONObject();//objeto que almacena todas las filas obtenidas por el query
boolean status = false;
//boolean status = false;
//String message = "";
try (PreparedStatement ps = cn.prepareStatement(query);) {
int paramsCount = countChar(query, '?');
// comentado el 16/08/2019
// //validamos si existen parametros
// if (params != null && params.length > 0) {
// JSONArray _params = params[0];
// int index = 1;
// //Recorremos la lista de parametros y lo seteamos en el preparedstatement
// for (Object p : _params) {
// setPreparedStatement(ps, index++, p);
// }
// }
for (int i = 0; i < paramsCount; i++) {
if (!params[0].isNull(i)) {
setPreparedStatement(ps, i + 1, params[0].get(i));
} else {
setPreparedStatement(ps, i + 1, JSONObject.NULL);
}
}
System.out.println("Query ejecutado con queryPSSingle-->>>> \n" + ps);
try (ResultSet rs = ps.executeQuery();) {
ResultSetMetaData rm = rs.getMetaData();
int numCols = rm.getColumnCount();
if (rs.next()) {
for (int i = 1; i <= numCols; i++) {
setJSONObject(rs, rm, i, json, false);
}
try {
json.put("status", json.getBoolean("status"));
} catch (Exception e) {
System.out.println("El tipo de dato recibido en 'status' no es de tipo boolean");
json.put("status", json.getInt("status") == 1);
}
// if (json.has("status")) { // Al trabajar con mysql, donde no existe el tipo de dato booleano, se añade esta condición
// if (json.get("status") instanceof Number) {
//
// } else {
// }
// } else {
// json.put("status", true);
// }
// json.put("status", json.has("status") ? json.getBoolean("status") : true);
json.put("message", json.has("message") ? json.getString("message") : "Operación realizada correctamente.");
} else {
json.put("status", false).put("message", "Hubo un error al realizar la operación.");
}
}
} catch (Exception ex) {
System.out.println("Hubo un error al realizar la consulat con queryPSSingle --->> \n" + ex.getMessage());
throw ex;
} finally {
try {
if (cn != null) {
cn.close();
}
} catch (SQLException e) {
System.out.println("Error al liberar memoria " + e.getMessage());
}
}
return json;
}
//************************************************************************************************************************
public static JSONObject executeCS(Connection connection, String query, JSONArray... params) {
JSONObject obj = new JSONObject();
try (CallableStatement cs = connection.prepareCall(query);){
if (params != null && params.length > 0) {
JSONArray _params = params[0];
int index = 1;
for (Object p : _params) {
setPreparedStatement(cs, index++, p);
}
}
int filas = cs.executeUpdate();
obj.put("status", true);
obj.put("message", "OK");
obj.put("data", filas);
} catch (Exception ex) {
obj.put("status", false);
obj.put("message", ex);
obj.put("data", JSONObject.NULL);
}
return obj;
}
private static void setJSONObject(ResultSet rs, ResultSetMetaData rm, int i, JSONObject obj, boolean mode) throws SQLException {
int type = rm.getColumnType(i);
switch (type) {
case Types.VARCHAR:
obj.put(mode ? "" + i : rm.getColumnLabel(i), rs.getString(i) == null ? JSONObject.NULL : rs.getString(i));
break;
case Types.CHAR:
obj.put(mode ? "" + i : rm.getColumnLabel(i), rs.getString(i) == null ? JSONObject.NULL : rs.getString(i));
break;
case Types.INTEGER:
obj.put(mode ? "" + i : rm.getColumnLabel(i), rs.getInt(i));
break;
case Types.BIT:
obj.put(mode ? "" + i : rm.getColumnLabel(i), rs.getBoolean(i));
break;
case Types.BINARY:
obj.put(mode ? "" + i : rm.getColumnLabel(i), rs.getBytes(i));
break;
default:
obj.put(mode ? "" + i : rm.getColumnLabel(i), rs.getString(i) == null ? JSONObject.NULL : rs.getString(i));
}
}
private static void getOutputParameter(CallableStatement cs, int cont, int tipo, JSONArray parameter) throws SQLException {
switch (tipo) {
case Types.INTEGER:
parameter.put(cs.getInt(cont));
break;
case Types.VARCHAR:
case Types.CHAR:
parameter.put(cs.getString(cont));
break;
case Types.BOOLEAN:
parameter.put(cs.getBoolean(cont));
break;
case Types.DOUBLE:
parameter.put(cs.getDouble(cont));
break;
case Types.BINARY:
parameter.put(cs.getBytes(cont));
break;
default:
parameter.put(cs.getString(cont));
}
}
private static void registerOutputParameter(CallableStatement cs, int index, Object p, JSONObject types) throws SQLException {
if (p.equals(Integer.class)) {
cs.registerOutParameter(index, Types.INTEGER);
types.put(Integer.toString(index), Types.INTEGER);
} else if (p.equals(String.class)) {
cs.registerOutParameter(index, Types.VARCHAR);
types.put(Integer.toString(index), Types.VARCHAR);
} else if (p.equals(Boolean.class)) {
cs.registerOutParameter(index, Types.BOOLEAN);
types.put(Integer.toString(index), Types.BOOLEAN);
} else if (p.equals(Double.class)) {
cs.registerOutParameter(index, Types.DOUBLE);
types.put(Integer.toString(index), Types.DOUBLE);
}
}
private static void setPreparedStatement(PreparedStatement ps, int index, Object p) throws SQLException {
if (p instanceof Integer) {
ps.setInt(index, (int) p);
} else if (p instanceof String) {
ps.setString(index, p.toString());
} else if (p instanceof Double) {
ps.setDouble(index, (double) p);
} else if (p instanceof Boolean) {
ps.setBoolean(index, (boolean) p);
} else if (p instanceof byte[]) {
ps.setBytes(index, (byte[]) p);
} else if (p instanceof java.sql.Date) {
ps.setDate(index,(java.sql.Date) p);
}
}
private static void clearJSONArray(JSONArray jsonArray) {
while (jsonArray != null && jsonArray.length() > 0) {
jsonArray.remove(0);
}
}
//countChar, método para encontrar cuántas veces se repite un caracter en una cadena,
//Actualmente empleado para contar cuántos nulos se deben insertar en la llamada a una función (QueryWithPaging DAO)
public static int countChar(String str, char c) {
int count = 0;
for (int i = 0; i < str.length(); i++) {
if (str.charAt(i) == c) {
count++;
}
}
return count;
}
}
/*! jQuery Editable Select - v2.2.5 - https://github.com/indrimuska/jquery-editable-select - (c) 2016 Indri Muska - MIT */
input.es-input{padding-right:20px!important;background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAICAYAAADJEc7MAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAG2YAABzjgAA4DIAAIM2AAB5CAAAxgwAADT6AAAgbL5TJ5gAAABGSURBVHjaYvz//z8DOYCJgUzA0tnZidPK8vJyRpw24pLEpwnuVHRFhDQxMDAwMPz//x+OOzo6/iPz8WFGuocqAAAA//8DAD/sORHYg7kaAAAAAElFTkSuQmCC) right center no-repeat}input.es-input.open{-webkit-border-bottom-left-radius:0;-moz-border-radius-bottomleft:0;border-bottom-left-radius:0;-webkit-border-bottom-right-radius:0;-moz-border-radius-bottomright:0;border-bottom-right-radius:0}.es-list{position:absolute;padding:0;margin:0;border:1px solid #d1d1d1;display:none;z-index:1000;background:#fff;max-height:160px;overflow-y:auto;-moz-box-shadow:0 2px 3px #ccc;-webkit-box-shadow:0 2px 3px #ccc;box-shadow:0 2px 3px #ccc}.es-list li{display:block;padding:5px 10px;margin:0}.es-list li.selected{background:#f3f3f3}.es-list li[disabled]{opacity:.5}
\ No newline at end of file
!function(t){EditableSelect=function(e,i){this.options=i,this.$select=t(e),this.$input=t('<input type="text" autocomplete="off">'),this.$list=t('<ul class="es-list">'),this.utility=new EditableSelectUtility(this),["focus","manual"].indexOf(this.options.trigger)<0&&(this.options.trigger="focus"),["default","fade","slide"].indexOf(this.options.effects)<0&&(this.options.effects="default"),isNaN(this.options.duration)&&["fast","slow"].indexOf(this.options.duration)<0&&(this.options.duration="fast");var s=t._data(e,"events");s&&Object.keys(s).forEach(t=>{var e=s[t][0];this.$input.bind(e.type+"."+e.namespace,e.handler)}),this.$select.replaceWith(this.$input),this.$list.appendTo(this.options.appendTo||this.$input.parent()),this.utility.initialize(),this.utility.initializeList(),this.utility.initializeInput(),this.utility.trigger("created")},EditableSelect.DEFAULTS={filter:!0,effects:"default",duration:"fast",trigger:"focus"},EditableSelect.prototype.filter=function(){var e=0,i=this.$input.val().toLowerCase().trim();this.$list.find("li").addClass("es-visible").show(),this.options.filter&&(e=this.$list.find("li").filter(function(e,s){return t(s).text().toLowerCase().indexOf(i)<0}).hide().removeClass("es-visible").length,this.$list.find("li").length==e&&this.hide())},EditableSelect.prototype.show=function(){if(this.$list.css({top:this.$input.position().top+this.$input.outerHeight()-1,left:this.$input.position().left,width:this.$input.outerWidth()}),!this.$list.is(":visible")&&this.$list.find("li.es-visible").length>0){var e={default:"show",fade:"fadeIn",slide:"slideDown"}[this.options.effects];this.utility.trigger("show"),this.$input.addClass("open"),this.$list[e](this.options.duration,t.proxy(this.utility.trigger,this.utility,"shown"))}},EditableSelect.prototype.hide=function(){var e={default:"hide",fade:"fadeOut",slide:"slideUp"}[this.options.effects];this.utility.trigger("hide"),this.$input.removeClass("open"),this.$list[e](this.options.duration,t.proxy(this.utility.trigger,this.utility,"hidden"))},EditableSelect.prototype.select=function(t){this.$list.has(t)&&t.is("li.es-visible:not([disabled])")&&(this.$input.val(t.text()),this.options.filter&&this.hide(),this.filter(),this.utility.trigger("select",t))},EditableSelect.prototype.add=function(e,i,s,l){var o=t("<li>").html(e),n=t("<option>").text(e),a=this.$list.find("li").length;0==(i=isNaN(i)?a:Math.min(Math.max(0,i),a))?(this.$list.prepend(o),this.$select.prepend(n)):(this.$list.find("li").eq(i-1).after(o),this.$select.find("option").eq(i-1).after(n)),this.utility.setAttributes(o,s,l),this.utility.setAttributes(n,s,l),this.filter()},EditableSelect.prototype.remove=function(t){var e=this.$list.find("li").length;t=isNaN(t)?e:Math.min(Math.max(0,t),e-1),this.$list.find("li").eq(t).remove(),this.$select.find("option").eq(t).remove(),this.filter()},EditableSelect.prototype.clear=function(){this.$list.find("li").remove(),this.$select.find("option").remove(),this.filter()},EditableSelect.prototype.destroy=function(){this.$list.off("mousemove mousedown mouseup"),this.$input.off("focus blur input keydown"),this.$input.replaceWith(this.$select),this.$list.remove(),this.$select.removeData("editable-select")},EditableSelectUtility=function(t){this.es=t},EditableSelectUtility.prototype.initialize=function(){var e=this;e.setAttributes(e.es.$input,e.es.$select[0].attributes,e.es.$select.data()),e.es.$input.addClass("es-input").data("editable-select",e.es),e.es.$select.find("option").each(function(i,s){var l=t(s).remove();e.es.add(l.text(),i,s.attributes,l.data()),l.attr("selected")&&e.es.$input.val(l.text())}),e.es.filter()},EditableSelectUtility.prototype.initializeList=function(){var e=this;e.es.$list.on("mousemove","li:not([disabled])",function(){e.es.$list.find(".selected").removeClass("selected"),t(this).addClass("selected")}).on("mousedown","li",function(i){t(this).is("[disabled]")?i.preventDefault():e.es.select(t(this))}).on("mouseup",function(){e.es.$list.find("li.selected").removeClass("selected")})},EditableSelectUtility.prototype.initializeInput=function(){var e=this;switch(this.es.options.trigger){default:case"focus":e.es.$input.on("focus",t.proxy(e.es.show,e.es)).on("blur",t.proxy(function(){0===t(".es-list:hover").length?e.es.hide():this.$input.focus()},e.es));break;case"manual":}e.es.$input.on("input keydown",function(t){switch(t.keyCode){case 38:var i=(s=e.es.$list.find("li.es-visible:not([disabled])")).index(s.filter("li.selected"));e.highlight(i-1),t.preventDefault();break;case 40:var s;i=(s=e.es.$list.find("li.es-visible:not([disabled])")).index(s.filter("li.selected"));e.highlight(i+1),t.preventDefault();break;case 13:e.es.$list.is(":visible")&&(e.es.select(e.es.$list.find("li.selected")),t.preventDefault());break;case 9:case 27:e.es.hide();break;default:e.es.filter(),e.highlight(0)}})},EditableSelectUtility.prototype.highlight=function(t){var e=this;e.es.show(),setTimeout(function(){var i=e.es.$list.find("li.es-visible"),s=e.es.$list.find("li.selected").removeClass("selected"),l=i.index(s);if(i.length>0){var o=(i.length+t)%i.length,n=i.eq(o),a=n.position().top;n.addClass("selected"),o<l&&a<0&&e.es.$list.scrollTop(e.es.$list.scrollTop()+a),o>l&&a+n.outerHeight()>e.es.$list.outerHeight()&&e.es.$list.scrollTop(e.es.$list.scrollTop()+n.outerHeight()+2*(a-e.es.$list.outerHeight()))}})},EditableSelectUtility.prototype.setAttributes=function(e,i,s){t.each(i||{},function(t,i){e.attr(i.name,i.value)}),e.data(s)},EditableSelectUtility.prototype.trigger=function(t){var e=Array.prototype.slice.call(arguments,1),i=[t+".editable-select"];i.push(e),this.es.$select.trigger.apply(this.es.$select,i),this.es.$input.trigger.apply(this.es.$input,i)},Plugin=function(e){var i=Array.prototype.slice.call(arguments,1);return this.each(function(){var s=t(this),l=s.data("editable-select"),o=t.extend({},EditableSelect.DEFAULTS,s.data(),"object"==typeof e&&e);l||(l=new EditableSelect(this,o)),"string"==typeof e&&l[e].apply(l,i)})},t.fn.editableSelect=Plugin,t.fn.editableSelect.Constructor=EditableSelect}(jQuery);
\ No newline at end of file
/* global bootbox */
let nombreTipoUsuario = "";
let codProyectoDetalle = 0;
function activarDesactivarAccion(cod){
return new Promise((resolve, reject) => {
$.ajax({
type: 'POST',
url: "../servlet/TipoUsuarioServlet?accion=activarDesactivarAccion",
dataType: 'json',
data:{
codAccionDetalle: cod
},
success: function (data, textStatus, jqXHR) {
resolve(data);
}, error: function (jqXHR, textStatus, errorThrown) {
reject("Error al listar las asignaciones.");
}
});
}).then(data => {
if (data.status) {
$("#tblDetalleAcciones").DataTable().ajax.reload();
}
});
}
function activarDesactivarTipoUsuario(cod){
return new Promise((resolve, reject) => {
$.ajax({
type: 'POST',
url: "../servlet/TipoUsuarioServlet?accion=activarDesactivarTipoUsuario",
dataType: 'json',
data:{
codProyectoDetalle: cod
},
success: function (data, textStatus, jqXHR) {
resolve(data);
}, error: function (jqXHR, textStatus, errorThrown) {
reject("Error al listar las asignaciones.");
}
});
}).then(data => {
if (data.status) {
$("#tblTipoUsuario").DataTable().ajax.reload();
}
});
}
//tabla de listar acciones
function listarTablaAcciones(cod){
var jsonAcciones = {
"codProyDetalle": cod
};
tablaDetalleAcciones = $("#tblDetalleAcciones").DataTable({
"language": {
"lengthMenu": "Mostrar: _MENU_",
"zeroRecords": "&nbsp;&nbsp;&nbsp; No se encontraron resultados",
"info": "&nbsp;&nbsp;&nbsp; Mostrando del _START_ al _END_ de un total de _TOTAL_ Tipos de Usuarios",
"infoEmpty": "&nbsp;&nbsp;&nbsp; Mostrando 0 de 0 registros",
"search": "Filtrar:",
"loadingRecords": "Cargando...",
"processing": '<span style="width:100%;"><img src="http://www.snacklocal.com/images/ajaxload.gif"></span>',
"scrollY": false,
"paginate": {
"first": "First",
"last": "Last",
"next": "Siguiente",
"previous": "Anterior"
}
},
dom: '<"datatable-scroll"t>r<"datatable-footers"ip>',
"ajax": {
type: 'POST',
"url": '../servlet/TipoUsuarioServlet?accion=listarAcciones',
data: jsonAcciones
},
"bSort": false,
"bFilter": false,
"serverSide": true,
"processing": true,
"aaSorting": [],
"ordering": false,
"bLengthChange": false,
"bInfo": true,
"paging": true,
"iDisplayLength": 5,
"columnDefs": [
{targets: 0, orderable: false, width: "7%", className: "text-center"},
{targets: 1, orderable: false, width: "30%", className: "text-left"},
{targets: 2, orderable: false, width: "10%", className: "text-center"},
{targets: 3, orderable: false, width: "10%", className: "text-center"}
],
"columns": [
{"data": "numeral"},
{"data": "Accion"},
{"data": "estado_detalle",
render: function (data, type, row) {
var retorno;
if (data === 0) {
retorno = "<span class='label label-danger' style='color: white'>INACTIVO</span>";
} else if (data === 1) {
retorno = '<span class="label label-success" style="color: white">ACTIVO</span>';
}
return retorno;
}
},
{"data": "estado_detalle",
render: function (data, type, row) {
var retorno;
if (data === 0) {
retorno = '<span data-toggle="tooltip" title="Activar" style="color:green;cursor:pointer;" class="bttnActivarAccion" style="cursor: pointer"> <i class="glyphicon glyphicon-off text-green-800"></i> &nbsp;&nbsp;&nbsp; </span>';
} else if (data === 1) {
retorno = '<span data-toggle="tooltip" title="Desactivar" style="color:red;cursor:pointer;" class="bttnDesactivarAccion" style="cursor: pointer"> <i class="glyphicon glyphicon-off text-red-800"></i> &nbsp;&nbsp;&nbsp; </span>';
}
return retorno;
}
}
]
});
obtenener_data_tablaAcciones("#tblDetalleAcciones tbody",tablaDetalleAcciones);
}
var obtenener_data_tablaAcciones = function(tbody, tabla){
var table = $('#tblDetalleAcciones').DataTable();
$('#tblDetalleAcciones tbody').off('click');
$("tbody").on('click', '.bttnDesactivarAccion', function() {
var data = tabla.row($(this).parents('tr')).data();
activarDesactivarAccion(data.cod_accion_detalle);
});
$("tbody").on('click', '.bttnActivarAccion', function() {
var data = tabla.row($(this).parents('tr')).data();
activarDesactivarAccion(data.cod_accion_detalle);
});
}
//cargar el combo de tipo de usuario dependiendo del proyecto elegido
$("#cboProyectos").on("change", function(){
let codProy = $("#cboProyectos").val();
if(codProy != 0){
cargarTiposUsuarioPorProyecto(parseInt(codProy));
}
});
function segundaCarga() {
datosTipoUsuario.listarTipoUsuario();
cargarProyectos();
//datosTipoUsuario.listarTipoUsuario();
soloLetras('txtTipoDeUsuario');
editarTipoUsuario();
desactivarTipoUsuario();
activarTipoUsuario();
submitKey('formTipoUsuario', '#btnBuscar');
}
function cargarProyectos(){
return new Promise((resolve, reject) => {
$.ajax({
type: 'POST',
url: '../servlet/TipoUsuarioServlet?accion=listarProyectos',
dataType: "json",
success: function (data, textStatus, jqXHR) {
resolve(data);
},
error: function (jqXHR, textStatus, errorThrown) {
reject('Error en la petición');
}
});
})
.then(data => {
let print = '';
if (data.status) {
let print = "";
print += '<option value="0">[TODOS]</option>';
var lista = data.data;
lista.forEach(v => {
print += '<option value="' + v.codigoProyecto +'">'+v.nombreProyecto+'</option>';
});
$("#cboProyectos").html(print);
$("#cboProyectos").prop("disabled", false);
}
});
}
function cargarTiposUsuarioPorProyecto(codigoProyecto){
return new Promise((resolve, reject) => {
$.ajax({
type: 'POST',
url: '../servlet/TipoUsuarioServlet?accion=listarTiposUsuarios',
dataType: "json",
data: {
codigoProy:codigoProyecto
},
success: function (data, textStatus, jqXHR) {
resolve(data);
},
error: function (jqXHR, textStatus, errorThrown) {
reject('Error en la petición');
}
});
})
.then(data => {
let print = '';
if (data.status) {
let print = "";
print += '<option value="0">[TODOS]</option>';
var lista = data.data;
lista.forEach(v => {
print += '<option value="' + v.codTipoUsuario +'">'+v.nomTipoUsuario+'</option>';
});
$("#cboTipoUsuarios").html(print);
}
});
}
var datosTipoUsuario = {listarTipoUsuario: function () {
var filtro = $('#txtTipoDeUsuario').val();
var datosTipoUsuario = {
listarTipoUsuario: function () {
var filtro = $('#cboTipoUsuarios').val();
var cboProyecto = $("#cboProyectos").val();
var tipoFiltrado = 0;
if(filtro == 0 && cboProyecto != 0){
tipoFiltrado = 1;//solo buscara por proyecto
}else if(filtro != 0 && cboProyecto == 0){
tipoFiltrado = 2;//solo buscara por proyecto y tipodeusuario
}
var json = {
"filtro": filtro
"filtro": filtro,
"filtrado":tipoFiltrado,
"valorCboProyecto":cboProyecto
};
$("#tblTipoUsuario").DataTable({
tabla = $("#tblTipoUsuario").DataTable({
"language": {
"lengthMenu": "Mostrar: _MENU_",
"zeroRecords": "&nbsp;&nbsp;&nbsp; No se encontraron resultados",
......@@ -34,7 +271,7 @@
dom: '<"datatable-scroll"t>r<"datatable-footers"ip>',
"ajax": {
type: 'POST',
"url": '../servlet/TipoUsuarioServlet?accion=listarTipoUsuario',
"url": '../servlet/TipoUsuarioServlet?accion=listadoPrincipal',
data: json
},
"bSort": false,
......@@ -49,35 +286,37 @@
"iDisplayLength": 15,
"columnDefs": [
{targets: 0, orderable: false, width: "7%", className: "text-center"},
{targets: 1, orderable: false, width: "20%"},
{targets: 2, orderable: false, width: "10%", className: "text-center"},
{targets: 3, orderable: false, width: "7%", className: "text-center"}
{targets: 1, orderable: false, width: "10%", className: "text-center"},
{targets: 2, orderable: false, width: "20%"},
{targets: 3, orderable: false, width: "10%", className: "text-center"},
{targets: 4, orderable: false, width: "7%", className: "text-center"}
],
"columns": [
{"data": "numeral"},
{"data": "nombreTipoUsuario"},
{"data": "estadoTipoUsuario",
{"data": "Proyecto"},
{"data": "Tipo_Usuario"},
{"data": "est",
render: function (data, type, row) {
var retorno;
if (data === 0) {
if (data === false) {
retorno = "<span class='label label-danger' style='color: white'>INACTIVO</span>";
} else if (data === 1) {
} else if (data === true) {
retorno = '<span class="label label-success" style="color: white">ACTIVO</span>';
}
return retorno;
}
},
{"data": "estadoTipoUsuario", "render": function (data, type, row) {
{"data": "est", "render": function (data, type, row) {
let retorno = ``;
retorno = `
<span data-toggle="tooltip" title="Editar" style="cursor: pointer"> <i class='editar click${row.numeral} glyphicon glyphicon-pencil text-blue-800'></i> &nbsp;&nbsp;&nbsp; </span>`;
if (data === 1) {
if (data === true) {
retorno += `
<span data-toggle="tooltip" title="Desactivar" style="cursor: pointer"> <i class='desactivar icon-user-block text-danger-800'></i> </span>`;
<span data-toggle="tooltip" class="bttnDesactivarTipUsuario" title="Desactivar" style="cursor: pointer"> <i class='desactivar icon-user-block text-danger-800'></i> </span>`;
} else {
retorno += `
<span data-toggle="tooltip" title="Activar" style="cursor: pointer"> <i class='activar icon-user-check text-success-800'></i> </span>`;
<span data-toggle="tooltip" class="bttnActivarTipUsuario" title="Activar" style="cursor: pointer"> <i class='activar icon-user-check text-success-800'></i> </span>`;
}
retorno += `
<span data-toggle="tooltip" title="Detalle" style="cursor: pointer"> <i class='bttnDetalle glyphicon glyphicon-cog text-success-800'></i> </span>`;
return retorno;
}
......@@ -85,9 +324,87 @@
]
});
obtenener_data("#tblTipoUsuario tbody",tabla);
}
};
var obtenener_data = function(tbody, tabla){
var table = $('#tblTipoUsuario').DataTable();
$('#tblTipoUsuario tbody').off('click');
$("tbody").on('click', '.bttnDetalle', function() {
var data = tabla.row($(this).parents('tr')).data();
nombreTipoUsuario = data.Tipo_Usuario;
codProyectoDetalle = data.cod_proyecto_detalle;
modalListadoAcciones(data.cod_proyecto_detalle, data.Tipo_Usuario);
});
$("tbody").on('click', '.bttnActivarTipUsuario', function() {
var data = tabla.row($(this).parents('tr')).data();
activarDesactivarTipoUsuario(data.cod_proyecto_detalle);
});
$("tbody").on('click', '.bttnDesactivarTipUsuario', function() {
var data = tabla.row($(this).parents('tr')).data();
activarDesactivarTipoUsuario(data.cod_proyecto_detalle);
});
}
function modalListadoAcciones(codProyDetalle, nomTipoUsuario){
var listaDetalleAcciones = bootbox.dialog({
title: "<span><i class='ace-icon fa fa-tags'></i> ASIGNAR ACCIONES POR TIPO DE USUARIO</span>",
headerClass: "modal-bg-primary",
className: "tablaListadoAcciones",
size: "large",
message: `<div class="panel panel-primary">
<div class="panel-heading" style="padding: 8px 15px">
<h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="fa fa-list"></i>&nbsp; ${nomTipoUsuario}</h6>
<div class="heading-elements">
<button id="bttnAsignarAcciones" type="button" class="btn bg-slate-600 border-slate-800 btn-xs" onclick="asignarAcciones(${codProyDetalle})"><i class="glyphicon glyphicon-plus"></i>&nbsp; Asignar Acciones</button>
</div>
</div>
<div class="table-responsive">
<table class="table table-responsive table-striped table-hover table-bordered" style ="width: 100%" id="tblDetalleAcciones">
<thead class="">
<tr>
<th class="text-center">Nº</th>
<th class="text-center">ACCIONES</th>
<th class="text-center">ESTADO</th>
<th class="text-center">ACCIONES</th>
</tr>
</thead>
</table>
</div>
</div>`,
buttons: {
si: {
label: "<i class='fa fa-times bigger-110'></i>&nbsp; Cerrar",
className: "btn bg-danger border-danger-600 btn-xs",
callback: function () {
}
}
}
});
listaDetalleAcciones.init(function () {
listarTablaAcciones(codProyDetalle);
});
}
let flagBusqueda = false;
$('#tblTipoUsuario').on('draw.dt', function () {
$('[data-toggle="tooltip"]').tooltip();
......@@ -120,7 +437,8 @@
});
$('#btnLimpiar').click(function () {
$('#txtTipoDeUsuario').val("");
$("#cboProyectos").val("0");
$("#cboTipoUsuarios").val("0");
if (validar !== 0) {
validar.resetForm();
}
......@@ -586,4 +904,140 @@
});
});
}
function listarCboAcciones(){
return new Promise((resolve, reject) => {
$.ajax({
type: 'POST',
url: "../servlet/TipoUsuarioServlet?accion=listarCboAcciones",
dataType: 'json',
success: function (data, textStatus, jqXHR) {
resolve(data);
}, error: function (jqXHR, textStatus, errorThrown) {
reject("Error al listar las asignaciones.");
}
});
}).then(data => {
let print = '';
if (data.status) {
let print = "";
var lista = data.data;
lista.forEach(v => {
print += '<option value="' + v.codAccion +'">'+v.nombreAccion+'</option>';
});
$("#cboListadoAcciones").html(print);
$("#cboListadoAcciones").editableSelect();
}
});
}
function asignarAcciones(codDetalleProyecto){
$(".tablaListadoAcciones").addClass("hide");
var listadoAcciones = bootbox.dialog({
title: "<span><i class='ace-icon fa fa-tags'></i> ASIGNAR ACCION - "+nombreTipoUsuario+"</span>",
headerClass: "modal-bg-primary",
size: "small",
message: `<form id="formCrearTipoUsuario" onsubmit="return false" autocomplete="off">
<div class='col-md-12'>
<div class="form-group">
<label style="font-size: small">
Acciones:
</label>
<span id="spanAterik" class="asterisk"> (*)</span>
<select class="form-control" id="cboListadoAcciones" name="cboListAcciones">
</select>
<br>
<div class="text-right" style="font-size: small">
<span class="text-danger">(*) </span> Campo obligatorio
</div>
</div>
</div>
</form>`,
buttons: {
confirm: {
label: "<i class='fa fa-check bigger-110'></i>&nbsp; Asignar",
className: "btn-primary buttonOk",
callback: function () {
//var cboNomAccion = $('select[name="cboListAcciones"] option:selected').text();
var cboNomAccion = $('#cboListadoAcciones').val();
if(cboNomAccion !== ""){
crearAcciones(codDetalleProyecto,cboNomAccion);
}else{
alert("Tienes que asignar una accion valida.");
$(".tablaListadoAcciones").removeClass("hide");
}
}
},
cancel: {
label: "<i class='fa fa-times bigger-110'></i>&nbsp; Cancelar",
className: "btn-danger",
callback: function () {
$(".tablaListadoAcciones").removeClass("hide");
}
}
}
});
listadoAcciones.init(function () {
//cargar el combo de acciones
listarCboAcciones();
});
}
function crearAcciones(codProyDetalle, accion){
return new Promise((resolve, reject) => {
$.ajax({
type: 'POST',
url: "../servlet/TipoUsuarioServlet?accion=asignarAcciones",
dataType: 'json',
data:{
codigoProyDetalle: codProyDetalle,
nomAccion: accion
},
success: function (data, textStatus, jqXHR) {
resolve(data);
}, error: function (jqXHR, textStatus, errorThrown) {
reject("Error al listar las asignaciones.");
}
});
}).then(data => {
if (data.status) {
bootbox.dialog({
className: "dialogExtraSmall",
title: "<i class='ace-icon fa fa-tags white'></i> <span class='white'>Notificación</span>",
headerClass: "modal-bg-success",
message: data.message,
buttons: {
si: {
label: "<i class='fa fa-check bigger-110'></i>&nbsp; OK",
className: "btn-success",
callback: function () {
//modalListadoAcciones(codProyDetalle, nombreTipoUsuario);
$(".tablaListadoAcciones").removeClass("hide");
$("#tblDetalleAcciones").DataTable().ajax.reload();
}
}
}
});
}else{
bootbox.dialog({
title: "<i class='ace-icon fa fa-exclamation-circle white'></i> <span class='white'>Advertencia</span>",
headerClass: "modal-bg-warning",
message: "Ha ocurrido un error",
buttons: {
si: {
label: "<i class='fa fa-check bigger-110'></i>&nbsp; OK",
className: "btn-warning",
callback: function () {
$(".tablaListadoAcciones").removeClass("hide");
$("#tblDetalleAcciones").DataTable().ajax.reload();
}
}
}
});
}
});
}
......@@ -8,6 +8,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link href="../css/lib/jquery-editable-select.min.css" rel="stylesheet" type="text/css"/>
<%@include file="templates/header.jsp" %>
<!--template-core-->
......@@ -19,7 +20,7 @@
<%@include file="templates/header-body.jsp" %>
<!-- content -->
<div class="row animated fadeIn">
<div class="col-sm-12 col-md-12 col-lg-3 col-centered">
<div class="col-sm-12 col-md-12 col-lg-5 col-centered">
<div class="panel panel-primary card-3" style="margin-top: 30px">
<div class="panel-heading" style="padding: 8px 15px">
<h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="icon icon-search4"></i>&nbsp; Búsqueda de Tipos de Usuario</h6>
......@@ -32,13 +33,27 @@
<div class="panel-body" id="panelSearch">
<form id="formTipoUsuario" onsubmit="return false" autocomplete="off">
<div class="row">
<div class='col-md-12' id="div-busq-tipo">
<div class='col-md-6'>
<div class="form-group">
<label>
Tipo de Usuario:
Proyecto
</label>
<span class="asterisk">(*)</span>
<input type="text" id="txtTipoDeUsuario" name="txtBusqueda" class="form-control" value="" placeholder="INGRESE NOMBRE DEL TIPO DE USUARIO" style="text-transform:uppercase;">
<select class="form-control" id="cboProyectos">
</select>
</div>
</div>
<div class='col-md-6' id="div-busq-tipo">
<div class="form-group">
<label>
Tipo de Usuario:
</label>
<select class="form-control" id="cboTipoUsuarios">
</select>
<!--<span class="asterisk">(*)</span>-->
<!--<input type="text" id="txtTipoDeUsuario" name="txtBusqueda" class="form-control" value="" placeholder="INGRESE NOMBRE DEL TIPO DE USUARIO" style="text-transform:uppercase;">-->
</div>
</div>
</div>
......@@ -64,12 +79,12 @@
</div>
</div>
<div class="col-sm-12 col-md-12 col-lg-9 col-centered">
<div class="col-sm-12 col-md-12 col-lg-10 col-centered">
<div class="panel panel-primary card-3" style="margin-top: 30px">
<div class="panel-heading" style="padding: 8px 15px">
<h6 class="panel-title" style="font-size: 15px; font-family: inherit"><i class="fa fa-list"></i>&nbsp; Listado de Tipos de Usuario</h6>
<div class="heading-elements">
<button type="button" id="btnNuevoTipoUsuario" class="btn bg-slate border-slate-600 btn-xs"><i class="glyphicon glyphicon-plus"></i>&nbsp;Nuevo Tipo de Usuario</button>
</div>
</div>
<div class="table-responsive">
......@@ -77,7 +92,8 @@
<thead>
<tr>
<th class="text-center"></th>
<th class="text-center">NOMBRE</th>
<th class="text-center">PROYECTO</th>
<th class="text-center">TIPO DE USUARIO</th>
<th class="text-center">ESTADO</th>
<th class="text-center">ACCIONES</th>
</tr>
......@@ -85,11 +101,13 @@
</table>
</div>
</div>
</div>
</div>
</div>
<!-- / content -->
<%@include file="templates/footer-body.jsp" %>
<!--js-->
<script src="../js/lib/jquery-editable-select.min.js" type="text/javascript"></script>
<script src="../js/pages/tipoUsuario.js" type="text/javascript"></script>
<!--js-->
</body>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment