(no commit message)
authormaroni <maroni@192.168.1.103>
Wed, 14 Mar 2012 16:53:23 +0000 (13:53 -0300)
committermaroni <maroni@192.168.1.103>
Wed, 14 Mar 2012 16:53:23 +0000 (13:53 -0300)
src/conf/persistence.xml
src/java/org/ufcspa/simdecs/entities/IntervaloTabelaRespota.java [new file with mode: 0644]
src/java/org/ufcspa/simdecs/entities/PerguntaNodo.java
src/java/org/ufcspa/simdecs/entities/RespostaNodo.java
src/java/org/ufcspa/simdecs/entities/TabelaResposta.java [new file with mode: 0644]
src/java/org/ufcspa/simdecs/mb/bn/RedeEditBean.java

index 0f4e6b5..9ccec6b 100644 (file)
@@ -5,6 +5,7 @@
     <non-jta-data-source>jdbc/SimDeCS</non-jta-data-source>
     <class>org.ufcspa.simdecs.entities.Caso</class>
     <class>org.ufcspa.simdecs.entities.DependenciaNodo</class>
+    <class>org.ufcspa.simdecs.entities.IntervaloTabelaRespota</class>
     <class>org.ufcspa.simdecs.entities.Log</class>
     <class>org.ufcspa.simdecs.entities.Nodo</class>
     <class>org.ufcspa.simdecs.entities.NodoPaciente</class>
@@ -15,6 +16,7 @@
     <class>org.ufcspa.simdecs.entities.RespostaNodo</class>
     <class>org.ufcspa.simdecs.entities.SessaoUsuario</class>
     <class>org.ufcspa.simdecs.entities.SinonimoResposta</class>
+    <class>org.ufcspa.simdecs.entities.TabelaResposta</class>
     <class>org.ufcspa.simdecs.entities.TipoEventoLog</class>
     <class>org.ufcspa.simdecs.entities.Usuario</class>
     <exclude-unlisted-classes>true</exclude-unlisted-classes>
diff --git a/src/java/org/ufcspa/simdecs/entities/IntervaloTabelaRespota.java b/src/java/org/ufcspa/simdecs/entities/IntervaloTabelaRespota.java
new file mode 100644 (file)
index 0000000..ffc634a
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * 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 maroni
+ */
+@Entity
+@Table(name="INTERVALO_TABELA_REPOSTA")
+public class IntervaloTabelaRespota implements Serializable {
+    private static final long serialVersionUID = 1L;
+    @Id
+    @SequenceGenerator(name="seqIntervaloTabelaResposta", sequenceName="SQ_INTERVALO_TABELA_RESPOSTA")
+    @GeneratedValue(strategy = GenerationType.AUTO, generator="seqIntervaloTabelaResposta")
+    private Long id;
+
+    @ManyToOne
+    @JoinColumn(name="tabres_id", nullable=false)
+    private TabelaResposta tabelaResposta;
+
+    @Column(nullable=false, length=3)
+    private Integer pesoMinimo;
+
+    @Column(nullable=false, length=3)
+    private Integer pesoMaximo;
+
+    @Column(nullable=false, length=2000)
+    private String texto;
+
+    public TabelaResposta getTabelaResposta() {
+        return tabelaResposta;
+    }
+
+    public void setTabelaResposta(TabelaResposta tabelaResposta) {
+        this.tabelaResposta = tabelaResposta;
+    }
+    
+    public Integer getPesoMaximo() {
+        return pesoMaximo;
+    }
+
+    public void setPesoMaximo(Integer pesoMaximo) {
+        this.pesoMaximo = pesoMaximo;
+    }
+
+    public Integer getPesoMinimo() {
+        return pesoMinimo;
+    }
+
+    public void setPesoMinimo(Integer pesoMinimo) {
+        this.pesoMinimo = pesoMinimo;
+    }
+
+    public String getTexto() {
+        return texto;
+    }
+
+    public void setTexto(String texto) {
+        this.texto = texto;
+    }
+
+    
+    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 IntervaloTabelaRespota)) {
+            return false;
+        }
+        IntervaloTabelaRespota other = (IntervaloTabelaRespota) 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.IntervaloTabelaRespota[ id=" + id + " ]";
+    }
+    
+}
index fc3f74b..607a6d7 100644 (file)
@@ -5,7 +5,6 @@
 package org.ufcspa.simdecs.entities;
 
 import java.io.Serializable;
-import java.util.List;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
@@ -13,7 +12,6 @@ import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
 import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 
@@ -23,7 +21,7 @@ import javax.persistence.Table;
  */
 @Entity
 @Table(name="PERGUNTA_NODO")
