Rev 195 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 195 | Rev 550 | ||
|---|---|---|---|
| Line 16... | Line 16... | ||
| 16 | 16 | ||
| 17 | import br.com.ec.core.exception.NegocioException; |
17 | import br.com.ec.core.exception.NegocioException; |
| 18 | import br.com.ec.core.util.ArquivoUtil; |
18 | import br.com.ec.core.util.ArquivoUtil; |
| 19 | import br.com.ec.core.util.VerificadorUtil; |
19 | import br.com.ec.core.util.VerificadorUtil; |
| 20 | import br.com.ec.domain.dto.FotoDTO; |
20 | import br.com.ec.domain.dto.FotoDTO; |
| - | 21 | import br.com.ec.domain.model.Estampa; |
|
| 21 | import br.com.ec.domain.model.Produto; |
22 | import br.com.ec.domain.model.Produto; |
| 22 | import br.com.ec.domain.shared.ConstantesSEC; |
23 | import br.com.ec.domain.shared.ConstantesSEC; |
| 23 | import br.com.ec.web.exception.VerificadorLancamentoException; |
24 | import br.com.ec.web.exception.VerificadorLancamentoException; |
| 24 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
25 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
| 25 | import br.com.ec.web.message.LancadorMensagem; |
26 | import br.com.ec.web.message.LancadorMensagem; |
| Line 72... | Line 73... | ||
| 72 | File foto = new File(getCaminhoPastaFotos() + produto.getCodigoProdutoPadrao() + ".jpg"); |
73 | File foto = new File(getCaminhoPastaFotos() + produto.getCodigoProdutoPadrao() + ".jpg"); |
| 73 | if (foto.exists()) { |
74 | if (foto.exists()) { |
| 74 | return getCaminhoPadraoFotos() + produto.getCodigoProdutoPadrao() + ".jpg"; |
75 | return getCaminhoPadraoFotos() + produto.getCodigoProdutoPadrao() + ".jpg"; |
| 75 | } else { |
76 | } else { |
| 76 | return getCaminhoPadraoFotos() + "SEM_FOTO.jpg"; |
77 | return getCaminhoPadraoFotos() + "SEM_FOTO.jpg"; |
| - | 78 | }
|
|
| - | 79 | }
|
|
| - | 80 | } catch (Exception e) { |
|
| - | 81 | e.printStackTrace(); |
|
| - | 82 | }
|
|
| - | 83 | ||
| - | 84 | return getCaminhoPadraoFotos() + "SEM_FOTO.jpg"; |
|
| - | 85 | }
|
|
| - | 86 | ||
| - | 87 | public String fotoEstampa(Estampa estampa) { |
|
| - | 88 | try { |
|
| - | 89 | if (VerificadorUtil.naoEstaNulo(estampa)) { |
|
| - | 90 | File foto = new File(getCaminhoPastaEstampas() + estampa.identificadorImagemEstampa() + ".jpg"); |
|
| - | 91 | if (foto.exists()) { |
|
| - | 92 | return getCaminhoPastaEstampas() + estampa.identificadorImagemEstampa() + ".jpg"; |
|
| - | 93 | } else { |
|
| - | 94 | return getCaminhoPastaEstampas() + "SEM_FOTO.jpg"; |
|
| 77 | }
|
95 | }
|
| 78 | }
|
96 | }
|
| 79 | } catch (Exception e) { |
97 | } catch (Exception e) { |
| 80 | e.printStackTrace(); |
98 | e.printStackTrace(); |
| 81 | }
|
99 | }
|
| Line 131... | Line 149... | ||
| 131 | ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext(); |
149 | ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext(); |
| 132 | return servletContext.getRealPath("") + File.separator + "fotos" + File.separator; |
150 | return servletContext.getRealPath("") + File.separator + "fotos" + File.separator; |
| 133 | }
|
151 | }
|
| 134 | ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext(); |
152 | ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext(); |
| 135 | return servletContext.getRealPath("") + File.separator + ".." + File.separator + "fotos" + File.separator; |
153 | return servletContext.getRealPath("") + File.separator + ".." + File.separator + "fotos" + File.separator; |
| - | 154 | }
|
|
| - | 155 | ||
| - | 156 | public String getCaminhoPastaEstampas() { |
|
| - | 157 | if (ConstantesSEC.TESTE_LOCAL) { |
|
| - | 158 | ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext(); |
|
| - | 159 | return servletContext.getRealPath("") + File.separator + "imagens_geral" + File.separator + "estampas" + File.separator; |
|
| - | 160 | }
|
|
| - | 161 | ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext(); |
|
| - | 162 | return servletContext.getRealPath("") + File.separator + ".." + File.separator + "imagens_geral" + File.separator + "estampas" + File.separator; |
|
| 136 | }
|
163 | }
|
| 137 | 164 | ||
| 138 | public void prepararUploadFoto(Produto produto) { |
165 | public void prepararUploadFoto(Produto produto) { |
| 139 | FotoDTO fotoNova = new FotoDTO(); |
166 | FotoDTO fotoNova = new FotoDTO(); |
| 140 | fotoNova.setDescricao(produto.getCodigoProdutoPadrao()); |
167 | fotoNova.setDescricao(produto.getCodigoProdutoPadrao()); |