Retrieve the extension that should be used for the output file. This is base don the template name. @param templateFilename The filename of the export template. @param isPdf Is this an export to a PDF file? @return The output filename extension.
(String templateFilename, boolean isPdf)
| 71 | * @return The output filename extension. |
| 72 | */ |
| 73 | public static String getOutputExtension(String templateFilename, boolean isPdf) |
| 74 | { |
| 75 | if (isPdf) |
| 76 | { |
| 77 | return "pdf"; |
| 78 | } |
| 79 | |
| 80 | if (templateFilename.endsWith(".ftl")) |
| 81 | { |
| 82 | templateFilename = templateFilename.substring(0, templateFilename.length() - 4); |
| 83 | } |
| 84 | String extension = StringUtils.substringAfterLast(templateFilename, "."); |
| 85 | if (StringUtils.isEmpty(extension)) |
| 86 | { |
| 87 | extension = StringUtils.substringAfterLast(templateFilename, "-"); |
| 88 | } |
| 89 | |
| 90 | return extension; |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * Identify if this template will result in a pdf file. |