(no commit message)
[simdecs2.git] / src / java / org / ufcspa / simdecs / entities / RespostaNodo.java
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();
-    }    
 }