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