Rev 106 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 106 | espaco | 1 | package br.com.ec.controller.managedbean; |
| 2 | |||
| 3 | import java.io.Serializable; |
||
| 4 | |||
| 5 | import javax.inject.Inject; |
||
| 6 | import javax.inject.Named; |
||
| 7 | |||
| 8 | import org.springframework.context.annotation.Scope; |
||
| 9 | |||
| 10 | import br.com.ec.controller.managedbean.consultademanda.PagamentoConsultaPorDemanda; |
||
| 195 | espaco | 11 | import br.com.ec.core.consulta.ParametrosConsulta; |
| 12 | import br.com.ec.core.generic.GenericService; |
||
| 13 | import br.com.ec.core.util.VerificadorUtil; |
||
| 106 | espaco | 14 | import br.com.ec.domain.model.Loja; |
| 15 | import br.com.ec.domain.model.Pagamento; |
||
| 16 | import br.com.ec.domain.service.loja.LojaService; |
||
| 195 | espaco | 17 | import br.com.ec.web.generic.AbstractBean; |
| 106 | espaco | 18 | |
| 19 | @Named |
||
| 20 | @Scope("view") |
||
| 21 | public class PagamentoConsultaBean extends AbstractBean<Pagamento> implements Serializable { |
||
| 22 | |||
| 23 | private static final long serialVersionUID = 1L; |
||
| 24 | |||
| 25 | private PagamentoConsultaPorDemanda lazy; |
||
| 26 | private Loja lojaSelecionada; |
||
| 27 | |||
| 28 | private LojaService lojaService; |
||
| 29 | |||
| 30 | @Inject |
||
| 31 | public PagamentoConsultaBean(PagamentoConsultaPorDemanda lazy, LojaService lojaService) { |
||
| 32 | this.lazy = lazy; |
||
| 33 | this.lojaService = lojaService; |
||
| 34 | } |
||
| 35 | |||
| 36 | @Override |
||
| 37 | public void preCarregamento() { |
||
| 38 | entidade = new Pagamento(); |
||
| 39 | entidade.setLoja(getLojaSelecionada()); |
||
| 40 | entidade.setLancado(false); |
||
| 41 | parametrosConsulta = new ParametrosConsulta<Pagamento>(); |
||
| 42 | parametrosConsulta.setEntidade(entidade); |
||
| 43 | prepararConsultaDemanda(); |
||
| 44 | } |
||
| 45 | |||
| 46 | @Override |
||
| 47 | public void limparEntidade() { |
||
| 48 | setEntidade(new Pagamento()); |
||
| 49 | } |
||
| 50 | |||
| 51 | @Override |
||
| 52 | public GenericService<Pagamento> getService() { |
||
| 53 | return null; |
||
| 54 | } |
||
| 55 | |||
| 56 | @Override |
||
| 57 | public Pagamento getEntidade() { |
||
| 58 | return entidade; |
||
| 59 | } |
||
| 60 | |||
| 61 | @Override |
||
| 62 | public Pagamento getId() { |
||
| 63 | return getEntidade(); |
||
| 64 | } |
||
| 65 | |||
| 66 | public PagamentoConsultaPorDemanda getLazy() { |
||
| 67 | return lazy; |
||
| 68 | } |
||
| 69 | public void setLazy(PagamentoConsultaPorDemanda lazy) { |
||
| 70 | this.lazy = lazy; |
||
| 71 | } |
||
| 72 | public void prepararConsultaDemanda() { |
||
| 73 | lazy.setarParametrosConsulta(getParametrosConsulta()); |
||
| 74 | } |
||
| 75 | |||
| 76 | public Loja getLojaSelecionada() { |
||
| 77 | if (VerificadorUtil.estaNulo(lojaSelecionada)) { |
||
| 78 | Loja loja = new Loja(); |
||
| 79 | loja.setSequencial(new Long(getParametro("sequencialLoja").toString())); |
||
| 80 | lojaSelecionada = lojaService.consultarPorId(loja); |
||
| 81 | } |
||
| 82 | return lojaSelecionada; |
||
| 83 | } |
||
| 84 | public void setLojaSelecionada(Loja lojaSelecionada) { |
||
| 85 | this.lojaSelecionada = lojaSelecionada; |
||
| 86 | } |
||
| 87 | |||
| 88 | } |