Rev 531 | Rev 534 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 531 | Rev 533 | ||
|---|---|---|---|
| Line 140... | Line 140... | ||
| 140 | public String identificadorImagemEstampa() { |
140 | public String identificadorImagemEstampa() { |
| 141 | return getTemaEstampa().getCodigo() + getCodigo(); |
141 | return getTemaEstampa().getCodigo() + getCodigo(); |
| 142 | }
|
142 | }
|
| 143 | 143 | ||
| 144 | /******************/
|
144 | /******************/
|
| 145 | - | ||
| 146 | @Transient |
- | |
| 147 | public String caminhoPastaImagens() { |
- | |
| 148 | ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext(); |
- | |
| 149 | return ConstantesSEC.TESTE_EMISSAO_LOCAL? |
- | |
| 150 | servletContext.getRealPath("") + File.separator + ConstantesSEC.Estampa.NOME_PASTA_PADRAO + File.separator : |
- | |
| 151 | servletContext.getRealPath("") + File.separator + ".." + File.separator + ConstantesSEC.Estampa.NOME_PASTA_PADRAO + File.separator; |
- | |
| 152 | }
|
- | |
| 153 | - | ||
| 154 | @Transient |
- | |
| 155 | public String imagemEstampa() { |
- | |
| 156 | return retornarImagemPngOuJpg(); |
- | |
| 157 | }
|
- | |
| 158 | - | ||
| 159 | private String retornarImagemPngOuJpg() { |
- | |
| 160 | File foto = new File(caminhoPastaImagens() + StringUtil.setarLowerCase(identificadorImagemEstampa()) + ".jpg"); |
- | |
| 161 | if (foto.exists()) { |
- | |
| 162 | return caminhoPastaImagens() + StringUtil.setarLowerCase(identificadorImagemEstampa()) + ".jpg"; |
- | |
| 163 | }
|
- | |
| 164 | foto = new File(caminhoPastaImagens() + StringUtil.setarLowerCase(identificadorImagemEstampa()) + ".jpeg"); |
- | |
| 165 | if (foto.exists()) { |
- | |
| 166 | return caminhoPastaImagens() + StringUtil.setarLowerCase(identificadorImagemEstampa()) + ".jpeg"; |
- | |
| 167 | }
|
- | |
| 168 | if (!foto.exists()) { |
- | |
| 169 | foto = new File(caminhoPastaImagens() + StringUtil.setarLowerCase(identificadorImagemEstampa()) + ".png"); |
- | |
| 170 | }
|
- | |
| 171 | return foto.exists()? caminhoPastaImagens() + StringUtil.setarLowerCase(identificadorImagemEstampa()) + ".png" : |
- | |
| 172 | caminhoPastaImagens() + "SEM_IMAGEM.png"; |
- | |
| 173 | }
|
- | |
| 174 | 145 | ||
| 175 | }
|
146 | }
|