From: maroni Date: Wed, 15 Feb 2012 15:45:41 +0000 (-0200) Subject: (no commit message) X-Git-Url: http://200.18.67.61/gitweb/?a=commitdiff_plain;h=5aee716dcaaa888cb201fdb2998dd4b004cd12ba;p=simdecs2.git --- diff --git a/src/java/org/ufcspa/simdecs/comunicacao/MetodoGravaLog.java b/src/java/org/ufcspa/simdecs/comunicacao/MetodoGravaLog.java new file mode 100644 index 0000000..5828679 --- /dev/null +++ b/src/java/org/ufcspa/simdecs/comunicacao/MetodoGravaLog.java @@ -0,0 +1,80 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package org.ufcspa.simdecs.comunicacao; + +import java.io.IOException; +import java.io.PrintWriter; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + * @author maroni + */ +public class MetodoGravaLog extends HttpServlet { + + /** + * Processes requests for both HTTP + * GET and + * POST methods. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + response.setContentType("text/html;charset=UTF-8"); + PrintWriter out = response.getWriter(); + try { + } finally { + out.close(); + } + } + + // + /** + * Handles the HTTP + * GET method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doGet(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Handles the HTTP + * POST method. + * + * @param request servlet request + * @param response servlet response + * @throws ServletException if a servlet-specific error occurs + * @throws IOException if an I/O error occurs + */ + @Override + protected void doPost(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + processRequest(request, response); + } + + /** + * Returns a short description of the servlet. + * + * @return a String containing servlet description + */ + @Override + public String getServletInfo() { + return "Short description"; + }// +} diff --git a/src/java/org/ufcspa/simdecs/comunicacao/MetodoIniciaCaso.java b/src/java/org/ufcspa/simdecs/comunicacao/MetodoIniciaCaso.java index 14b72fd..86888af 100644 --- a/src/java/org/ufcspa/simdecs/comunicacao/MetodoIniciaCaso.java +++ b/src/java/org/ufcspa/simdecs/comunicacao/MetodoIniciaCaso.java @@ -95,7 +95,7 @@ public class MetodoIniciaCaso extends HttpServlet { if (!nodo.getNodo().getTipo().equals(Nodo.SINAL_SINTOMA)) continue; - out.println(" "); + out.println(" "); } out.println(" "); @@ -105,7 +105,7 @@ public class MetodoIniciaCaso extends HttpServlet { if (!nodo.getNodo().getTipo().equals(Nodo.EXAME_FISICO)) continue; - out.println(" "); + out.println(" "); } out.println(" "); @@ -115,7 +115,7 @@ public class MetodoIniciaCaso extends HttpServlet { if (!nodo.getNodo().getTipo().equals(Nodo.EXAME_COMPLEMENTAR)) continue; - out.println(" "); + out.println(" "); } out.println(" "); @@ -124,7 +124,7 @@ public class MetodoIniciaCaso extends HttpServlet { if (!nodo.getNodo().getTipo().equals(Nodo.HISTORICO)) continue; - out.println(" "); + out.println(" "); } diff --git a/src/java/org/ufcspa/simdecs/comunicacao/MetodoParaGravarLog.java b/src/java/org/ufcspa/simdecs/comunicacao/MetodoParaGravarLog.java deleted file mode 100644 index 47d76e9..0000000 --- a/src/java/org/ufcspa/simdecs/comunicacao/MetodoParaGravarLog.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package org.ufcspa.simdecs.comunicacao; - - -import java.io.IOException; -import java.io.PrintWriter; -import java.text.ParseException; -import java.util.Date; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.NoResultException; -import javax.persistence.Persistence; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import org.ufcspa.simdecs.util.UtilitarioSql; -import org.ufcspa.simdecs.entities.TipoEventoLog; - -/** - * - * @author pbarros - */ -public class MetodoParaGravarLog extends HttpServlet { - - /** - * Processes requests for both HTTP - * GET and - * POST methods. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - - protected void processRequest(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException, ParseException { - HttpSession session = request.getSession(true); - session.getId(); - - Date dt = new Date(); - Long idLong = new Long(request.getParameter("id")); - Long paramTipoLog = new Long(request.getParameter("tipoLog")); - UtilitarioSql util = new UtilitarioSql(); - PrintWriter out = response.getWriter(); - //response.setContentType("text/html;charset=UTF-8"); - /* - * - * 1 Iniciar simulador - * 2 Caso - * 3 Ficha do paciente - * 4 Sinais / Sintomas - * 5 Exames complementares - * 6 Diagnóstico - * 7 Tratamento - * 8 Auxílio pedagógico - * 9 Intervenção do Mediador - */ - response.setContentType( "text/xml" ); - response.setHeader( "Cache-Control", "no-cache" ); - out.println( "" ); - - EntityManagerFactory emf = Persistence.createEntityManagerFactory("simdecsPU"); - EntityManager em = emf.createEntityManager(); - em.getTransaction().begin(); - //Log lg = new Log(); - TipoEventoLog tipo; - - try { - tipo = (TipoEventoLog) em.createQuery("select tipo from TipoEventoLog as tp where tp.id=:idTipo") - .setParameter("idTipo", paramTipoLog) - .getSingleResult(); - - // System.out.print(tipo.getId()); - System.out.print(tipo.getNome()); -// lg.setDatalog(util.converteDataUtilToSql(dt)); -// lg.setDescricaolog(request.getParameter("log")); -// lg.setTipo(tipo); -// lg.setHoralog(dt); -// lg.setUsuid(idLong); - }catch (NoResultException ne){ - out.printf("Erro de tipo"); - } finally { - // em.persist(tipo); - //em.persist(lg); - em.getTransaction().commit(); - } -/* - RespostaMediador resp; - try { - em.getTransaction().begin(); - resp = (RespostaMediador) em.createQuery("select resposta from RespostaMediador as resposta where resposta.idUsuario=:id and resposta.dataResposta is null" ) - .setParameter("id", idLong) - //.setParameter("data",dtNull ) - .getSingleResult(); - if(resp.getId()>0) - { - out.println( "" + String.valueOf(resp.getId()) + "" ); - out.println("" + resp.getNome() + ""); - out.println("" + resp.getEndArquivo() + ""); - resp.setDataResposta(util.converteDataUtilToSql(dt)); - } - else - { - out.println( "0" ); - out.println(""); - out.println(""); - } -// out.println("OK "+ user.getId()); -// out.close(); - } catch (NoResultException ne) { - -// request.setAttribute("id","0"); -// out.println("Usuario ou senha Inválido "); - out.println( "" + "0" + "" ); - - } finally { - //em.persist(lg); - em.getTransaction().commit(); - out.println( "" ); - out.close(); - } - -*/ - } - - // - /** - * Handles the HTTP - * GET method. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - - - /** - * Handles the HTTP - * POST method. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - @Override - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - try { - processRequest(request, response); - } catch (ParseException ex) { - Logger.getLogger(MetodoParaGravarLog.class.getName()).log(Level.SEVERE, null, ex); - } - } - - /** - * Returns a short description of the servlet. - * - * @return a String containing servlet description - */ - @Override - public String getServletInfo() { - return "Short description"; - }// -} diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml index 1c8cfe6..3ac3e09 100644 --- a/web/WEB-INF/web.xml +++ b/web/WEB-INF/web.xml @@ -21,6 +21,10 @@ MetodoIniciaCaso org.ufcspa.simdecs.comunicacao.MetodoIniciaCaso + + MetodoGravaLog + org.ufcspa.simdecs.comunicacao.MetodoGravaLog + Faces Servlet *.jsf @@ -37,6 +41,10 @@ MetodoIniciaCaso /MetodoIniciaCaso + + MetodoGravaLog + /MetodoGravaLog + 30 diff --git a/web/editarcasos/editarCaso.xhtml b/web/editarcasos/editarCaso.xhtml index 265043a..daae159 100644 --- a/web/editarcasos/editarCaso.xhtml +++ b/web/editarcasos/editarCaso.xhtml @@ -225,11 +225,11 @@ - +     - +     - +