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