Nova versao do simulador e tratamento de erros das chamadas.
[simdecs2.git] / src / java / org / ufcspa / simdecs / entities / Caso.java
CommitLineData
ae815b9b
MS
1/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5package org.ufcspa.simdecs.entities;
6
7import java.io.Serializable;
8import java.util.List;
9import javax.persistence.Column;
10import javax.persistence.Entity;
11import javax.persistence.GeneratedValue;
12import javax.persistence.GenerationType;
13import javax.persistence.Id;
14import javax.persistence.JoinColumn;
15import javax.persistence.ManyToOne;
16import javax.persistence.OneToMany;
17import javax.persistence.SequenceGenerator;
18import org.hibernate.annotations.Index;
19import org.hibernate.annotations.Table;
20
21/**
22 *
23 * @author maroni
24 */
25@Entity
26@Table(appliesTo="Caso",
27 indexes= {
28 @Index(name="caso_usu_ix", columnNames="usu_id"),
29 @Index(name="caso_nome_ix", columnNames="nome")
30 }
31 )
32public class Caso implements Serializable {
33
34 private static final long serialVersionUID = 1L;
35
36 @Id
37 @SequenceGenerator(name="seqCaso", sequenceName="SQ_CASO")
38 @GeneratedValue(strategy = GenerationType.AUTO, generator="seqCaso")
39 private Long id;
40
41 @Column(nullable=false, length=300)
42 private String nome;
43
44 @Column(nullable=false, length=4000)
45 private String textoInicial;
46
47 @Column(nullable=false, length=4000)
48 private String resumo;
49
368b48a1 50 @Column(nullable=false, length=20)
51 private String modelo;
52
ae815b9b
MS
53 @ManyToOne
54 @JoinColumn(name="usu_id", nullable=false)
55 private Usuario usuario;
56
57 @OneToMany(mappedBy="caso")
58 private List<Paciente> pacientes;
59
60 public Usuario getUsuario() {
61 return usuario;
62 }
63
64 public void setUsuario(Usuario usuario) {
65 this.usuario = usuario;
66 }
67
68 public String getNome() {
69 return nome;
70 }
71
72 public void setNome(String nome) {
73 this.nome = nome;
74 }
75
76 public String getResumo() {
77 return resumo;
78 }
79
80 public void setResumo(String resumo) {
81 this.resumo = resumo;
82 }
83
84 public String getTextoInicial() {
85 return textoInicial;
86 }
87
88 public void setTextoInicial(String textoInicial) {
89 this.textoInicial = textoInicial;
90 }
91
92
93
94 public Long getId() {
95 return id;
96 }
97
98 public void setId(Long id) {
99 this.id = id;
100 }
101
102 @Override
103 public int hashCode() {
104 int hash = 0;
105 hash += (id != null ? id.hashCode() : 0);
106 return hash;
107 }
108
109 @Override
110 public boolean equals(Object object) {
ae815b9b
MS
111 if (!(object instanceof Caso)) {
112 return false;
113 }
114 Caso other = (Caso) object;
115 if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
116 return false;
117 }
118 return true;
119 }
120
121 @Override
122 public String toString() {
123 return "org.ufcspa.simdecs.entities.Caso[ id=" + id + " ]";
124 }
125
126 public List<Paciente> getPacientes() {
127 return pacientes;
128 }
129
130 public void setPacientes(List<Paciente> pacientes) {
131 this.pacientes = pacientes;
132 }
368b48a1 133
134 public String getModelo() {
135 return modelo;
136 }
137
138 public void setModelo(String modelo) {
139 this.modelo = modelo;
140 }
141
142
ae815b9b 143}