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