-public class PerguntaNodo implements Serializable, IdHolder, Comparable<PerguntaNodo> {
+public class PerguntaNodo implements Serializable {
     private static final long serialVersionUID = 1L;
     @Id
     @SequenceGenerator(name="SeqPerguntaNodo", sequenceName="SQ_PERGUNTA_NODO")
@@ -37,9 +35,9 @@ public class PerguntaNodo implements Serializable, IdHolder, Comparable<Pergunta
     @JoinColumn(name="nodo_id", nullable=false)
     private Nodo nodo;
 
-    @OneToMany(cascade = javax.persistence.CascadeType.ALL, mappedBy="pergunta")
-    private List<RespostaNodo> respostas;
-    
+    public PerguntaNodo() {
+    }
+
     public Long getId() {
         return id;
     }
@@ -48,29 +46,12 @@ public class PerguntaNodo implements Serializable, IdHolder, Comparable<Pergunta
         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 PerguntaNodo)) {
-            return false;
-        }
-        PerguntaNodo other = (PerguntaNodo) object;
-        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
-            return false;
-        }
-        return true;
+    public Nodo getNodo() {
+        return nodo;
     }
 
-    @Override
-    public String toString() {
-        return "org.ufcspa.simdecs.entities.PerguntaNodo[ id=" + id + " ]";
+    public void setNodo(Nodo nodo) {
+        this.nodo = nodo;
     }
 
     public String getTexto() {
@@ -81,25 +62,31 @@ public class PerguntaNodo implements Serializable, IdHolder, Comparable<Pergunta
         this.texto = texto;
     }
 
-    public Nodo getNodo() {
-        return nodo;
-    }
-
-    public void setNodo(Nodo nodo) {
-        this.nodo = nodo;
-    }
-
-    public List<RespostaNodo> getRespostas() {
-        return respostas;
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final PerguntaNodo other = (PerguntaNodo) obj;
+        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
+            return false;
+        }
+        return true;
     }
 
