1
2
3
4 package ecar.dao;
5
6 import java.util.List;
7
8 import javax.servlet.http.HttpServletRequest;
9
10 import comum.database.Dao;
11 import comum.util.Pagina;
12
13 import ecar.exception.ECARException;
14 import ecar.pojo.ContatoAreaCtta;
15 import ecar.pojo.ContatoMailCategoriaCttm;
16 import ecar.pojo.ContatoMailCttm;
17
18
19
20
21 public class ContatoMailDao extends Dao {
22
23 public ContatoMailDao(HttpServletRequest request) {
24 super();
25 this.request = request;
26 }
27
28
29
30
31
32
33
34
35
36 public void setContatoMail(ContatoMailCttm contato, HttpServletRequest request, boolean recuperarParametrosComoString) throws ECARException {
37
38 try {
39
40 if (!"".equals(Pagina.getParamStr(request, "contatoAreaCtta")))
41 contato.setContatoAreaCtta((ContatoAreaCtta) this.buscar(ContatoAreaCtta.class, Long.valueOf(Pagina.getParamStr(request, "contatoAreaCtta"))));
42 if (!"".equals(Pagina.getParamStr(request, "contatoMailCategoriaCttm")))
43 contato.setContatoMailCategoriaCttm((ContatoMailCategoriaCttm) this.buscar(ContatoMailCategoriaCttm.class, Long.valueOf(Pagina.getParamStr(request, "contatoMailCategoriaCttm"))));
44
45 if (recuperarParametrosComoString) {
46 contato.setNomeCttm(Pagina.getParamStr(request, "nomeCttm"));
47 contato.setEmailCttm(Pagina.getParamStr(request, "emailCttm"));
48 contato.setIndOrigemCttm(Pagina.getParamStr(request, "indOrigemCttm"));
49 }
50 else {
51 contato.setNomeCttm(Pagina.getParam(request, "nomeCttm"));
52 contato.setEmailCttm(Pagina.getParam(request, "emailCttm"));
53 contato.setIndOrigemCttm(Pagina.getParam(request, "indOrigemCttm"));
54 }
55 } catch (Exception e) {
56 this.logger.error(e);
57 throw new ECARException(e);
58 }
59
60 }
61
62
63
64
65
66
67 public List getListContatoMailCttm(ContatoAreaCtta ctta) throws ECARException {
68
69 ContatoMailCttm cttm = new ContatoMailCttm();
70 cttm.setContatoAreaCtta(ctta);
71
72 return this.pesquisar(cttm, null);
73 }
74
75 }