Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1 | espaco | 1 | package br.edu.cesmac.sic.controller.beans; |
| 2 | |||
| 3 | import java.io.Serializable; |
||
| 4 | import java.util.List; |
||
| 5 | |||
| 6 | import javax.annotation.PostConstruct; |
||
| 7 | import javax.inject.Inject; |
||
| 8 | import javax.inject.Named; |
||
| 9 | |||
| 10 | import org.springframework.context.annotation.Scope; |
||
| 11 | |||
| 12 | import br.edu.cesmac.core.consulta.ParametrosConsulta; |
||
| 13 | import br.edu.cesmac.core.generic.GenericService; |
||
| 14 | import br.edu.cesmac.sic.controller.beans.consultademanda.BolsaConsultaPorDemanda; |
||
| 15 | import br.edu.cesmac.sic.core.domain.model.Bolsa; |
||
| 16 | import br.edu.cesmac.sic.core.domain.service.BolsaService; |
||
| 17 | import br.edu.cesmac.web.generic.AbstractBean; |
||
| 18 | |||
| 19 | @Named |
||
| 20 | @Scope("view") |
||
| 21 | public class BolsaBean extends AbstractBean<Bolsa> implements Serializable { |
||
| 22 | |||
| 23 | private static final long serialVersionUID = 1L; |
||
| 24 | |||
| 25 | private BolsaConsultaPorDemanda lazy; |
||
| 26 | |||
| 27 | private BolsaService bolsaService; |
||
| 28 | |||
| 29 | @Inject |
||
| 30 | public BolsaBean(BolsaConsultaPorDemanda lazy, BolsaService bolsaService) { |
||
| 31 | this.lazy = lazy; |
||
| 32 | this.bolsaService = bolsaService; |
||
| 33 | } |
||
| 34 | |||
| 35 | @Override |
||
| 36 | public Bolsa getId() { |
||
| 37 | return getEntidade(); |
||
| 38 | } |
||
| 39 | |||
| 40 | @Override |
||
| 41 | public GenericService<Bolsa> getService() { |
||
| 42 | return bolsaService; |
||
| 43 | } |
||
| 44 | |||
| 45 | @Override |
||
| 46 | public void limparEntidade() { |
||
| 47 | setEntidade(new Bolsa()); |
||
| 48 | } |
||
| 49 | |||
| 50 | @Override |
||
| 51 | public Bolsa getEntidade() { |
||
| 52 | return entidade; |
||
| 53 | } |
||
| 54 | |||
| 55 | public BolsaConsultaPorDemanda getLazy() { |
||
| 56 | return lazy; |
||
| 57 | } |
||
| 58 | |||
| 59 | public void prepararConsultaDemanda() { |
||
| 60 | lazy.setarParametrosConsulta(getParametrosConsulta()); |
||
| 61 | } |
||
| 62 | |||
| 63 | @PostConstruct |
||
| 64 | public void preCarregamento() { |
||
| 65 | parametrosConsulta = new ParametrosConsulta<Bolsa>(); |
||
| 66 | parametrosConsulta.setEntidade(new Bolsa()); |
||
| 67 | prepararConsultaDemanda(); |
||
| 68 | } |
||
| 69 | |||
| 70 | @Override |
||
| 71 | public void cadastrar() { |
||
| 72 | getEntidade().setAtivo(true); |
||
| 73 | super.cadastrar(); |
||
| 74 | } |
||
| 75 | |||
| 76 | public List<Bolsa> consultarBolsasAtivas() { |
||
| 77 | return bolsaService.consultarBolsasAtivas(); |
||
| 78 | } |
||
| 79 | |||
| 80 | } |