(no commit message)
authormaroni <maroni@192.168.1.103>
Wed, 15 Feb 2012 15:45:41 +0000 (13:45 -0200)
committermaroni <maroni@192.168.1.103>
Wed, 15 Feb 2012 15:45:41 +0000 (13:45 -0200)
src/java/org/ufcspa/simdecs/comunicacao/MetodoGravaLog.java [new file with mode: 0644]
src/java/org/ufcspa/simdecs/comunicacao/MetodoIniciaCaso.java
src/java/org/ufcspa/simdecs/comunicacao/MetodoParaGravarLog.java [deleted file]
web/WEB-INF/web.xml
web/editarcasos/editarCaso.xhtml

diff --git a/src/java/org/ufcspa/simdecs/comunicacao/MetodoGravaLog.java b/src/java/org/ufcspa/simdecs/comunicacao/MetodoGravaLog.java
new file mode 100644 (file)
index 0000000..5828679
--- /dev/null
@@ -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
+     * <code>GET</code> and
+     * <code>POST</code> 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();
+        }
+    }
+
+    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
+    /**
+     * Handles the HTTP
+     * <code>GET</code> 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
+     * <code>POST</code> 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";
+    }// </editor-fold>
+}
index 14b72fd..86888af 100644 (file)
@@ -95,7 +95,7 @@ public class MetodoIniciaCaso extends HttpServlet {
                     if (!nodo.getNodo().getTipo().equals(Nodo.SINAL_SINTOMA))
                         continue;
                 
-                    out.println("                <sintoma uid=\"sintoma-" + nodo.getId() + "\" nomeCientifico=\"" + nodo.getNodo().getNome() + "\" nomePopular=\"" + nodo.getNodo().getNomeAmigavel() + "\" imagem=\"\" som=\"\" video=\"\" dependencia=\"" + getDependencia(nodo.getNodo().getId()) + "\" falaPaciente=\"" + getPerguntaNodo(nodo.getNodo().getId())  + "\">");
+                    out.println("                <sintoma uid=\"sintoma-" + nodo.getId() + "\" nomeCientifico=\"" + nodo.getNodo().getNome() + "\" nomePopular=\"" + nodo.getNodo().getNomeAmigavel() + "\" imagem=\"\" som=\"\" video=\"\" dependencia=\"" + getDependencia(nodo.getNodo().getId()) + "\" falaPaciente=\"" + getPerguntaNodo(nodo.getNodo().getId())  + "\" />");
                 }
                 out.println("            </perguntar_sintoma>");
 
@@ -105,7 +105,7 @@ public class MetodoIniciaCaso extends HttpServlet {
                     if (!nodo.getNodo().getTipo().equals(Nodo.EXAME_FISICO))
                         continue;
                 
-                    out.println("                <exame_fisico uid=\"exame-fisico-" + nodo.getId() + "\" dependencia=\"" + getDependencia(nodo.getNodo().getId()) + "\" descricao=\"" + nodo.getNodo().getNomeAmigavel() + "\" resultado=\"\" imagem=\"\" som=\"\" video=\"\">");
+                    out.println("                <exame_fisico uid=\"exame-fisico-" + nodo.getId() + "\" dependencia=\"" + getDependencia(nodo.getNodo().getId()) + "\" descricao=\"" + nodo.getNodo().getNomeAmigavel() + "\" resultado=\"\" imagem=\"\" som=\"\" video=\"\" />");
                 }
                 out.println("            </realiza_exame_fisico>");
 
@@ -115,7 +115,7 @@ public class MetodoIniciaCaso extends HttpServlet {
                     if (!nodo.getNodo().getTipo().equals(Nodo.EXAME_COMPLEMENTAR))
                         continue;
                 
-                    out.println("                <exame_complementar uid=\"exame-complementar-" + nodo.getId() + "\" dependencia=\"" + getDependencia(nodo.getNodo().getId()) + "\" descricao=\"" + nodo.getNodo().getNomeAmigavel() + "\" resultado=\"\" imagem=\"\" som=\"\" video=\"\">");
+                    out.println("                <exame_complementar uid=\"exame-complementar-" + nodo.getId() + "\" dependencia=\"" + getDependencia(nodo.getNodo().getId()) + "\" descricao=\"" + nodo.getNodo().getNomeAmigavel() + "\" resultado=\"\" imagem=\"\" som=\"\" video=\"\" />");
                 }
                 out.println("            </solicitar_exames_complementar>");
 
@@ -124,7 +124,7 @@ public class MetodoIniciaCaso extends HttpServlet {
                     if (!nodo.getNodo().getTipo().equals(Nodo.HISTORICO))
                         continue;
                 
-                    out.println("        <historico_medico uid=\"historico-medico-" + nodo.getId() + "\" dependencia=\"" + getDependencia(nodo.getNodo().getId()) + "\" descricao=\"Histórico Médico\" historico=\"" + nodo.getNodo().getNomeAmigavel() + "\" dependencia=\"\" imagem=\"\" som=\"\" video=\"\">");
+                    out.println("        <historico_medico uid=\"historico-medico-" + nodo.getId() + "\" dependencia=\"" + getDependencia(nodo.getNodo().getId()) + "\" descricao=\"Histórico Médico\" historico=\"" + nodo.getNodo().getNomeAmigavel() + "\" dependencia=\"\" imagem=\"\" som=\"\" video=\"\" />");
                 }
             
             
diff --git a/src/java/org/ufcspa/simdecs/comunicacao/MetodoParaGravarLog.java b/src/java/org/ufcspa/simdecs/comunicacao/MetodoParaGravarLog.java
deleted file mode 100644 (file)
index 47d76e9..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*\r
- * To change this template, choose Tools | Templates\r
- * and open the template in the editor.\r
- */\r
-package org.ufcspa.simdecs.comunicacao;\r
-\r
-\r
-import java.io.IOException;\r
-import java.io.PrintWriter;\r
-import java.text.ParseException;\r
-import java.util.Date;\r
-import java.util.logging.Level;\r
-import java.util.logging.Logger;\r
-import javax.persistence.EntityManager;\r
-import javax.persistence.EntityManagerFactory;\r
-import javax.persistence.NoResultException;\r
-import javax.persistence.Persistence;\r
-import javax.servlet.ServletException;\r
-import javax.servlet.http.HttpServlet;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-import javax.servlet.http.HttpSession;\r
-import org.ufcspa.simdecs.util.UtilitarioSql;\r
-import org.ufcspa.simdecs.entities.TipoEventoLog;\r
-\r
-/**\r
- *\r
- * @author pbarros\r
- */\r
-public class MetodoParaGravarLog extends HttpServlet {\r
-\r
-    /**\r
-     * Processes requests for both HTTP\r
-     * <code>GET</code> and\r
-     * <code>POST</code> methods.\r
-     *\r
-     * @param request servlet request\r
-     * @param response servlet response\r
-     * @throws ServletException if a servlet-specific error occurs\r
-     * @throws IOException if an I/O error occurs\r
-     */\r
-  \r
-    protected void processRequest(HttpServletRequest request, HttpServletResponse response)\r
-            throws ServletException, IOException, ParseException {\r
-       HttpSession session = request.getSession(true);\r
-       session.getId();\r
-\r
-        Date dt = new Date();\r
-        Long idLong = new Long(request.getParameter("id"));\r
-        Long paramTipoLog = new Long(request.getParameter("tipoLog"));\r
-        UtilitarioSql util = new UtilitarioSql();\r
-        PrintWriter out = response.getWriter();\r
-        //response.setContentType("text/html;charset=UTF-8");\r
-        /*\r
-         * \r
-         * 1 Iniciar simulador\r
-         * 2 Caso \r
-         * 3 Ficha do paciente \r
-         * 4 Sinais / Sintomas \r
-         * 5 Exames complementares \r
-         * 6 Diagnóstico \r
-         * 7 Tratamento \r
-         * 8 Auxílio pedagógico \r
-         * 9 Intervenção do Mediador \r
-         */        \r
-        response.setContentType( "text/xml" );\r
-        response.setHeader( "Cache-Control", "no-cache" );\r
-        out.println( "<xml>" );\r
-        \r
-        EntityManagerFactory emf = Persistence.createEntityManagerFactory("simdecsPU");\r
-        EntityManager em = emf.createEntityManager();\r
-        em.getTransaction().begin();\r
-        //Log lg = new Log();\r
-        TipoEventoLog tipo;\r
-        \r
-        try {\r
-                tipo = (TipoEventoLog) em.createQuery("select tipo from TipoEventoLog as tp where tp.id=:idTipo")\r
-                                                                                        .setParameter("idTipo", paramTipoLog)\r
-                                                                                        .getSingleResult();\r
-        \r
-      //  System.out.print(tipo.getId());\r
-        System.out.print(tipo.getNome());\r
-//        lg.setDatalog(util.converteDataUtilToSql(dt));        \r
-//        lg.setDescricaolog(request.getParameter("log"));\r
-//        lg.setTipo(tipo);\r
-//        lg.setHoralog(dt);\r
-//        lg.setUsuid(idLong);\r
-        }catch (NoResultException ne){\r
-                    out.printf("Erro de tipo");\r
-        } finally {\r
-           // em.persist(tipo);\r
-        //em.persist(lg);\r
-        em.getTransaction().commit();\r
-        }\r
-/*\r
-        RespostaMediador resp;\r
-        try {\r
-                em.getTransaction().begin();\r
-               resp = (RespostaMediador) em.createQuery("select resposta from RespostaMediador as resposta where resposta.idUsuario=:id and resposta.dataResposta is null" )\r
-                                                                               .setParameter("id", idLong)\r
-                                                                               //.setParameter("data",dtNull )\r
-                                                                               .getSingleResult();\r
-                if(resp.getId()>0)\r
-                {\r
-                    out.println( "<id>" + String.valueOf(resp.getId()) + "</id>" );\r
-                    out.println("<resposta>" + resp.getNome() + "</resposta>");\r
-                    out.println("<arquivo>" + resp.getEndArquivo() + "</arquivo>");\r
-                    resp.setDataResposta(util.converteDataUtilToSql(dt));\r
-                }\r
-                else \r
-                {\r
-                    out.println( "<id>0</id>" );\r
-                    out.println("<resposta></resposta>");\r
-                    out.println("<arquivo></arquivo>");\r
-                }\r
-//                out.println("OK "+ user.getId());\r
-//                out.close();\r
-       } catch (NoResultException ne) {\r
-            \r
-//             request.setAttribute("id","0");         \r
-//             out.println("Usuario ou senha Inválido ");\r
-                out.println( "<id>" + "0" + "</id>" );\r
-                \r
-       } finally {         \r
-            //em.persist(lg);\r
-            em.getTransaction().commit();\r
-            out.println( "</xml>" );\r
-            out.close();\r
-        }\r
-        \r
-*/\r
-    }\r
-\r
-    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">\r
-    /**\r
-     * Handles the HTTP\r
-     * <code>GET</code> method.\r
-     *\r
-     * @param request servlet request\r
-     * @param response servlet response\r
-     * @throws ServletException if a servlet-specific error occurs\r
-     * @throws IOException if an I/O error occurs\r
-     */\r
-\r
-\r
-    /**\r
-     * Handles the HTTP\r
-     * <code>POST</code> method.\r
-     *\r
-     * @param request servlet request\r
-     * @param response servlet response\r
-     * @throws ServletException if a servlet-specific error occurs\r
-     * @throws IOException if an I/O error occurs\r
-     */\r
-    @Override\r
-    protected void doPost(HttpServletRequest request, HttpServletResponse response)\r
-            throws ServletException, IOException {\r
-        try {\r
-            processRequest(request, response);\r
-        } catch (ParseException ex) {\r
-            Logger.getLogger(MetodoParaGravarLog.class.getName()).log(Level.SEVERE, null, ex);\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Returns a short description of the servlet.\r
-     *\r
-     * @return a String containing servlet description\r
-     */\r
-    @Override\r
-    public String getServletInfo() {\r
-        return "Short description";\r
-    }// </editor-fold>\r
-}\r
index 1c8cfe6..3ac3e09 100644 (file)
         <servlet-name>MetodoIniciaCaso</servlet-name>
         <servlet-class>org.ufcspa.simdecs.comunicacao.MetodoIniciaCaso</servlet-class>
     </servlet>
+    <servlet>
+        <servlet-name>MetodoGravaLog</servlet-name>
+        <servlet-class>org.ufcspa.simdecs.comunicacao.MetodoGravaLog</servlet-class>
+    </servlet>
     <servlet-mapping>
         <servlet-name>Faces Servlet</servlet-name>
         <url-pattern>*.jsf</url-pattern>
         <servlet-name>MetodoIniciaCaso</servlet-name>
         <url-pattern>/MetodoIniciaCaso</url-pattern>
     </servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>MetodoGravaLog</servlet-name>
+        <url-pattern>/MetodoGravaLog</url-pattern>
+    </servlet-mapping>
     <session-config>
         <session-timeout>
             30
index 265043a..daae159 100644 (file)
                         </td>
                     </tr>
                 </table>
-                <p:commandButton id="criar" update=":pSelecionarPaciente, :listaPacientes, :messageGrow" oncomplete="pEditarPaciente.hide();" action="#{editarCasoBean.adicionarPaciente()}" value="Criar o novo paciente" />
+                <p:commandButton id="criar" update=":pSelecionarPaciente, :fPaciente:listaPacientes, :messageGrow" oncomplete="pEditarPaciente.hide();" action="#{editarCasoBean.adicionarPaciente()}" value="Criar o novo paciente" />
                 &nbsp;&nbsp;&nbsp;
-                <p:commandButton id="editar" update=":pSelecionarPaciente, :listaPacientes, :messageGrow" oncomplete="pEditarPaciente.hide();" action="#{editarCasoBean.editarPaciente()}" value="Salvar" />
+                <p:commandButton id="editar" update=":pSelecionarPaciente, :fPaciente:listaPacientes, :messageGrow" oncomplete="pEditarPaciente.hide();" action="#{editarCasoBean.editarPaciente()}" value="Salvar" />
                 &nbsp;&nbsp;&nbsp;
-                <p:commandButton id="excluir" update=":pSelecionarPaciente, :listaPacientes, :messageGrow" oncomplete="pEditarPaciente.hide();" action="#{editarCasoBean.excluirPaciente()}" value="Excluir" />
+                <p:commandButton id="excluir" update=":pSelecionarPaciente, :fPaciente:listaPacientes, :messageGrow" oncomplete="pEditarPaciente.hide();" action="#{editarCasoBean.excluirPaciente()}" value="Excluir" />
                 &nbsp;&nbsp;&nbsp;
                 <p:commandButton onclick="pEditarPaciente.hide();" value="Cancelar" type="button" />