Rev 528 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 325 | espaco | 1 | package br.com.ec.controller; |
| 2 | |||
| 3 | import java.io.Serializable; |
||
| 4 | import java.util.List; |
||
| 5 | |||
| 6 | import javax.inject.Inject; |
||
| 7 | import javax.inject.Named; |
||
| 8 | |||
| 9 | import org.springframework.context.annotation.Scope; |
||
| 10 | |||
| 11 | import br.com.ec.core.generic.GenericService; |
||
| 12 | import br.com.ec.domain.dto.TemaEstampaDTO; |
||
| 13 | import br.com.ec.domain.model.TemaEstampa; |
||
| 14 | import br.com.ec.domain.service.TemaEstampaService; |
||
| 15 | import br.com.ec.web.generic.AbstractBean; |
||
| 16 | import br.com.ec.web.util.TipoOperacao; |
||
| 17 | |||
| 18 | @Named |
||
| 19 | @Scope("view") |
||
| 20 | public class TemaEstampaBean extends AbstractBean<TemaEstampa> implements Serializable { |
||
| 21 | |||
| 22 | private static final long serialVersionUID = 1L; |
||
| 23 | |||
| 24 | private TemaEstampaService temaEstampaService; |
||
| 25 | private TemaEstampaDTO entidadeParaConsulta; |
||
| 528 | blopes | 26 | private List<TemaEstampa> temas; |
| 27 | private List<TemaEstampaDTO> temasDTO; |
||
| 325 | espaco | 28 | |
| 29 | @Inject |
||
| 30 | public TemaEstampaBean(TemaEstampaService temaEstampaService) { |
||
| 31 | this.temaEstampaService = temaEstampaService; |
||
| 32 | } |
||
| 33 | |||
| 34 | @Override |
||
| 35 | public void preCarregamento() { |
||
| 36 | limparEntidade(); |
||
| 37 | consultarTemas(); |
||
| 528 | blopes | 38 | consultarTemasDTO(); |
| 325 | espaco | 39 | } |
| 40 | |||
| 41 | @Override |
||
| 42 | public void limparEntidade() { |
||
| 43 | setEntidade(new TemaEstampa()); |
||
| 44 | setEntidadeParaConsulta(new TemaEstampaDTO()); |
||
| 45 | consultarTemas(); |
||
| 528 | blopes | 46 | consultarTemasDTO(); |
| 325 | espaco | 47 | } |
| 48 | |||
| 49 | @Override |
||
| 50 | public GenericService<TemaEstampa> getService() { |
||
| 51 | return temaEstampaService; |
||
| 52 | } |
||
| 53 | |||
| 54 | @Override |
||
| 55 | public TemaEstampa getEntidade() { |
||
| 56 | return entidade; |
||
| 57 | } |
||
| 58 | |||
| 59 | @Override |
||
| 60 | public void preConsultar() { |
||
| 61 | setTipoOperacao(TipoOperacao.CONSULTAR); |
||
| 62 | } |
||
| 63 | |||
| 64 | @Override |
||
| 65 | public TemaEstampa getId() { |
||
| 66 | return getEntidade(); |
||
| 67 | } |
||
| 68 | |||
| 69 | /*************************************************/ |
||
| 70 | |||
| 71 | public TemaEstampaDTO getEntidadeParaConsulta() { |
||
| 72 | return entidadeParaConsulta; |
||
| 73 | } |
||
| 74 | public void setEntidadeParaConsulta(TemaEstampaDTO entidadeParaConsulta) { |
||
| 75 | this.entidadeParaConsulta = entidadeParaConsulta; |
||
| 76 | } |
||
| 77 | |||
| 528 | blopes | 78 | public List<TemaEstampa> getTemas() { |
| 325 | espaco | 79 | return temas; |
| 80 | } |
||
| 528 | blopes | 81 | public void setTemas(List<TemaEstampa> temas) { |
| 325 | espaco | 82 | this.temas = temas; |
| 83 | } |
||
| 84 | |||
| 528 | blopes | 85 | public List<TemaEstampaDTO> getTemasDTO() { |
| 86 | return temasDTO; |
||
| 87 | } |
||
| 88 | public void setTemasDTO(List<TemaEstampaDTO> temasDTO) { |
||
| 89 | this.temasDTO = temasDTO; |
||
| 90 | } |
||
| 91 | |||
| 325 | espaco | 92 | /*************************************************/ |
| 93 | |||
| 530 | blopes | 94 | public void prepararDetalhar(TemaEstampa temaEstampa) { |
| 95 | super.preDetalhar(temaEstampaService.consultarPorId(temaEstampa)); |
||
| 325 | espaco | 96 | } |
| 97 | |||
| 530 | blopes | 98 | public void prepararAlterar(TemaEstampa temaEstampa) { |
| 99 | super.preAlterar(temaEstampaService.consultarPorId(temaEstampa)); |
||
| 325 | espaco | 100 | } |
| 101 | |||
| 102 | public void consultarTemas() { |
||
| 528 | blopes | 103 | setTemas(temaEstampaService.consultarTemasAtivos()); |
| 325 | espaco | 104 | } |
| 105 | |||
| 528 | blopes | 106 | public void consultarTemasDTO() { |
| 107 | setTemasDTO(temaEstampaService.consultarTemas(getEntidadeParaConsulta())); |
||
| 108 | } |
||
| 109 | |||
| 325 | espaco | 110 | } |