From 99238cf01467d5a3f139009c8de71d3adacdfdcc Mon Sep 17 00:00:00 2001 From: maroni Date: Wed, 15 Feb 2012 10:17:27 -0200 Subject: [PATCH] --- src/conf/persistence.xml | 6 +- .../simdecs/comunicacao/MetodoAutenticacao.java | 233 +++++++++----------- .../simdecs/comunicacao/MetodoParaGravarLog.java | 8 +- .../simdecs/comunicacao/MetodoSelecionaCaso.java | 13 +- .../simdecs/comunicacao/MetodoSelecionaJogo.java | 11 +- .../simdecs/entities/ArgumentosPedagogicos.java | 74 ------ .../org/ufcspa/simdecs/entities/ArquivoCaso.java | 67 ------ src/java/org/ufcspa/simdecs/entities/Log.java | 163 ++++++++------- .../ufcspa/simdecs/entities/NivelConfianca.java | 66 ------ .../simdecs/entities/ProblemasPrincipais.java | 64 ------ .../ufcspa/simdecs/entities/RespostaMediador.java | 80 ------- .../org/ufcspa/simdecs/entities/SessaoUsuario.java | 81 +++++++ .../ufcspa/simdecs/entities/TaticasMediador.java | 71 ------ .../org/ufcspa/simdecs/entities/TipoEventoLog.java | 54 +++-- .../simdecs/mb/editarcasos/EditarCasoBean.java | 13 +- web/WEB-INF/web.xml | 18 +- 16 files changed, 341 insertions(+), 681 deletions(-) delete mode 100644 src/java/org/ufcspa/simdecs/entities/ArgumentosPedagogicos.java delete mode 100644 src/java/org/ufcspa/simdecs/entities/ArquivoCaso.java delete mode 100644 src/java/org/ufcspa/simdecs/entities/NivelConfianca.java delete mode 100644 src/java/org/ufcspa/simdecs/entities/ProblemasPrincipais.java delete mode 100644 src/java/org/ufcspa/simdecs/entities/RespostaMediador.java create mode 100644 src/java/org/ufcspa/simdecs/entities/SessaoUsuario.java delete mode 100644 src/java/org/ufcspa/simdecs/entities/TaticasMediador.java diff --git a/src/conf/persistence.xml b/src/conf/persistence.xml index ab86ebb..a3b17db 100644 --- a/src/conf/persistence.xml +++ b/src/conf/persistence.xml @@ -3,23 +3,19 @@ org.hibernate.ejb.HibernatePersistence jdbc/SimDeCS - org.ufcspa.simdecs.entities.ArgumentosPedagogicos org.ufcspa.simdecs.entities.ArquivoCaso org.ufcspa.simdecs.entities.Caso org.ufcspa.simdecs.entities.DependenciaNodo org.ufcspa.simdecs.entities.Log - org.ufcspa.simdecs.entities.NivelConfianca org.ufcspa.simdecs.entities.Nodo org.ufcspa.simdecs.entities.NodoPaciente org.ufcspa.simdecs.entities.Paciente org.ufcspa.simdecs.entities.PerguntaNodo - org.ufcspa.simdecs.entities.ProblemasPrincipais org.ufcspa.simdecs.entities.Rede org.ufcspa.simdecs.entities.RedeAluno - org.ufcspa.simdecs.entities.RespostaMediador org.ufcspa.simdecs.entities.RespostaNodo + org.ufcspa.simdecs.entities.SessaoUsuario org.ufcspa.simdecs.entities.SinonimoResposta - org.ufcspa.simdecs.entities.TaticasMediador org.ufcspa.simdecs.entities.TipoEventoLog org.ufcspa.simdecs.entities.Usuario true diff --git a/src/java/org/ufcspa/simdecs/comunicacao/MetodoAutenticacao.java b/src/java/org/ufcspa/simdecs/comunicacao/MetodoAutenticacao.java index 45265b9..2b3ed4b 100644 --- a/src/java/org/ufcspa/simdecs/comunicacao/MetodoAutenticacao.java +++ b/src/java/org/ufcspa/simdecs/comunicacao/MetodoAutenticacao.java @@ -1,126 +1,107 @@ -/* - * 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; -import javax.servlet.*; -import java.sql.*; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.NoResultException; -import javax.persistence.Persistence; -import javax.servlet.http.*; -import org.ufcspa.simdecs.entities.Log; -import org.ufcspa.simdecs.entities.Usuario; - -/** - * - * @author pbarros - * testye - */ -public class MetodoAutenticacao 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 - */ - private ServletConfig config; - public void init(ServletConfig config) - throws ServletException{ - this.config=config; - } - protected void processRequest(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - - PrintWriter out = response.getWriter(); - // alteracao solicitado mosmmann - //response.setContentType("text/html;charset=UTF-8"); - - response.setContentType( "text/xml" ); - response.setHeader( "Cache-Control", "no-cache" ); - ///para devolver arquivo anexo - //response.addHeader("Content-Disposition", "attachment; filename="+ "teste"); - //response.setContentType("text/html;charset=UTF-8"); - - //metodo antigo - //PrintWriter out = response.getWriter(); - EntityManagerFactory emf = Persistence.createEntityManagerFactory("simdecsPU"); - EntityManager em = emf.createEntityManager(); - out.println( "" ); - - Usuario user; - try { - user = (Usuario) em.createQuery("select usu from Usuario as usu where usu.login=:login and usu.senha=:senha") - .setParameter("login", request.getParameter("user")) - .setParameter("senha", request.getParameter("pass")) - .getSingleResult(); - - out.println( "" + String.valueOf(user.getId()) + "" ); -// 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 { - 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 - */ - @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"; - }// -} +/* + * 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; +import javax.servlet.*; +import javax.persistence.EntityManager; +import javax.persistence.NoResultException; +import org.ufcspa.simdecs.entities.Usuario; +import org.ufcspa.simdecs.util.DbUtil; + +/** + * + * @author pbarros + */ +public class MetodoAutenticacao 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 + */ + private ServletConfig config; + public void init(ServletConfig config) + throws ServletException{ + this.config=config; + } + protected void processRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException { + + PrintWriter out = response.getWriter(); + + response.setContentType( "text/xml" ); + response.setHeader( "Cache-Control", "no-cache" ); + EntityManager em = DbUtil.getInstance().getEntityManager(); + + out.println( "" ); + + Usuario user; + try { + user = (Usuario) em.createQuery("select usu from Usuario as usu where usu.login=:login and usu.senha=:senha") + .setParameter("login", request.getParameter("user").toLowerCase()) + .setParameter("senha", request.getParameter("pass")) + .getSingleResult(); + + out.println( "" + String.valueOf(user.getId()) + "" ); + } catch (NoResultException ne) { + out.println( "" + "0" + "" ); + } finally { + 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 + */ + @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/MetodoParaGravarLog.java b/src/java/org/ufcspa/simdecs/comunicacao/MetodoParaGravarLog.java index 2c921e6..47d76e9 100644 --- a/src/java/org/ufcspa/simdecs/comunicacao/MetodoParaGravarLog.java +++ b/src/java/org/ufcspa/simdecs/comunicacao/MetodoParaGravarLog.java @@ -8,7 +8,6 @@ package org.ufcspa.simdecs.comunicacao; import java.io.IOException; import java.io.PrintWriter; import java.text.ParseException; -import java.text.SimpleDateFormat; import java.util.Date; import java.util.logging.Level; import java.util.logging.Logger; @@ -21,9 +20,6 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.ufcspa.simdecs.entities.Log; -import org.ufcspa.simdecs.entities.RespostaMediador; -import org.ufcspa.simdecs.entities.Usuario; import org.ufcspa.simdecs.util.UtilitarioSql; import org.ufcspa.simdecs.entities.TipoEventoLog; @@ -96,6 +92,7 @@ public class MetodoParaGravarLog extends HttpServlet { //em.persist(lg); em.getTransaction().commit(); } +/* RespostaMediador resp; try { em.getTransaction().begin(); @@ -116,7 +113,6 @@ public class MetodoParaGravarLog extends HttpServlet { out.println(""); out.println(""); } - // out.println("OK "+ user.getId()); // out.close(); } catch (NoResultException ne) { @@ -132,7 +128,7 @@ public class MetodoParaGravarLog extends HttpServlet { out.close(); } - +*/ } // diff --git a/src/java/org/ufcspa/simdecs/comunicacao/MetodoSelecionaCaso.java b/src/java/org/ufcspa/simdecs/comunicacao/MetodoSelecionaCaso.java index 2ec38d5..caaa6b6 100644 --- a/src/java/org/ufcspa/simdecs/comunicacao/MetodoSelecionaCaso.java +++ b/src/java/org/ufcspa/simdecs/comunicacao/MetodoSelecionaCaso.java @@ -4,20 +4,12 @@ */ package org.ufcspa.simdecs.comunicacao; -import java.io.BufferedInputStream; import java.io.IOException; import java.io.PrintWriter; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLConnection; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.Persistence; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.ufcspa.simdecs.entities.ArquivoCaso; /** * @@ -40,7 +32,7 @@ public class MetodoSelecionaCaso extends HttpServlet { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); //String file ; - +/* EntityManagerFactory emf = Persistence.createEntityManagerFactory("simdecsPU"); EntityManager em = emf.createEntityManager(); @@ -75,7 +67,8 @@ public class MetodoSelecionaCaso extends HttpServlet { out.close(); buf.close(); } - } +*/ + } // /** diff --git a/src/java/org/ufcspa/simdecs/comunicacao/MetodoSelecionaJogo.java b/src/java/org/ufcspa/simdecs/comunicacao/MetodoSelecionaJogo.java index 82e73e2..ec025e9 100644 --- a/src/java/org/ufcspa/simdecs/comunicacao/MetodoSelecionaJogo.java +++ b/src/java/org/ufcspa/simdecs/comunicacao/MetodoSelecionaJogo.java @@ -5,16 +5,10 @@ package org.ufcspa.simdecs.comunicacao; import java.io.IOException; -import java.io.PrintWriter; -import java.util.List; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.Persistence; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.ufcspa.simdecs.entities.ArquivoCaso; /** * @@ -34,7 +28,7 @@ public class MetodoSelecionaJogo extends HttpServlet { */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - +/* PrintWriter out = response.getWriter(); // alteracao solicitado mosmmann //response.setContentType("text/html;charset=UTF-8"); @@ -93,7 +87,8 @@ public class MetodoSelecionaJogo extends HttpServlet { out.println( "" ); out.close(); } - } +*/ + } // /** diff --git a/src/java/org/ufcspa/simdecs/entities/ArgumentosPedagogicos.java b/src/java/org/ufcspa/simdecs/entities/ArgumentosPedagogicos.java deleted file mode 100644 index 09d12c9..0000000 --- a/src/java/org/ufcspa/simdecs/entities/ArgumentosPedagogicos.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package org.ufcspa.simdecs.entities; - -import java.io.Serializable; -import javax.persistence.*; - - -/** - * - * @author pbarros - */ -@Entity -@Table(name="ArgumentosPedagogicos") -public class ArgumentosPedagogicos implements Serializable { - private static final long serialVersionUID = 1L; - - @SequenceGenerator(name="seqArgumentosPedagogicos", sequenceName="SQARGPED") - @GeneratedValue(strategy=GenerationType.AUTO, generator="seqArgumentosPedagogicos") - @Id - private Long Codigo; - - @Column(length=250) - private String Argumento; - - - @Column(length=250) - private String Expectativa; - - @Column(length=250) - private String Avaliacao; - - @Column - private Long CodTaticaMediador; - - public Long getCodigo() { return this.Codigo; } - public String getArgumento() { return this.Argumento; } - public void setArgumento(String Argumento) { this.Argumento = Argumento; } - public String getExpectativa() { return this.Expectativa; } - public void setExpectativa(String Expectativa) { this.Expectativa = Expectativa; } - public String getAvaliacao() { return this.Avaliacao; } - public void setAvaliacao(String Avaliacao) { this.Avaliacao = Avaliacao; } - public Long getCodTaticaMediador() { return this.CodTaticaMediador; } - public void setCodTaticaMediador(Long CodTaticaMediador) { this.CodTaticaMediador = CodTaticaMediador; } - - - @Override - public int hashCode() { - int hash = 0; - hash += (Codigo != null ? Codigo.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object object) { - // TODO: Warning - this method won't work in the case the id fields are not set - if (!(object instanceof ArgumentosPedagogicos)) { - return false; - } - ArgumentosPedagogicos other = (ArgumentosPedagogicos) object; - if ((this.Codigo == null && other.Codigo != null) || (this.Codigo != null && !this.Codigo.equals(other.Codigo))) { - return false; - } - return true; - } - - @Override - public String toString() { - return "org.ufcspa.simdecs.entidade.ArgumentosPedagogicos[ Codigo=" + Codigo + " ]"; - } - -} diff --git a/src/java/org/ufcspa/simdecs/entities/ArquivoCaso.java b/src/java/org/ufcspa/simdecs/entities/ArquivoCaso.java deleted file mode 100644 index 0c1fd74..0000000 --- a/src/java/org/ufcspa/simdecs/entities/ArquivoCaso.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package org.ufcspa.simdecs.entities; - -import java.io.Serializable; -import javax.persistence.*; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -/** - * - * @author pbarros - */ -@Entity -@Table(name="ArquivoCaso") -public class ArquivoCaso implements Serializable { - private static final long serialVersionUID = 1L; - - @SequenceGenerator(name="seqArqCaso", sequenceName="SQARQC") - @GeneratedValue(strategy=GenerationType.AUTO, generator="seqArqCaso") - @Id - private Long id; - - @Column(length=255) - private String nome; - - - @Column(length=255) - private String endArquivo; - - - public Long getId() { return this.id; } - public void setId(Long id) { this.id = id; } - public String getNome() { return this.nome; } - public void setNome(String name) { this.nome = name; } - public String getEndArquivo() { return this.endArquivo; } - public void setEndArquivo(String endArquivo) { this.endArquivo = endArquivo; } - - - @Override - public int hashCode() { - int hash = 0; - hash += (id != null ? id.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object object) { - // TODO: Warning - this method won't work in the case the id fields are not set - if (!(object instanceof ArquivoCaso)) { - return false; - } - ArquivoCaso other = (ArquivoCaso) object; - if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { - return false; - } - return true; - } - - @Override - public String toString() { - return "org.ufcspa.simdecs.entidade.ArquivoCaso[ id=" + id + " ]"; - } - -} diff --git a/src/java/org/ufcspa/simdecs/entities/Log.java b/src/java/org/ufcspa/simdecs/entities/Log.java index febcdd2..1e3bcf7 100644 --- a/src/java/org/ufcspa/simdecs/entities/Log.java +++ b/src/java/org/ufcspa/simdecs/entities/Log.java @@ -7,9 +7,6 @@ package org.ufcspa.simdecs.entities; import java.io.Serializable; import java.util.Date; import javax.persistence.*; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; -import javax.xml.bind.annotation.XmlRootElement; /** * @@ -17,128 +14,144 @@ import javax.xml.bind.annotation.XmlRootElement; */ @Entity @Table(name = "log") -@XmlRootElement -@NamedQueries({ - @NamedQuery(name = "Log.findAll", query = "SELECT l FROM Log l"), - @NamedQuery(name = "Log.findByIdlog", query = "SELECT l FROM Log l WHERE l.idlog = :idlog"), - @NamedQuery(name = "Log.findByDescricaolog", query = "SELECT l FROM Log l WHERE l.descricaolog = :descricaolog"), - @NamedQuery(name = "Log.findByUsuid", query = "SELECT l FROM Log l WHERE l.usuid = :usuid"), - @NamedQuery(name = "Log.findByDatalog", query = "SELECT l FROM Log l WHERE l.datalog = :datalog"), - @NamedQuery(name = "Log.findByHoralog", query = "SELECT l FROM Log l WHERE l.horalog = :horalog")}) public class Log implements Serializable { + private static final long serialVersionUID = 1L; + @Id @SequenceGenerator(name="seqLog", sequenceName="SQLOG") @GeneratedValue(strategy=GenerationType.AUTO, generator="seqLog") - @Basic(optional = false) - @NotNull - @Column(name = "idlog") - private Integer idlog; - @Basic(optional = false) - @NotNull - @Size(min = 1, max = 200) + @Column(name = "idlog", nullable=false) + private Integer id; + @Column(nullable=false) + @Temporal(TemporalType.TIMESTAMP) + private Date data; + + @ManyToOne + @JoinColumn(name="tipo_id", nullable=false) + private TipoEventoLog tipo; + @ManyToOne - @JoinColumn(name="tipo_id") - private TipoEventoLog tipo; + @JoinColumn(name="sessao_id", nullable=false) + private SessaoUsuario sessaoUsuario; - @Column(name = "descricaolog") - private String descricaolog; - @Basic(optional = false) - @NotNull - @Column(name = "usuid") - private long usuid; - @Column(name = "datalog") - @Temporal(TemporalType.DATE) - private Date datalog; - @Column(name = "horalog") - @Temporal(TemporalType.TIME) - private Date horalog; + @ManyToOne + @JoinColumn(name="caso_id", nullable=true) + private Caso caso; + + @ManyToOne + @JoinColumn(name="paciente_id", nullable=true) + private Paciente paciente; + + @ManyToOne + @JoinColumn(name="nodo_id", nullable=true) + private Nodo nodo; - public Log() { + @ManyToOne + @JoinColumn(name="rede_id", nullable=true) + private Rede rede; + + @Column(name = "descricao") + private String descricao; + + public Caso getCaso() { + return caso; } - public Log(Integer idlog) { - this.idlog = idlog; + public void setCaso(Caso caso) { + this.caso = caso; } - public Log(Integer idlog, String descricaolog, long usuid) { - this.idlog = idlog; - this.descricaolog = descricaolog; - this.usuid = usuid; + public Date getData() { + return data; } - public Integer getIdlog() { - return idlog; + public void setData(Date data) { + this.data = data; } - public void setIdlog(Integer idlog) { - this.idlog = idlog; + public String getDescricao() { + return descricao; } - public String getDescricaolog() { - return descricaolog; + public void setDescricao(String descricao) { + this.descricao = descricao; } - public void setDescricaolog(String descricaolog) { - this.descricaolog = descricaolog; + public Integer getId() { + return id; } - public TipoEventoLog getTipo() { - return tipo; + public void setId(Integer id) { + this.id = id; } - public void setTipo(TipoEventoLog tipo) { - this.tipo = tipo; + public Nodo getNodo() { + return nodo; } - - public long getUsuid() { - return usuid; + + public void setNodo(Nodo nodo) { + this.nodo = nodo; } - public void setUsuid(long usuid) { - this.usuid = usuid; + public Paciente getPaciente() { + return paciente; } - public Date getDatalog() { - return datalog; + public void setPaciente(Paciente paciente) { + this.paciente = paciente; } - public void setDatalog(Date datalog) { - this.datalog = datalog; + public Rede getRede() { + return rede; } - public Date getHoralog() { - return horalog; + public void setRede(Rede rede) { + this.rede = rede; } - public void setHoralog(Date horalog) { - this.horalog = horalog; + public SessaoUsuario getSessaoUsuario() { + return sessaoUsuario; } - @Override - public int hashCode() { - int hash = 0; - hash += (idlog != null ? idlog.hashCode() : 0); - return hash; + public void setSessaoUsuario(SessaoUsuario sessaoUsuario) { + this.sessaoUsuario = sessaoUsuario; + } + + public TipoEventoLog getTipo() { + return tipo; + } + + public void setTipo(TipoEventoLog tipo) { + this.tipo = tipo; } @Override - public boolean equals(Object object) { - // TODO: Warning - this method won't work in the case the id fields are not set - if (!(object instanceof Log)) { + public boolean equals(Object obj) { + if (obj == null) { return false; } - Log other = (Log) object; - if ((this.idlog == null && other.idlog != null) || (this.idlog != null && !this.idlog.equals(other.idlog))) { + if (getClass() != obj.getClass()) { + return false; + } + final Log other = (Log) obj; + if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) { return false; } return true; } @Override + public int hashCode() { + int hash = 5; + hash = 97 * hash + (this.id != null ? this.id.hashCode() : 0); + return hash; + } + + @Override public String toString() { - return "org.ufcspa.simdecs.entidade.Log[ idlog=" + idlog + " ]"; + return "Log{" + "id=" + id + ", data=" + data + ", tipo=" + tipo + ", sessaoUsuario=" + sessaoUsuario + ", caso=" + caso + ", paciente=" + paciente + ", nodo=" + nodo + ", rede=" + rede + ", descricao=" + descricao + '}'; } } diff --git a/src/java/org/ufcspa/simdecs/entities/NivelConfianca.java b/src/java/org/ufcspa/simdecs/entities/NivelConfianca.java deleted file mode 100644 index 9af48bb..0000000 --- a/src/java/org/ufcspa/simdecs/entities/NivelConfianca.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package org.ufcspa.simdecs.entities; - - -import java.io.Serializable; -import javax.persistence.*; - -/** - * - * @author pbarros - */ -@Entity -@Table(name="NivelConfianca") -public class NivelConfianca implements Serializable { - private static final long serialVersionUID = 1L; - - @SequenceGenerator(name="seqNivelConfianca", sequenceName="SQNIVCON") - @GeneratedValue(strategy=GenerationType.AUTO, generator="seqNivelConfianca") - @Id - private Long Codigo; - - @Column(length=10) - private String Nome; - - - @Column(length=250) - private String Descricao; - - - public Long getCodigo() { return this.Codigo; } - public void setCodigo(Long Codigo) { this.Codigo = Codigo; } - public String getNome() { return this.Nome; } - public void setNome(String Nome) { this.Nome = Nome; } - public String getDescricao() { return this.Descricao; } - public void setDescricao(String Descricao) { this.Descricao = Descricao; } - - - @Override - public int hashCode() { - int hash = 0; - hash += (Codigo != null ? Codigo.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object object) { - // TODO: Warning - this method won't work in the case the id fields are not set - if (!(object instanceof NivelConfianca)) { - return false; - } - NivelConfianca other = (NivelConfianca) object; - if ((this.Codigo == null && other.Codigo != null) || (this.Codigo != null && !this.Codigo.equals(other.Codigo))) { - return false; - } - return true; - } - - @Override - public String toString() { - return "org.ufcspa.simdecs.entidade.NivelConfianca[ Codigo=" + Codigo + " ]"; - } - -} diff --git a/src/java/org/ufcspa/simdecs/entities/ProblemasPrincipais.java b/src/java/org/ufcspa/simdecs/entities/ProblemasPrincipais.java deleted file mode 100644 index a435069..0000000 --- a/src/java/org/ufcspa/simdecs/entities/ProblemasPrincipais.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package org.ufcspa.simdecs.entities; - -import java.io.Serializable; -import javax.persistence.*; -/** - * - * @author pbarros - */ -@Entity -@Table(name="ProblemasPrincipais") -public class ProblemasPrincipais implements Serializable { - private static final long serialVersionUID = 1L; - - @SequenceGenerator(name="seqProblemasPrincipais", sequenceName="SQPROPRI") - @GeneratedValue(strategy=GenerationType.AUTO, generator="seqProblemasPrincipais") - @Id - private Long Codigo; - - @Column(length=10) - private String Nome; - - - @Column(length=250) - private String Descricao; - - - public Long getCodigo() { return this.Codigo;} - public void setCodigo(Long Codigo) { this.Codigo = Codigo; } - public String getNome() { return this.Nome; } - public void setNome(String Nome) { this.Nome = Nome; } - public String getDescricao() { return this.Descricao; } - public void setDescricao(String Descricao) { this.Descricao = Descricao; } - - - @Override - public int hashCode() { - int hash = 0; - hash += (Codigo != null ? Codigo.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object object) { - // TODO: Warning - this method won't work in the case the id fields are not set - if (!(object instanceof ProblemasPrincipais)) { - return false; - } - ProblemasPrincipais other = (ProblemasPrincipais) object; - if ((this.Codigo == null && other.Codigo != null) || (this.Codigo != null && !this.Codigo.equals(other.Codigo))) { - return false; - } - return true; - } - - @Override - public String toString() { - return "org.ufcspa.simdecs.entidade.ProblemasPrincipais[ Codigo=" + Codigo + " ]"; - } - -} diff --git a/src/java/org/ufcspa/simdecs/entities/RespostaMediador.java b/src/java/org/ufcspa/simdecs/entities/RespostaMediador.java deleted file mode 100644 index 23249d3..0000000 --- a/src/java/org/ufcspa/simdecs/entities/RespostaMediador.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package org.ufcspa.simdecs.entities; - -import java.io.Serializable; -import java.util.Date; -import javax.persistence.*; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; - -/** - * - * @author pbarros - */ -@Entity -@Table(name="RespostaMediador") -public class RespostaMediador implements Serializable { - private static final long serialVersionUID = 1L; - - @SequenceGenerator(name="seqRespMediador", sequenceName="SQRESPM") - @GeneratedValue(strategy=GenerationType.AUTO, generator="seqRespMediador") - @Id - private Long id; - - @Column(length=255) - private String resposta; - - - @Column(length=255) - private String endArquivo; - - @Column - private Long idUsuario; - - @Column (nullable=true) - @Temporal(TemporalType.DATE) - private Date dataResposta; - - - - public Long getId() { return this.id; } - public void setId(Long id) { this.id = id; } - public String getNome() { return this.resposta; } - public void setNome(String name) { this.resposta = resposta; } - public String getEndArquivo() { return this.endArquivo; } - public void setEndArquivo(String endArquivo) { this.endArquivo = endArquivo; } - public Long getIdUsuario() { return this.idUsuario; } - public void setIdUsuario(Long idUsuario) { this.idUsuario = idUsuario; } - public Date getDataResposta() { return this.dataResposta; } - public void setDataResposta(Date dataResposta) { this.dataResposta = dataResposta; } - - - @Override - public int hashCode() { - int hash = 0; - hash += (id != null ? id.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object object) { - // TODO: Warning - this method won't work in the case the id fields are not set - if (!(object instanceof RespostaMediador)) { - return false; - } - RespostaMediador other = (RespostaMediador) object; - if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { - return false; - } - return true; - } - - @Override - public String toString() { - return "org.ufcspa.simdecs.entidade.RespostaMediador[ id=" + id + " ]"; - } - -} diff --git a/src/java/org/ufcspa/simdecs/entities/SessaoUsuario.java b/src/java/org/ufcspa/simdecs/entities/SessaoUsuario.java new file mode 100644 index 0000000..8f02323 --- /dev/null +++ b/src/java/org/ufcspa/simdecs/entities/SessaoUsuario.java @@ -0,0 +1,81 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package org.ufcspa.simdecs.entities; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.*; + +/** + * + * @author maroni + */ +@Entity +@Table(name="SESSAO_USUARIO") +public class SessaoUsuario implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @SequenceGenerator(name="seqSessaoUsuario", sequenceName="SQ_SESSAO_USUARIO") + @GeneratedValue(strategy = GenerationType.AUTO, generator="seqSessaoUsuario") + private Long id; + + @Temporal(TemporalType.TIMESTAMP) + @Column(nullable=false) + private Date data; + + @ManyToOne + @JoinColumn(nullable=false, name="usu_id") + private Usuario usuario; + + public Date getData() { + return data; + } + + public void setData(Date data) { + this.data = data; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (id != null ? id.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof SessaoUsuario)) { + return false; + } + SessaoUsuario other = (SessaoUsuario) object; + if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "org.ufcspa.simdecs.entities.SessaoUsuario[ id=" + id + " ]"; + } + +} diff --git a/src/java/org/ufcspa/simdecs/entities/TaticasMediador.java b/src/java/org/ufcspa/simdecs/entities/TaticasMediador.java deleted file mode 100644 index 2b102b7..0000000 --- a/src/java/org/ufcspa/simdecs/entities/TaticasMediador.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package org.ufcspa.simdecs.entities; -import java.io.Serializable; -import javax.persistence.*; - - -/** - * - * @author pbarros - */ -@Entity -@Table(name="TaticasMediador") -public class TaticasMediador implements Serializable { - private static final long serialVersionUID = 1L; - - @SequenceGenerator(name="seqTaticasMediador", sequenceName="SQTATMED") - @GeneratedValue(strategy=GenerationType.AUTO, generator="seqTaticasMediador") - @Id - private Long Codigo; - - @Column(length=50) - private String Tatica; - - - @Column(length=50) - private String Problema; - - @Column(length=500) - private String MensagemArgumento ; - - - public Long getCodigo() { return this.Codigo; } - public void setCodigo(Long Codigo) { this.Codigo = Codigo; } - public String getTatica() { return this.Tatica; } - public void setTatica(String Tatica) { this.Tatica = Tatica; } - public String getProblema() { return this.Problema; } - public void setProblema(String Problema) { this.Problema = Problema; } - public String getMensagemArgumento() { return this.MensagemArgumento; } - public void setMensagemArgumento(String MensagemArgumento) { this.MensagemArgumento = MensagemArgumento; } - - - - @Override - public int hashCode() { - int hash = 0; - hash += (Codigo != null ? Codigo.hashCode() : 0); - return hash; - } - - @Override - public boolean equals(Object object) { - // TODO: Warning - this method won't work in the case the id fields are not set - if (!(object instanceof TaticasMediador)) { - return false; - } - TaticasMediador other = (TaticasMediador) object; - if ((this.Codigo == null && other.Codigo != null) || (this.Codigo != null && !this.Codigo.equals(other.Codigo))) { - return false; - } - return true; - } - - @Override - public String toString() { - return "org.ufcspa.simdecs.entidade.TaticasMediador[ Codigo=" + Codigo + " ]"; - } - -} diff --git a/src/java/org/ufcspa/simdecs/entities/TipoEventoLog.java b/src/java/org/ufcspa/simdecs/entities/TipoEventoLog.java index c3909ae..f9b0a7d 100644 --- a/src/java/org/ufcspa/simdecs/entities/TipoEventoLog.java +++ b/src/java/org/ufcspa/simdecs/entities/TipoEventoLog.java @@ -21,39 +21,55 @@ public class TipoEventoLog implements Serializable { @SequenceGenerator(name="seqTipEveLog", sequenceName="SQTPEVLG") @GeneratedValue(strategy=GenerationType.AUTO, generator="seqTipEveLog") @Id - private Long id; + private String id; - @Column(length=255) + @Column(length=255, nullable=false) private String nome; - - public Long getId() { return this.id; } - public void setId(Long id) { this.id = id; } - public String getNome() { return this.nome; } - public void setNome(String name) { this.nome = name; } - - @Override - public int hashCode() { - int hash = 0; - hash += (id != null ? id.hashCode() : 0); - return hash; + + public TipoEventoLog() { + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getNome() { + return nome; + } + + public void setNome(String nome) { + this.nome = nome; } @Override - public boolean equals(Object object) { - // TODO: Warning - this method won't work in the case the id fields are not set - if (!(object instanceof TipoEventoLog)) { + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { return false; } - TipoEventoLog other = (TipoEventoLog) object; - if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { + final TipoEventoLog other = (TipoEventoLog) obj; + if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) { return false; } return true; } @Override + public int hashCode() { + int hash = 7; + hash = 37 * hash + (this.id != null ? this.id.hashCode() : 0); + return hash; + } + + @Override public String toString() { - return "org.ufcspa.simdecs.entidade.ArquivoCaso[ id=" + id + " ]"; + return "TipoEventoLog{" + "id=" + id + ", nome=" + nome + '}'; } } diff --git a/src/java/org/ufcspa/simdecs/mb/editarcasos/EditarCasoBean.java b/src/java/org/ufcspa/simdecs/mb/editarcasos/EditarCasoBean.java index 5afeccf..bbbbfeb 100644 --- a/src/java/org/ufcspa/simdecs/mb/editarcasos/EditarCasoBean.java +++ b/src/java/org/ufcspa/simdecs/mb/editarcasos/EditarCasoBean.java @@ -260,8 +260,11 @@ public class EditarCasoBean extends DefaultManagedBean { return ""; } + private String getDependencia(Long idNodo) { + return ""; + } + public void gerarXML() throws IOException { - System.out.println("TESTE GIT"); StringBuilder str = new StringBuilder(); str.append("\n"); @@ -284,7 +287,7 @@ public class EditarCasoBean extends DefaultManagedBean { if (!nodo.getNodo().getTipo().equals(Nodo.SINAL_SINTOMA)) continue; - str.append(" \n"); + str.append(" \n"); } str.append(" \n"); @@ -294,7 +297,7 @@ public class EditarCasoBean extends DefaultManagedBean { if (!nodo.getNodo().getTipo().equals(Nodo.EXAME_FISICO)) continue; - str.append(" \n"); + str.append(" \n"); } str.append(" \n"); @@ -304,7 +307,7 @@ public class EditarCasoBean extends DefaultManagedBean { if (!nodo.getNodo().getTipo().equals(Nodo.EXAME_COMPLEMENTAR)) continue; - str.append(" \n"); + str.append(" \n"); } str.append(" \n"); @@ -313,7 +316,7 @@ public class EditarCasoBean extends DefaultManagedBean { if (!nodo.getNodo().getTipo().equals(Nodo.HISTORICO)) continue; - str.append(" \n"); + str.append(" \n"); } diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml index 9f0863d..27f5175 100644 --- a/web/WEB-INF/web.xml +++ b/web/WEB-INF/web.xml @@ -9,10 +9,18 @@ javax.faces.webapp.FacesServlet 1 + + MetodoAutenticacao + org.ufcspa.simdecs.comunicacao.MetodoAutenticacao + Faces Servlet *.jsf + + MetodoAutenticacao + /MetodoAutenticacao + 30 @@ -21,14 +29,14 @@ login.jsf - - PrimeFaces FileUpload Filter + + PrimeFaces FileUpload Filter org.primefaces.webapp.filter.FileUploadFilter - - - PrimeFaces FileUpload Filter + + + PrimeFaces FileUpload Filter Faces Servlet -- 1.7.6.4