Rev 528 | Rev 531 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 528 | Rev 530 | ||
|---|---|---|---|
| Line 16... | Line 16... | ||
| 16 | import br.com.ec.domain.dto.TemaEstampaDTO; |
16 | import br.com.ec.domain.dto.TemaEstampaDTO; |
| 17 | import br.com.ec.domain.dto.consulta.ParametrosConsultaEstampaDTO; |
17 | import br.com.ec.domain.dto.consulta.ParametrosConsultaEstampaDTO; |
| 18 | import br.com.ec.domain.model.Estampa; |
18 | import br.com.ec.domain.model.Estampa; |
| 19 | import br.com.ec.domain.model.TemaEstampa; |
19 | import br.com.ec.domain.model.TemaEstampa; |
| 20 | import br.com.ec.domain.service.EstampaService; |
20 | import br.com.ec.domain.service.EstampaService; |
| 21 | import br.com.ec.domain.service.TemaEstampaService; |
- | |
| - | 21 | import br.com.ec.domain.service.ImagemService; |
|
| 22 | import br.com.ec.web.exception.VerificadorLancamentoException; |
22 | import br.com.ec.web.exception.VerificadorLancamentoException; |
| 23 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
23 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
| 24 | import br.com.ec.web.generic.AbstractBean; |
24 | import br.com.ec.web.generic.AbstractBean; |
| 25 | import br.com.ec.web.message.LancadorMensagem; |
25 | import br.com.ec.web.message.LancadorMensagem; |
| 26 | import br.com.ec.web.util.TipoOperacao; |
26 | import br.com.ec.web.util.TipoOperacao; |
| Line 29... | Line 29... | ||
| 29 | @Scope("view") |
29 | @Scope("view") |
| 30 | public class EstampaBean extends AbstractBean<Estampa> implements Serializable { |
30 | public class EstampaBean extends AbstractBean<Estampa> implements Serializable { |
| 31 | 31 | ||
| 32 | private static final long serialVersionUID = 1L; |
32 | private static final long serialVersionUID = 1L; |
| 33 | 33 | ||
| 34 | private EstampaService estampaService; |
- | |
| 35 | private EstampaDTO entidadeParaConsulta; |
34 | private EstampaDTO entidadeParaConsulta; |
| 36 | private List<EstampaDTO> estampas; |
35 | private List<EstampaDTO> estampas; |
| 37 | 36 | ||
| 38 | private ParametrosConsultaEstampaDTO parametrosConsultaEstampaDTO; |
37 | private ParametrosConsultaEstampaDTO parametrosConsultaEstampaDTO; |
| 39 | private EstampaConsultaPorDemanda lazy; |
38 | private EstampaConsultaPorDemanda lazy; |
| - | 39 | ||
| - | 40 | private EstampaService estampaService; |
|
| - | 41 | private ImagemService imagemService; |
|
| 40 | 42 | ||
| 41 | @Inject |
43 | @Inject |
| 42 | public EstampaBean(EstampaService estampaService, EstampaConsultaPorDemanda lazy) { |
- | |
| 43 | this.estampaService = estampaService; |
- | |
| - | 44 | public EstampaBean(EstampaConsultaPorDemanda lazy, EstampaService estampaService, ImagemService imagemService) { |
|
| 44 | this.lazy = lazy; |
45 | this.lazy = lazy; |
| - | 46 | this.estampaService = estampaService; |
|
| - | 47 | this.imagemService = imagemService; |
|
| 45 | }
|
48 | }
|
| 46 | 49 | ||
| 47 | @Override |
50 | @Override |
| 48 | public void preCarregamento() { |
51 | public void preCarregamento() { |
| 49 | parametrosConsultaEstampaDTO = new ParametrosConsultaEstampaDTO(); |
52 | parametrosConsultaEstampaDTO = new ParametrosConsultaEstampaDTO(); |
| Line 139... | Line 142... | ||
| 139 | }
|
142 | }
|
| 140 | 143 | ||
| 141 | public void uploadImagem(final FileUploadEvent e) { |
144 | public void uploadImagem(final FileUploadEvent e) { |
| 142 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
145 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
| 143 | public void execute() { |
146 | public void execute() { |
| 144 | - | ||
| 145 | /*
|
- | |
| 146 | EstampaDTO imagemAdicionada = gerarArquivo(e.getFile());
|
- | |
| 147 | imagemAdicionada.setDescricao("promocoes_" + getEntidade().getVigencia().getSequencial());
|
- | |
| 148 | lancarExcecaoCasoArquivoExcedeuLimite(imagemAdicionada);
|
- | |
| 149 | // imagemAdicionada.compactarImagem();
|
- | |
| 150 | // imagemAdicionada.converterPngParaJpg();
|
- | |
| 151 | setImagemParaUpload(e.getFile());
|
- | |
| 152 | uploadFisico(imagemAdicionada);
|
- | |
| 153 | LancadorMensagem.lancarSucessoRedirecionandoTela("IMAGEM ADICIONADA COM SUCESSO", "/sistema/metas/metas.xhtml");
|
- | |
| 154 | */
|
- | |
| - | 147 | ImagemDTO imagemEnviada = imagemService.uploadImagem(e.getFile(), getEntidade().identificadorEstampa(), imagemService.caminhoPastaEstampas()); |
|
| - | 148 | getEntidade().setExtensao(imagemEnviada.getExtensao()); |
|
| - | 149 | alterar(getEntidade()); |
|
| - | 150 | LancadorMensagem.lancarSucessoRedirecionandoTela("ESTAMPA ADICIONADA COM SUCESSO", "/sistema/estampas/estampas.xhtml"); |
|
| 155 | }
|
151 | }
|
| 156 | }); |
152 | }); |
| 157 | }
|
153 | }
|
| - | 154 | ||
| - | 155 | public String retornarCaminhoEstampa(Estampa estampa) { |
|
| - | 156 | return imagemService.retornarCaminhoImagem(imagemService.caminhoPadraoEstampas(), estampa.identificadorEstampa(), estampa.getExtensao()); |
|
| - | 157 | }
|
|
| 158 | 158 | ||
| 159 | }
|
159 | }
|