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.ProfessorView; |
||
| 13 | import br.edu.cesmac.sic.controller.beans.consultademanda.ProfessorConsultaPorDemanda; |
||
| 14 | import br.edu.cesmac.sic.core.domain.model.dto.ParametrosConsultaProfessorDTO; |
||
| 15 | import br.edu.cesmac.sic.core.domain.service.ProfessorService; |
||
| 16 | import br.edu.cesmac.web.generic.AbstractBean; |
||
| 17 | |||
| 18 | @Named |
||
| 19 | @Scope("view") |
||
| 20 | public class ProfessorBean extends AbstractBean<ProfessorView> implements Serializable { |
||
| 21 | |||
| 22 | private static final long serialVersionUID = 1L; |
||
| 23 | |||
| 24 | private boolean acaoEditar = false; |
||
| 25 | |||
| 26 | private ProfessorConsultaPorDemanda lazy; |
||
| 27 | |||
| 28 | private ProfessorService professorService; |
||
| 29 | |||
| 30 | @Inject |
||
| 31 | public ProfessorBean(ProfessorConsultaPorDemanda lazy, ProfessorService professorService) { |
||
| 32 | this.lazy = lazy; |
||
| 33 | this.professorService = professorService; |
||
| 34 | } |
||
| 35 | |||
| 36 | @Override |
||
| 37 | public ProfessorView getId() { |
||
| 38 | return getEntidade(); |
||
| 39 | } |
||
| 40 | |||
| 41 | @Override |
||
| 42 | public GenericService<ProfessorView> getService() { |
||
| 43 | return professorService; |
||
| 44 | } |
||
| 45 | |||
| 46 | @Override |
||
| 47 | public void limparEntidade() { |
||
| 48 | setEntidade(new ProfessorView()); |
||
| 49 | } |
||
| 50 | |||
| 51 | @Override |
||
| 52 | public ProfessorView getEntidade() { |
||
| 53 | return entidade; |
||
| 54 | } |
||
| 55 | |||
| 56 | public ProfessorConsultaPorDemanda 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 | parametrosConsulta = new ParametrosConsultaProfessorDTO(); |
||
| 75 | parametrosConsulta.setEntidade(new ProfessorView()); |
||
| 76 | prepararConsultaDemanda(); |
||
| 77 | } |
||
| 78 | |||
| 79 | public void limparParametrosConsulta() { |
||
| 80 | preCarregamento(); |
||
| 81 | } |
||
| 82 | |||
| 83 | } |