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 | |||
| 5 | import javax.annotation.PostConstruct; |
||
| 6 | import javax.inject.Inject; |
||
| 7 | import javax.inject.Named; |
||
| 8 | |||
| 9 | import org.springframework.context.annotation.Scope; |
||
| 10 | |||
| 11 | import br.edu.cesmac.core.generic.GenericService; |
||
| 12 | import br.edu.cesmac.sac.shared.views.AlunoView; |
||
| 13 | import br.edu.cesmac.sic.controller.beans.consultademanda.AlunoConsultaPorDemanda; |
||
| 14 | import br.edu.cesmac.sic.core.domain.model.dto.ParametrosConsultaAlunoDTO; |
||
| 15 | import br.edu.cesmac.sic.core.domain.service.AlunoService; |
||
| 16 | import br.edu.cesmac.web.generic.AbstractBean; |
||
| 17 | |||
| 18 | @Named |
||
| 19 | @Scope("view") |
||
| 20 | public class AlunoBean extends AbstractBean<AlunoView> implements Serializable { |
||
| 21 | |||
| 22 | private static final long serialVersionUID = 1L; |
||
| 23 | |||
| 24 | private boolean acaoEditar = false; |
||
| 25 | |||
| 26 | private AlunoConsultaPorDemanda lazy; |
||
| 27 | |||
| 28 | private AlunoService alunoService; |
||
| 29 | |||
| 30 | @Inject |
||
| 31 | public AlunoBean(AlunoConsultaPorDemanda lazy, AlunoService alunoService) { |
||
| 32 | this.lazy = lazy; |
||
| 33 | this.alunoService = alunoService; |
||
| 34 | } |
||
| 35 | |||
| 36 | @Override |
||
| 37 | public AlunoView getId() { |
||
| 38 | return getEntidade(); |
||
| 39 | } |
||
| 40 | |||
| 41 | @Override |
||
| 42 | public GenericService<AlunoView> getService() { |
||
| 43 | return alunoService; |
||
| 44 | } |
||
| 45 | |||
| 46 | @Override |
||
| 47 | public void limparEntidade() { |
||
| 48 | setEntidade(new AlunoView()); |
||
| 49 | } |
||
| 50 | |||
| 51 | @Override |
||
| 52 | public AlunoView getEntidade() { |
||
| 53 | return entidade; |
||
| 54 | } |
||
| 55 | |||
| 56 | public AlunoConsultaPorDemanda getLazy() { |
||
| 57 | return lazy; |
||
| 58 | } |
||
| 59 | |||
| 60 | public void prepararConsultaDemanda() { |
||
| 61 | lazy.setarParametrosConsulta(getParametrosConsulta()); |
||
| 62 | } |
||
| 63 | |||
| 64 | public boolean isAcaoEditar() { |
||
| 65 | return acaoEditar; |
||
| 66 | } |
||
| 67 | |||
| 68 | public void setAcaoEditar(boolean acaoEditar) { |
||
| 69 | this.acaoEditar = acaoEditar; |
||
| 70 | } |
||
| 71 | |||
| 72 | @PostConstruct |
||
| 73 | public void preCarregamento() { |
||
| 74 | entidade = new AlunoView(); |
||
| 75 | parametrosConsulta = new ParametrosConsultaAlunoDTO(); |
||
| 76 | parametrosConsulta.setEntidade(entidade); |
||
| 77 | prepararConsultaDemanda(); |
||
| 78 | } |
||
| 79 | |||
| 80 | public void limparParametrosConsulta() { |
||
| 81 | preCarregamento(); |
||
| 82 | } |
||
| 83 | |||
| 84 | } |