-    public void setRespostas(List<RespostaNodo> respostas) {
-        this.respostas = respostas;
+    @Override
+    public int hashCode() {
+        int hash = 5;
+        hash = 89 * hash + (this.id != null ? this.id.hashCode() : 0);
+        return hash;
     }
 
     @Override
-    public int compareTo(PerguntaNodo t) {
-        return t.getId().intValue()- this.getId().intValue();
+    public String toString() {
+        return "PerguntaNodo{" + "id=" + id + ", texto=" + texto + ", nodo=" + nodo + '}';
     }
-
+   
 }
index d167bbb..a5f0588 100644 (file)
@@ -5,8 +5,6 @@
 package org.ufcspa.simdecs.entities;
 
 import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
@@ -14,7 +12,6 @@ import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
 import javax.persistence.SequenceGenerator;
 import javax.persistence.Table;
 //
@@ -24,28 +21,25 @@ import javax.persistence.Table;
  */
 @Entity
 @Table(name="RESPOSTA_NODO")
-public class RespostaNodo implements Serializable, IdHolder, Comparable<RespostaNodo> {
+public class RespostaNodo implements Serializable {
+
     private static final long serialVersionUID = 1L;
+
     @Id
-    @SequenceGenerator(name="SeqRespotaNOdo", sequenceName="SQ_RESPOTA_NODO")
-    @GeneratedValue(strategy = GenerationType.AUTO)
+    @SequenceGenerator(name="SeqRespotaNodo", sequenceName="SQ_RESPOTA_NODO")
+    @GeneratedValue(strategy = GenerationType.AUTO, generator="SeqRespotaNodo")
     private Long id;
     
-    @Column(nullable=false, length=3)
-    private Integer pesoMinimo;
-
-    @Column(nullable=false, length=3)
-    private Integer pesoMaximo;
-
-    @ManyToOne
-    @JoinColumn(name="pergunta_id", nullable=false)
-    private PerguntaNodo pergunta;
+    @Column(nullable=false, length=2000)
+    private String texto;
     
-    @OneToMany(cascade = javax.persistence.CascadeType.ALL, mappedBy="resposta")
-    private List<SinonimoResposta> sinonimos;
+    @ManyToOne
+    @JoinColumn(name="nodo_id", nullable=false)
+    private Nodo nodo;
     
-    @Column(nullable=true, length=2000)
-    private String texto;
+    @ManyToOne
+    @JoinColumn(name="tabres_id", nullable=false)
+    private TabelaResposta tabelaResposta;
 
     public Long getId() {
         return id;
@@ -55,74 +49,58 @@ public class RespostaNodo implements Serializable, IdHolder, Comparable<Resposta
         this.id = id;
     }
 
-    @Override
-    public int hashCode() {
-        int hash = 0;
-        hash += (id != null ? id.hashCode() : 0);
-        return hash;
+    public Nodo getNodo() {
+        return nodo;
     }
 
-    @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 RespostaNodo)) {
-            return false;
-        }
-        RespostaNodo other = (RespostaNodo) object;
-        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
-            return false;
-        }
-        return true;
+    public void setNodo(Nodo nodo) {
+        this.nodo = nodo;
     }
 
-    @Override
-    public String toString() {
-        return "org.ufcspa.simdecs.entities.RespostaNodo[ id=" + id + " ]";
+    public String getTexto() {
+        return texto;
     }
 
-    public Integer getPesoMaximo() {
-        return pesoMaximo;
+    public void setTexto(String texto) {
+        this.texto = texto;
     }
 
-    public void setPesoMaximo(Integer pesoMaximo) {
-        this.pesoMaximo = pesoMaximo;
+    public TabelaResposta getTabelaResposta() {
+        return tabelaResposta;
     }
 
-    public Integer getPesoMinimo() {
-        return pesoMinimo;
+    public void setTabelaResposta(TabelaResposta tabelaResposta) {
+        this.tabelaResposta = tabelaResposta;
     }
 
-    public void setPesoMinimo(Integer pesoMinimo) {
-        this.pesoMinimo = pesoMinimo;
+    public RespostaNodo() {
     }
 
-    public PerguntaNodo getPergunta() {
-        return pergunta;
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        final RespostaNodo other = (RespostaNodo) obj;
+        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
+            return false;
+        }
+        return true;
     }
 
-    public void setPergunta(PerguntaNodo pergunta) {
-        this.pergunta = pergunta;
+    @Override
+    public int hashCode() {
+        int hash = 7;
+        hash = 67 * hash + (this.id != null ? this.id.hashCode() : 0);
+        return hash;
     }
 
-    
-    public List<SinonimoResposta> getSinonimos() {
-        return sinonimos;
+    @Override
+    public String toString() {
+        return "RespostaNodo{" + "id=" + id + ", texto=" + texto + ", nodo=" + nodo + '}';
     }
 
-    public void setSinonimos(List<SinonimoResposta> sinonimos) {
-        this.sinonimos = sinonimos;
-    }
-    
-    public void setTexto(String texto) {
-       this.texto = texto;            
-    }
-    
-    public String getTexto(){
-        return this.texto;
-    }
-    
-    @Override
-    public int compareTo(RespostaNodo t) {
-        return t.getId().intValue() - this.getId().intValue();
-    }    
 }
diff --git a/src/java/org/ufcspa/simdecs/entities/TabelaResposta.java b/src/java/org/ufcspa/simdecs/entities/TabelaResposta.java
new file mode 100644 (file)
index 0000000..8daa599
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * 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 maroni
+ */
+@Entity
+@Table(name="TABELA_RESPOSTA")
+public class TabelaResposta implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+    @Id
+    @SequenceGenerator(name="seqTabelaResposta", sequenceName="SQ_TABELA_RESPOSTA")
+    @GeneratedValue(strategy = GenerationType.AUTO, generator="seqTabelaResposta")
+    private Long id;
+    
+    @Column(nullable=false, length=100)
+    private String nome;
+
+    public String getNome() {
+        return nome;
+    }
+
+    public void setNome(String nome) {
+        this.nome = nome;
+    }
+
+    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 TabelaResposta)) {
+            return false;
+        }
+        TabelaResposta other = (TabelaResposta) 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.TabelaResposta[ id=" + id + " ]";
+    }
+    
+}
index 15b4be3..2cca545 100644 (file)
@@ -54,7 +54,7 @@ public class RedeEditBean extends DefaultManagedBean {
     public PerguntaNodo getSelectedPergunta() {
         return selectedPergunta;
     }
-
+/*
     public SimdecsDataModel getSelectablePerguntas() {
         if (selectedNodo != null && selectedNodo.getPerguntas() != null) {
             Collections.sort(selectedNodo.getPerguntas());
@@ -78,7 +78,7 @@ public class RedeEditBean extends DefaultManagedBean {
             return new SimdecsDataModel(new ArrayList());
         }
     }
-
+*/
     public RespostaNodo getSelectedResposta() {
         return selectedResposta;
     }
@@ -86,7 +86,7 @@ public class RedeEditBean extends DefaultManagedBean {
     public void setSelectedResposta(RespostaNodo selectedResposta) {
         this.selectedResposta = selectedResposta;
     }
-
+/*
     public void addPergunta() {
         if (selectedNodo != null) {
             try {
@@ -106,7 +106,7 @@ public class RedeEditBean extends DefaultManagedBean {
         }
 
     }
-
+*/
     public void removePergunta(PerguntaNodo pergunta) {
         try {
             em.getTransaction().begin();
@@ -117,7 +117,7 @@ public class RedeEditBean extends DefaultManagedBean {
         }
         addInfoMessage("Pergunta Removida", "Pergunta removida com sucesso.");
     }
-
+/*
     public void addResposta() {
         if (selectedPergunta != null) {
             try {
@@ -148,7 +148,7 @@ public class RedeEditBean extends DefaultManagedBean {
         }
         addInfoMessage("Resposta removida", "Resposta removida com sucesso.");
     }
-
+*/
     public void addNodo() {
         if (rede != null) {
             try {