// Función para la eliminación de un registro // este método invoca al método public void deletePerfilturno(int idBorrar) // definido en el PerfilturnoManager public void serviceDeletePerfilturno(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { int idBorrar = -1; idBorrar = WebUtils.getintParam(request, "borrarId"); if (idBorrar != -1) if (PerfilturnoManager.borraPerfilturno(idBorrar)) WebUtils.writeXmlResponse(response, XmlUtils.buildXmlOKResponse("ISO-8859-1")); else WebUtils.writeXmlResponse(response, XmlUtils.buildXmlNotOKResponse("ISO-8859-1")); }
private Criteria criteriaPerfilturnoTableContent(HttpServletRequest request, Criteria c) throws IOException, ServletException { String param = ""; param = WebUtils.getStringParam(request, new PerfilesHelper().getIdperfilName()); if (param != null) TorqueUtils.addEqualCriteria(c, PerfilturnoPeer.IDPERFIL, param); param = WebUtils.getStringParam(request, new TurnosHelper().getIdturnoName()); if (param != null) TorqueUtils.addEqualCriteria(c, PerfilturnoPeer.IDTURNO, param); String paramSortCol = WebUtils.getStringParam(request, "sort_col"); String paramSortDir = WebUtils.getStringParam(request, "sort_dir"); int paramFiltro = WebUtils.getintParam(request, "filtro"); c = ordenacion(c, paramSortCol, paramSortDir); c = filtro(c, paramFiltro); return c; }
public void servicePerfilturnoTableContentPdf( HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { utf8RequestService(request); Criteria c = new Criteria(); String paramQuery = WebUtils.getStringParam(request, "query"); if ((paramQuery != null) && (paramQuery.compareTo("") != 0)) c = PerfilturnoManager.buildSearchCriteria(paramQuery); c = criteriaPerfilturnoTableContent(request, c); PerfilturnoGroupBean tgb = PerfilturnoManager.getPerfilturnos(c); String[] methodos = new String[] { PerfilturnoHelper.IDPERFIL_GET_METHOD_NAME + "PerfilturnoParsed", PerfilturnoHelper.IDTURNO_GET_METHOD_NAME + "PerfilturnoParsed", PerfilturnoHelper.VALORCOSTE_GET_METHOD_NAME + "PerfilturnoParsed" }; byte[] content = PdfUtils.getBytes( replaceStringBuffer(tgb.buildXml(methodos, null, "ISO-8859-1"), "n/a", " "), perfilturnos_transformer, "ISO-8859-1"); response.addHeader("content-disposition", "attachment;filename=ListaPerfilturno.pdf"); response.setContentType("application/pdf"); response.setHeader("Cache-Control", ""); // para que funcione en IE response.setContentLength(content.length); response.getOutputStream().write(content); response.getOutputStream().flush(); response.getOutputStream().close(); }
public void servicePerfilturnoTableContent( HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, TorqueException { utf8RequestService(request); int numElemPedidosBD = 40; int gap = 0; // gap = viewedRows - numElemVisiblesUltPag DinamicGridBean dgb = WebUtils.getDinamicGridBeanParam(request, numElemPedidosBD, gap); Criteria c = PerfilturnoManager.buildSearchCriteria(dgb); c = criteriaPerfilturnoTableContent(request, c); PerfilturnoGroupBean cgb = PerfilturnoManager.getPerfilturnos(c); dgb.setTotalSize(cgb.getTotalSize()); String[] methodos = new String[] { PerfilturnoHelper.IDPERFIL_GET_METHOD_NAME + "PerfilturnoParsed", PerfilturnoHelper.IDTURNO_GET_METHOD_NAME + "PerfilturnoParsed", PerfilturnoHelper.VALORCOSTE_GET_METHOD_NAME + "PerfilturnoParsed", "getEditPerfilturno", "getDeletePerfilturno" }; StringBuffer cadena = null; cadena = AjaxUtils.buildXmlAjaxResponseTableContentFromListObj( cgb.getAlmacen(), methodos, PerfilturnoHelper.IDTP_GET_METHOD_NAME, dgb, "ISO-8859-1"); cadena.insert( cadena.indexOf("</ajax-response>"), "<response type='object' id='divPath'>" + getPathTableContentPerfilturno(request, response) + "</response>"); xmlResponseService(response, cadena); }
public String getPathTableContentPerfilturno( HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, TorqueException { Criteria c = new Criteria(); String strPath = ""; int claveId = -1; claveId = WebUtils.getintParam(request, "perfiles.IDPERFIL"); if (claveId != -1) { strPath = PerfilesManager.getPerfiles(claveId).getPathPerfilesParsed(request.getQueryString()); } claveId = WebUtils.getintParam(request, "turnos.IDTURNO"); if (claveId != -1) { strPath = TurnosManager.getTurnos(claveId).getPathTurnosParsed(request.getQueryString()); } return "<path>" + strPath + "</path>"; }
public static Trabajador getTrabajador(HttpServletRequest req) throws TorqueException { int id_Id = WebUtils.getintParam(req, getIdName(new Trabajador())); Trabajador o = new Trabajador(); if ((id_Id >= 0)) // no es nuevo y lo fijamos en el objeto { o = TrabajadorManager.getTrabajador(id_Id); } return o; }
public void servicePerfilturnoUlContent(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { utf8RequestService(request); String[] methodos = new String[] {"getULContentPerfilturnoParsed"}; String param = WebUtils.getStringParam(request, "value"); PerfilturnoGroupBean mgb = PerfilturnoManager.getPerfilturnos(PerfilturnoManager.buildSearchCriteria(param)); simpleResponseService( response, AjaxUtils.buildAjaxULContentFromListObj( mgb.getAlmacen(), methodos, PerfilturnoHelper.COMPLEX_ID_GET_METHOD, "Perfilturno")); }
public String getPathElementPerfilturno(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, TorqueException { Criteria c = new Criteria(); String strPath = ""; int claveId = -1; int claveFkId = -1; claveId = WebUtils.getintParam(request, "perfilturno.IDTP"); if (claveId != -1) { c.add(PerfilturnoPeer.IDTP, claveId); PerfilturnoGroupBean trgb = PerfilturnoManager.getPerfilturnos(c); strPath = trgb.getPerfilturno(0).getPathPerfilturnoParsed(request.getQueryString()); } return "<path>" + strPath + "</path>"; }
public void servicePerfilturnoTurnos(HttpServletRequest request, HttpServletResponse response) throws IOException, TorqueException, ServletException { String cadena = null; Criteria c = new Criteria(); int claveId = -1; claveId = WebUtils.getintParam(request, "turnos.IDTURNO"); if (claveId != -1) { c.add(TurnosPeer.IDTURNO, claveId); } c.addAscendingOrderByColumn(TurnosPeer.IDTURNO); TurnosGroupBean trgb = TurnosManager.getTurnoss(c); if (trgb.getTotalSize() != 0) { cadena = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>"; cadena = cadena + "<result><perfilturno.IDTURNO>" + trgb.getTurnos(0).getULContentTurnosParsed() + "</perfilturno.IDTURNO></result>"; } xmlResponseService(response, new StringBuffer(cadena)); }
public void servicePerfilturnoElement(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, TorqueException { StringBuffer cadena = null; Criteria c = new Criteria(); int claveId = -1; claveId = WebUtils.getintParam(request, "perfilturno.IDTP"); if (claveId != -1) { c.add(PerfilturnoPeer.IDTP, claveId); } c.addAscendingOrderByColumn(PerfilturnoPeer.IDTP); PerfilturnoGroupBean trgb = PerfilturnoManager.getPerfilturnos(c); if (trgb.getTotalSize() != 0) { String[] parametros = { PerfilturnoHelper.IDTP_GET_METHOD_NAME, PerfilturnoHelper.IDPERFIL_GET_METHOD_NAME + "PerfilturnoParsed", PerfilturnoHelper.IDTURNO_GET_METHOD_NAME + "PerfilturnoParsed", PerfilturnoHelper.VALORCOSTE_GET_METHOD_NAME + "PerfilturnoParsed" }; cadena = trgb.buildXml(parametros, null, "ISO-8859-1"); cadena.insert(cadena.indexOf("</result>"), getPathElementPerfilturno(request, response)); } xmlResponseService(response, cadena); }
public static Trabajador createObj(HttpServletRequest req) throws TorqueException { Trabajador o = BaseTrabajadorHelper.getTrabajador(req); o.setId(WebUtils.getintParam(req, getIdName(o))); o.setNumero(WebUtils.getStringParam(req, getNumeroName(o))); o.setFechaAlta(WebUtils.getStringParam(req, getFechaAltaName(o))); o.setFechaBaja(WebUtils.getStringParam(req, getFechaBajaName(o))); o.setObs(WebUtils.getStringParam(req, getObsName(o))); o.setNombre(WebUtils.getStringParam(req, getNombreName(o))); o.setApellidos(WebUtils.getStringParam(req, getApellidosName(o))); o.setApellidosDos(WebUtils.getStringParam(req, getApellidosDosName(o))); o.setCif(WebUtils.getStringParam(req, getCifName(o))); o.setCosteHora(WebUtils.getdoubleParam(req, getCosteHoraName(o))); o.setDireccion(WebUtils.getStringParam(req, getDireccionName(o))); o.setLocalidadId( Integer.parseInt( FormatUtils.getFkIdFromString(WebUtils.getStringParam(req, getLocalidadIdName(o))))); o.setCp(WebUtils.getStringParam(req, getCpName(o))); o.setTlfno(WebUtils.getStringParam(req, getTlfnoName(o))); o.setMovil(WebUtils.getStringParam(req, getMovilName(o))); o.setEmail(WebUtils.getStringParam(req, getEmailName(o))); o.setCategoriaId( Integer.parseInt( FormatUtils.getFkIdFromString(WebUtils.getStringParam(req, getCategoriaIdName(o))))); return o; }