Details | 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.core.util.VerificadorUtil; |
||
| 13 | import br.com.ec.domain.model.Papel; |
||
| 14 | import br.com.ec.domain.model.PessoaPapel; |
||
| 15 | import br.com.ec.domain.service.PapelService; |
||
| 16 | import br.com.ec.domain.service.PessoaPapelService; |
||
| 17 | import br.com.ec.web.generic.AbstractBean; |
||
| 18 | |||
| 19 | @Named |
||
| 20 | @Scope("view") |
||
| 21 | public class PessoaPapelBean extends AbstractBean<PessoaPapel> implements Serializable { |
||
| 22 | |||
| 23 | private static final long serialVersionUID = 1L; |
||
| 24 | |||
| 25 | private List<Papel> listaPapeis; |
||
| 26 | |||
| 27 | private PessoaPapelService pessoaPapelService; |
||
| 28 | private PapelService papelService; |
||
| 29 | |||
| 30 | @Inject |
||
| 31 | public PessoaPapelBean(PessoaPapelService pessoaPapelService, PapelService papelService) { |
||
| 32 | this.pessoaPapelService = pessoaPapelService; |
||
| 33 | this.papelService = papelService; |
||
| 34 | } |
||
| 35 | |||
| 36 | @Override |
||
| 37 | public void preCarregamento() { |
||
| 38 | entidade = new PessoaPapel(); |
||
| 39 | } |
||
| 40 | |||
| 41 | @Override |
||
| 42 | public void limparEntidade() { |
||
| 43 | setEntidade(new PessoaPapel()); |
||
| 44 | } |
||
| 45 | |||
| 46 | @Override |
||
| 47 | public GenericService<PessoaPapel> getService() { |
||
| 48 | return pessoaPapelService; |
||
| 49 | } |
||
| 50 | |||
| 51 | @Override |
||
| 52 | public PessoaPapel getEntidade() { |
||
| 53 | return entidade; |
||
| 54 | } |
||
| 55 | |||
| 56 | @Override |
||
| 57 | public PessoaPapel getId() { |
||
| 58 | return getEntidade(); |
||
| 59 | } |
||
| 60 | |||
| 61 | public List<Papel> getListaPapeis() { |
||
| 62 | if (VerificadorUtil.isListaNulaOuVazia(listaPapeis)) { |
||
| 63 | setListaPapeis(papelService.consultarTodos(new Papel())); |
||
| 64 | } |
||
| 65 | return listaPapeis; |
||
| 66 | } |
||
| 67 | public void setListaPapeis(List<Papel> listaPapeis) { |
||
| 68 | this.listaPapeis = listaPapeis; |
||
| 69 | } |
||
| 70 | |||
| 71 | } |