Commit 989a41ed1ec822cdae3c2107e2266cac26ea63ac
1 parent
8a9f9e52
Exists in
master
Entidades.
Showing
5 changed files
with
136 additions
and
22 deletions
Show diff stats
src/br/com/model/entity/Formulario.java
src/br/com/model/entity/OpcaoResposta.java
1 | 1 | package br.com.model.entity; |
2 | 2 | |
3 | +import java.sql.ResultSet; | |
4 | + | |
5 | +import br.com.dao.OpcaoRespostaDao; | |
6 | + | |
3 | 7 | public class OpcaoResposta { |
4 | 8 | |
5 | 9 | private int idOpcaoResposta; |
6 | 10 | private String descOpcaoResposta; |
11 | + | |
12 | + public OpcaoResposta (){ | |
13 | + | |
14 | + } | |
15 | + | |
16 | + public OpcaoResposta (int idOpcaoResposta){ | |
17 | + ResultSet rset = null; | |
18 | + OpcaoRespostaDao opcaoRespostaDao = new OpcaoRespostaDao(); | |
19 | + | |
20 | + rset = opcaoRespostaDao.retornarOpcaoResposta(idOpcaoResposta); | |
21 | + | |
22 | + try { | |
23 | + while (rset.next()) { | |
24 | + this.idOpcaoResposta = idOpcaoResposta; | |
25 | + this.descOpcaoResposta = rset.getString("desc_opcao_resposta"); | |
26 | + } | |
27 | + } catch (Exception e) { | |
28 | + e.printStackTrace(); | |
29 | + } | |
30 | + } | |
31 | + | |
7 | 32 | public int getIdOpcaoResposta() { |
8 | 33 | return idOpcaoResposta; |
9 | 34 | } | ... | ... |
src/br/com/model/entity/Pergunta.java
1 | 1 | package br.com.model.entity; |
2 | 2 | |
3 | +import java.sql.ResultSet; | |
4 | + | |
5 | +import br.com.dao.PerguntaDao; | |
6 | + | |
3 | 7 | public class Pergunta { |
4 | 8 | |
5 | - private int idPergunta; | |
6 | - private String descPergunta; | |
7 | - | |
8 | - public int getIdPergunta() { | |
9 | - return idPergunta; | |
10 | - } | |
11 | - | |
12 | - public void setIdPergunta(int idPergunta) { | |
13 | - this.idPergunta = idPergunta; | |
14 | - } | |
15 | - | |
16 | - public String getDescPergunta() { | |
17 | - return descPergunta; | |
18 | - } | |
19 | - | |
20 | - public void setDescPergunta(String descPergunta) { | |
21 | - this.descPergunta = descPergunta; | |
22 | - } | |
23 | - | |
24 | - | |
9 | + private int idPergunta; | |
10 | + private String descPergunta; | |
11 | + | |
12 | + | |
13 | + public Pergunta() { | |
14 | + | |
15 | + } | |
16 | + | |
17 | + public Pergunta(int idPergunta) { | |
18 | + ResultSet rset = null; | |
19 | + PerguntaDao perguntaDao = new PerguntaDao(); | |
20 | + | |
21 | + rset = perguntaDao.retornarPergunta(idPergunta); | |
22 | + try { | |
23 | + while (rset.next()) { | |
24 | + this.idPergunta = idPergunta; | |
25 | + this.descPergunta = rset.getString("desc_pergunta"); | |
26 | + } | |
27 | + } catch (Exception e) { | |
28 | + e.printStackTrace(); | |
29 | + } | |
30 | + | |
31 | + | |
32 | + } | |
33 | + | |
34 | + public int getIdPergunta() { | |
35 | + return idPergunta; | |
36 | + } | |
37 | + | |
38 | + public void setIdPergunta(int idPergunta) { | |
39 | + this.idPergunta = idPergunta; | |
40 | + } | |
41 | + | |
42 | + public String getDescPergunta() { | |
43 | + return descPergunta; | |
44 | + } | |
45 | + | |
46 | + public void setDescPergunta(String descPergunta) { | |
47 | + this.descPergunta = descPergunta; | |
48 | + } | |
49 | + | |
50 | + | |
25 | 51 | } | ... | ... |
src/br/com/model/entity/Questionario.java
1 | 1 | package br.com.model.entity; |
2 | 2 | |
3 | 3 | import java.sql.Date; |
4 | +import java.sql.ResultSet; | |
5 | + | |
6 | +import br.com.dao.PerguntaDao; | |
7 | +import br.com.dao.QuestionarioDao; | |
4 | 8 | |
5 | 9 | public class Questionario { |
6 | 10 | |
... | ... | @@ -10,6 +14,30 @@ public class Questionario { |
10 | 14 | private String noOrgao; |
11 | 15 | private String hashAutenticacao; |
12 | 16 | |
17 | + public Questionario() | |
18 | + { | |
19 | + | |
20 | + } | |
21 | + | |
22 | + public Questionario(int idQuestionario) | |
23 | + { | |
24 | + ResultSet rset = null; | |
25 | + QuestionarioDao questionarioDao = new QuestionarioDao(); | |
26 | + | |
27 | + rset = questionarioDao.retornarQuestionario(idQuestionario); | |
28 | + try { | |
29 | + while (rset.next()) { | |
30 | + this.idQuestionario = idQuestionario; | |
31 | + this.dtInicioQuestionario = rset.getString("dt_inicio_questionario"); | |
32 | + this.dtFimQuestionario = rset.getString("dt_fim_questionario"); | |
33 | + this.noOrgao = rset.getString("no_orgao"); | |
34 | + this.hashAutenticacao = rset.getString("hash_autenticacao"); | |
35 | + } | |
36 | + } catch (Exception e) { | |
37 | + e.printStackTrace(); | |
38 | + } | |
39 | + } | |
40 | + | |
13 | 41 | public int getIdQuestionario() { |
14 | 42 | return idQuestionario; |
15 | 43 | } | ... | ... |
src/br/com/model/entity/RespostaQuestionario.java
1 | 1 | package br.com.model.entity; |
2 | 2 | |
3 | -import java.util.Date; | |
3 | +import java.sql.ResultSet; | |
4 | + | |
5 | +import br.com.dao.RespostaQuestionarioDao; | |
4 | 6 | |
5 | 7 | public class RespostaQuestionario { |
6 | 8 | |
... | ... | @@ -9,6 +11,32 @@ public class RespostaQuestionario { |
9 | 11 | private Pergunta pergunta; |
10 | 12 | private OpcaoResposta opcaoResposta; |
11 | 13 | private String dtRespostaQuestionario; |
14 | + private String textoResposta; | |
15 | + | |
16 | + public RespostaQuestionario() | |
17 | + { | |
18 | + | |
19 | + } | |
20 | + | |
21 | + public RespostaQuestionario(int idRespostaQuestionario) | |
22 | + { | |
23 | + ResultSet rset = null; | |
24 | + RespostaQuestionarioDao respostaQuestionarioDao = new RespostaQuestionarioDao(); | |
25 | + | |
26 | + rset = respostaQuestionarioDao.retornarRespostaQuestionario(idRespostaQuestionario); | |
27 | + try { | |
28 | + while (rset.next()) { | |
29 | + this.idRespostaQuestionario = idRespostaQuestionario; | |
30 | + this.questionario = new Questionario(Integer.parseInt(rset.getString("id_questionario"))); | |
31 | + this.pergunta = new Pergunta(Integer.parseInt(rset.getString("id_pergunta"))); | |
32 | + this.opcaoResposta = new OpcaoResposta(Integer.parseInt(rset.getString("id_opcao_resposta"))); | |
33 | + this.dtRespostaQuestionario = rset.getDate("dt_resposta_questionario").toString(); | |
34 | + this.textoResposta = rset.getString("texto_resposta"); | |
35 | + } | |
36 | + } catch (Exception e) { | |
37 | + e.printStackTrace(); | |
38 | + } | |
39 | + } | |
12 | 40 | |
13 | 41 | public int getIdRespostaQuestionario() { |
14 | 42 | return idRespostaQuestionario; |
... | ... | @@ -49,6 +77,14 @@ public class RespostaQuestionario { |
49 | 77 | public void setDtRespostaQuestionario(String dtRespostaQuestionario) { |
50 | 78 | this.dtRespostaQuestionario = dtRespostaQuestionario; |
51 | 79 | } |
80 | + | |
81 | + public String getTextoResposta() { | |
82 | + return textoResposta; | |
83 | + } | |
84 | + | |
85 | + public void setTextoResposta(String textoResposta) { | |
86 | + this.textoResposta = textoResposta; | |
87 | + } | |
52 | 88 | |
53 | 89 | |
54 | 90 | ... | ... |