Commit | Line | Data |
---|---|---|
59e4c94a MS |
1 | package org.ufcspa.simdecs.entities;\r |
2 | \r | |
3 | import java.io.Serializable;\r | |
4 | import java.util.Date;\r | |
5 | \r | |
6 | import javax.persistence.Column;\r | |
7 | import javax.persistence.Entity;\r | |
8 | import javax.persistence.GeneratedValue;\r | |
9 | import javax.persistence.GenerationType;\r | |
10 | import javax.persistence.Id;\r | |
11 | import javax.persistence.JoinColumn;\r | |
12 | import javax.persistence.ManyToOne;\r | |
13 | import javax.persistence.SequenceGenerator;\r | |
14 | import javax.persistence.Table;\r | |
15 | import javax.persistence.Temporal;\r | |
16 | import javax.persistence.TemporalType;\r | |
17 | \r | |
18 | import org.hibernate.annotations.Index;\r | |
19 | \r | |
20 | @Entity\r | |
21 | @Table(name="CasoClinico")\r | |
22 | // Shortname: "caso"\r | |
23 | @SequenceGenerator(name = "sequenceCasoClinico", sequenceName = "sqCasoClinico", initialValue = 1, allocationSize=1)\r | |
24 | public class CasoClinico implements Serializable {\r | |
25 | \r | |
26 | /**\r | |
27 | * \r | |
28 | */\r | |
29 | private static final long serialVersionUID = 7701987863551764750L;\r | |
30 | \r | |
31 | @GeneratedValue(generator = "sequenceCasoClinico", strategy = GenerationType.AUTO)\r | |
32 | @Id\r | |
33 | private Long id;\r | |
34 | \r | |
35 | @Column(nullable=false, length=100)\r | |
36 | private String nome;\r | |
37 | \r | |
38 | @Column(nullable=false, length=400)\r | |
39 | private String autores;\r | |
40 | \r | |
41 | @Column(nullable=false)\r | |
42 | @Temporal(TemporalType.TIMESTAMP)\r | |
43 | private Date dataCriacao;\r | |
44 | \r | |
45 | @Column(length=1, nullable=false)\r | |
46 | private boolean concluido;\r | |
47 | \r | |
48 | @Column(length=32768, nullable=false)\r | |
49 | private String introducao;\r | |
50 | \r | |
51 | @ManyToOne\r | |
52 | @JoinColumn(name = "usu_id", referencedColumnName = "id", nullable = true)\r | |
53 | @Index(name="caso_usu_fk_i")\r | |
54 | private Usuario criadoPor;\r | |
55 | \r | |
56 | @ManyToOne\r | |
57 | @JoinColumn(name = "cena_id", referencedColumnName = "id", nullable = true)\r | |
58 | @Index(name="caso_cena_fk_i")\r | |
59 | private Cenario cenario;\r | |
60 | \r | |
61 | public Long getId() {\r | |
62 | return id;\r | |
63 | }\r | |
64 | \r | |
65 | public void setId(Long id) {\r | |
66 | this.id = id;\r | |
67 | }\r | |
68 | \r | |
69 | public String getNome() {\r | |
70 | return nome;\r | |
71 | }\r | |
72 | \r | |
73 | public void setNome(String nome) {\r | |
74 | this.nome = nome;\r | |
75 | }\r | |
76 | \r | |
77 | public String getAutores() {\r | |
78 | return autores;\r | |
79 | }\r | |
80 | \r | |
81 | public void setAutores(String autores) {\r | |
82 | this.autores = autores;\r | |
83 | }\r | |
84 | \r | |
85 | public Date getDataCriacao() {\r | |
86 | return dataCriacao;\r | |
87 | }\r | |
88 | \r | |
89 | public void setDataCriacao(Date dataCriacao) {\r | |
90 | this.dataCriacao = dataCriacao;\r | |
91 | }\r | |
92 | \r | |
93 | public boolean isConcluido() {\r | |
94 | return concluido;\r | |
95 | }\r | |
96 | \r | |
97 | public void setConcluido(boolean concluido) {\r | |
98 | this.concluido = concluido;\r | |
99 | }\r | |
100 | \r | |
101 | public String getIntroducao() {\r | |
102 | return introducao;\r | |
103 | }\r | |
104 | \r | |
105 | public void setIntroducao(String introducao) {\r | |
106 | this.introducao = introducao;\r | |
107 | }\r | |
108 | \r | |
109 | public Usuario getCriadoPor() {\r | |
110 | return criadoPor;\r | |
111 | }\r | |
112 | \r | |
113 | public void setCriadoPor(Usuario criadoPor) {\r | |
114 | this.criadoPor = criadoPor;\r | |
115 | }\r | |
116 | \r | |
117 | public Cenario getCenario() {\r | |
118 | return cenario;\r | |
119 | }\r | |
120 | \r | |
121 | public void setCenario(Cenario cenario) {\r | |
122 | this.cenario = cenario;\r | |
123 | }\r | |
124 | \r | |
125 | @Override\r | |
126 | public int hashCode() {\r | |
127 | final int prime = 31;\r | |
128 | int result = 1;\r | |
129 | result = prime * result + ((id == null) ? 0 : id.hashCode());\r | |
130 | return result;\r | |
131 | }\r | |
132 | \r | |
133 | @Override\r | |
134 | public boolean equals(Object obj) {\r | |
135 | if (this == obj)\r | |
136 | return true;\r | |
137 | if (obj == null)\r | |
138 | return false;\r | |
139 | if (getClass() != obj.getClass())\r | |
140 | return false;\r | |
141 | CasoClinico other = (CasoClinico) obj;\r | |
142 | if (id == null) {\r | |
143 | if (other.id != null)\r | |
144 | return false;\r | |
145 | } else if (!id.equals(other.id))\r | |
146 | return false;\r | |
147 | return true;\r | |
148 | }\r | |
149 | \r | |
150 | \r | |
151 | \r | |
152 | }\r |