ad1046f55998e8ad7158db5d2fb104432ce98696
[simdecs2.git] / src / java / org / ufcspa / simdecs / entities / Nodo.java
1 /*
2  * To change this template, choose Tools | Templates
3  * and open the template in the editor.
4  */
5 package org.ufcspa.simdecs.entities;
6
7 import java.io.Serializable;
8 import java.util.List;
9 import javax.persistence.*;
10
11 /**
12  *
13  * @author maroni
14  */
15 @Entity
16 public class Nodo implements Serializable, IdHolder, Comparable<Nodo> {
17   
18     public static final String SINAL_SINTOMA        = "SINAL_SINTOMA";
19     public static final String HISTORICO            = "HISTORICO";
20     public static final String EXAME_FISICO         = "EXAME_FISICO";
21     public static final String EXAME_COMPLEMENTAR   = "EXAME_COMPLEMENTAR";
22     public static final String DIAGNOSTICO          = "DIAGNOSTICO";
23     public static final String CONDUTA              = "CONDUTA";
24     
25     
26     private static final long serialVersionUID = 1L;
27     @Id
28     @SequenceGenerator(name="SeqNodo", sequenceName="SQ_NODO")
29     @GeneratedValue(strategy = GenerationType.AUTO, generator="SeqNodo")
30     private Long id;
31     
32     @Column(nullable=false, length=100)
33     private String nome;
34
35     @Column(nullable=true, length=100)
36     private String nomeAmigavel;
37
38     @Column(nullable=true)
39     private Integer tempo;
40
41     @Column(nullable=true)
42     private Float custo;
43
44     @Column(nullable=true, length=30)
45     private String tipo;
46
47     @Column(nullable=true)
48     private Boolean bogus;
49
50     @OneToMany(cascade = javax.persistence.CascadeType.ALL, mappedBy="nodo")
51     private List<PerguntaNodo> perguntas;
52     
53     @ManyToOne
54     @JoinColumn(name="rede_id", nullable=false)
55     private Rede rede;
56
57     public Long getId() {
58         return id;
59     }
60
61     public void setId(Long id) {
62         this.id = id;
63     }
64     
65     @Override
66     public boolean equals(Object obj) {
67         if (obj == null) {
68             return false;
69         }
70         if (getClass() != obj.getClass()) {
71             return false;
72         }
73         final Nodo other = (Nodo) obj;
74         if ((this.nome == null) ? (other.nome != null) : !this.nome.equals(other.nome)) {
75             return false;
76         }
77         return true;
78     }
79
80     @Override
81     public int hashCode() {
82         int hash = 3;
83         hash = 17 * hash + (this.nome != null ? this.nome.hashCode() : 0);
84         return hash;
85     }
86
87     
88
89     @Override
90     public String toString() {
91         return "org.ufcspa.simdecs.entities.Nodo[ nome=" + nome + " ]";
92     }
93
94     public Float getCusto() {
95         return custo;
96     }
97
98     public void setCusto(Float custo) {
99         this.custo = custo;
100     }
101
102     public String getNome() {
103         return nome;
104     }
105
106     public void setNome(String nome) {
107         this.nome = nome;
108     }
109
110     public String getNomeAmigavel() {
111         return nomeAmigavel;
112     }
113
114     public void setNomeAmigavel(String nomeAmigavel) {
115         this.nomeAmigavel = nomeAmigavel;
116     }
117
118     public Rede getRede() {
119         return rede;
120     }
121
122     public void setRede(Rede rede) {
123         this.rede = rede;
124     }
125
126     public Integer getTempo() {
127         return tempo;
128     }
129
130     public void setTempo(Integer tempo) {
131         this.tempo = tempo;
132     }
133
134     public String getTipo() {
135         return tipo;
136     }
137
138     public void setTipo(String tipo) {
139         this.tipo = tipo;
140     }
141
142     public Boolean getBogus() {
143         return bogus;
144     }
145
146     public void setBogus(Boolean bogus) {
147         this.bogus = bogus;
148     }
149
150     public List<PerguntaNodo> getPerguntas() {
151         return perguntas;
152     }
153
154     public void setPerguntas(List<PerguntaNodo> perguntas) {
155         this.perguntas = perguntas;
156     }
157
158     @Override
159     public int compareTo(Nodo t) {
160         return t.getId().intValue() - this.getId().intValue();
161     }
162
163     
164 }