Rev 510 | Go to most recent revision | Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 507 | blopes | 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.LogisticaDTO; |
||
| 12 | import br.com.ec.domain.model.tipos.TipoPeriodoConsulta; |
||
| 13 | import br.com.ec.domain.service.TransferenciaService; |
||
| 14 | import br.com.ec.web.exception.VerificadorLancamentoException; |
||
| 15 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
||
| 16 | import br.com.ec.web.generic.AbstractBean; |
||
| 17 | import br.com.ec.web.message.LancadorMensagem; |
||
| 18 | |||
| 19 | @Named |
||
| 20 | @Scope("view") |
||
| 21 | public class LogisticaBean extends AbstractBean<LogisticaDTO> implements Serializable { |
||
| 22 | |||
| 23 | private static final long serialVersionUID = 1L; |
||
| 24 | |||
| 25 | private TransferenciaService transferenciaService; |
||
| 26 | |||
| 27 | @Inject |
||
| 28 | public LogisticaBean(TransferenciaService transferenciaService) { |
||
| 29 | this.transferenciaService = transferenciaService; |
||
| 30 | } |
||
| 31 | |||
| 32 | @Override |
||
| 33 | public GenericService<LogisticaDTO> getService() { |
||
| 34 | return null; |
||
| 35 | } |
||
| 36 | |||
| 37 | @Override |
||
| 38 | public LogisticaDTO getId() { |
||
| 39 | return null; |
||
| 40 | } |
||
| 41 | |||
| 42 | @Override |
||
| 43 | public void preCarregamento() { |
||
| 44 | limparEntidade(); |
||
| 45 | } |
||
| 46 | |||
| 47 | @Override |
||
| 48 | public void limparEntidade() { |
||
| 49 | setEntidade(new LogisticaDTO()); |
||
| 50 | } |
||
| 51 | |||
| 52 | /**************************************************/ |
||
| 53 | |||
| 54 | public TipoPeriodoConsulta[] getTiposPeriodoConsulta() { |
||
| 55 | return TipoPeriodoConsulta.values(); |
||
| 56 | } |
||
| 57 | |||
| 58 | /**************************************************/ |
||
| 59 | |||
| 60 | public void gerarTransferencias() { |
||
| 61 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 62 | public void execute() { |
||
| 63 | transferenciaService.gerarTransferenciasAutomaticamente(getEntidade()); |
||
| 64 | LancadorMensagem.lancarSucesso("TRANSFERÊNCIAS GERADAS COM SUCESSO"); |
||
| 65 | } |
||
| 66 | }); |
||
| 67 | } |
||
| 68 | |||
| 69 | |||
| 70 | } |