1
2
3
4 package ecar.dao;
5
6 import java.util.List;
7
8 import javax.servlet.http.HttpServletRequest;
9
10 import org.hibernate.HibernateException;
11 import org.hibernate.criterion.Restrictions;
12
13 import comum.database.Dao;
14 import comum.util.Pagina;
15
16 import ecar.exception.ECARException;
17 import ecar.pojo.TipoAcompFuncAcompPK;
18 import ecar.pojo.TipoAcompFuncAcompTafc;
19 import ecar.pojo.TipoAcompanhamentoTa;
20 import ecar.util.Dominios;
21
22
23
24
25 public class TipoAcompFuncAcompDao extends Dao {
26
27
28
29
30 public TipoAcompFuncAcompDao(HttpServletRequest request) {
31 super();
32 this.request = request;
33 }
34
35 public TipoAcompFuncAcompDao() {
36 super();
37 }
38
39
40
41
42
43
44
45
46 public TipoAcompFuncAcompTafc buscar(Long codTa, Long codTpfa) throws ECARException {
47 try {
48
49
50
51
52
53 return (TipoAcompFuncAcompTafc) this.getSession().get(TipoAcompFuncAcompTafc.class, new TipoAcompFuncAcompPK(codTa, codTpfa));
54 } catch (HibernateException e) {
55 this.logger.error(e);
56 throw new ECARException(e);
57 }
58 }
59
60
61
62
63
64
65 public List getListaAcessotpfa(TipoAcompanhamentoTa ta) {
66 return this.getSession().createCriteria(TipoAcompFuncAcompTafc.class).add(Restrictions.eq("tipoAcompanhamentoTa", ta)).add(Restrictions.eq("indLeituraTipoAcomp", Dominios.COM_ACESSO_LEITURA)).list();
67 }
68
69
70
71
72
73
74
75 public void setTipoAcompFuncAcompTafc(TipoAcompFuncAcompTafc tafc, HttpServletRequest request) {
76
77 tafc.setIndLeituraTipoAcomp(Pagina.getParamOrDefault(request, "Tpfa" + tafc.getComp_id().getCodTa() + "-" + tafc.getComp_id().getCodTpfa(), Dominios.SEM_ACESSO_LEITURA));
78 }
79 }