Go to most recent revision | Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 409 | espaco | 1 | package br.com.ec.controller; |
| 2 | |||
| 3 | import java.io.Serializable; |
||
| 4 | |||
| 5 | import javax.inject.Inject; |
||
| 6 | import javax.inject.Named; |
||
| 7 | |||
| 8 | import org.springframework.context.annotation.Scope; |
||
| 9 | |||
| 10 | import br.com.ec.core.generic.GenericService; |
||
| 11 | import br.com.ec.domain.dto.FuncionarioEventoDTO; |
||
| 12 | import br.com.ec.domain.model.FuncionarioEvento; |
||
| 13 | import br.com.ec.domain.model.Papel; |
||
| 14 | import br.com.ec.domain.model.tipos.TipoFuncionarioEvento; |
||
| 15 | import br.com.ec.domain.model.tipos.TipoFuncionarioEventoStatus; |
||
| 16 | import br.com.ec.domain.service.UsuarioService; |
||
| 17 | import br.com.ec.web.exception.VerificadorLancamentoException; |
||
| 18 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
||
| 19 | import br.com.ec.web.generic.AbstractBean; |
||
| 20 | import br.com.ec.web.message.LancadorMensagem; |
||
| 21 | import br.com.ec.web.util.TipoOperacao; |
||
| 22 | |||
| 23 | @Named |
||
| 24 | @Scope("view") |
||
| 25 | public class FuncionarioEventoBean extends AbstractBean<FuncionarioEvento> implements Serializable { |
||
| 26 | |||
| 27 | private static final long serialVersionUID = 1L; |
||
| 28 | |||
| 29 | // private FuncionarioService funcionarioService; |
||
| 30 | private UsuarioService usuarioService; |
||
| 31 | |||
| 32 | // private FuncionarioEventoDTO entidadeParaConsulta; |
||
| 33 | |||
| 34 | private FuncionarioEventoDTO entidadeDTO = new FuncionarioEventoDTO(); |
||
| 35 | |||
| 36 | @Inject |
||
| 37 | public FuncionarioEventoBean(/*FuncionarioService funcionarioService, */UsuarioService usuarioService) { |
||
| 38 | // this.funcionarioService = funcionarioService; |
||
| 39 | this.usuarioService = usuarioService; |
||
| 40 | } |
||
| 41 | |||
| 42 | @Override |
||
| 43 | public void preCarregamento() { |
||
| 44 | limparEntidade(); |
||
| 45 | // consultarEventos(); |
||
| 46 | } |
||
| 47 | |||
| 48 | @Override |
||
| 49 | public void limparEntidade() { |
||
| 50 | setEntidade(new FuncionarioEvento()); |
||
| 51 | // setEntidadeParaConsulta(new FuncionarioEventoDTO()); |
||
| 52 | // setEntidadeDTO(null); |
||
| 53 | // consultarEventos(); |
||
| 54 | } |
||
| 55 | |||
| 56 | @Override |
||
| 57 | public GenericService<FuncionarioEvento> getService() { |
||
| 58 | // return funcionarioEventoService; |
||
| 59 | return null; |
||
| 60 | } |
||
| 61 | |||
| 62 | @Override |
||
| 63 | public FuncionarioEvento getEntidade() { |
||
| 64 | return entidade; |
||
| 65 | } |
||
| 66 | |||
| 67 | @Override |
||
| 68 | public void preConsultar() { |
||
| 69 | setTipoOperacao(TipoOperacao.CONSULTAR); |
||
| 70 | } |
||
| 71 | |||
| 72 | @Override |
||
| 73 | public FuncionarioEvento getId() { |
||
| 74 | return getEntidade(); |
||
| 75 | } |
||
| 76 | |||
| 77 | public TipoFuncionarioEvento[] getTiposFuncionarioEvento() { |
||
| 78 | return TipoFuncionarioEvento.values(); |
||
| 79 | } |
||
| 80 | |||
| 81 | public TipoFuncionarioEventoStatus[] getTiposFuncionarioEventoStatus() { |
||
| 82 | return TipoFuncionarioEventoStatus.values(); |
||
| 83 | } |
||
| 84 | |||
| 85 | /*************************************************/ |
||
| 86 | |||
| 87 | public FuncionarioEventoDTO getEntidadeDTO() { |
||
| 88 | return entidadeDTO; |
||
| 89 | } |
||
| 90 | public void setEntidadeDTO(FuncionarioEventoDTO entidadeDTO) { |
||
| 91 | this.entidadeDTO = entidadeDTO; |
||
| 92 | } |
||
| 93 | |||
| 94 | /*************************************************/ |
||
| 95 | |||
| 96 | public void adicionarEvento() { |
||
| 97 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 98 | public void execute() { |
||
| 99 | // pessoaPapelService.adicionarPapel(getEntidade().getPessoa(), new Papel(getPessoaPapelDTO().getCodigoPapel())); |
||
| 100 | // getEntidadeDTO().setPapeisDTO(pessoaPapelService.consultarPapeisDaPessoa(getPessoaPapelDTO().getSequencialPessoa())); |
||
| 101 | LancadorMensagem.lancarSucesso("EVENTO ADICIONADO COM SUCESSO"); |
||
| 102 | } |
||
| 103 | }); |
||
| 104 | } |
||
| 105 | |||
| 106 | } |