summaryrefslogtreecommitdiff
path: root/bkucommon/src/main/java
diff options
context:
space:
mode:
authortkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2013-12-19 14:31:48 +0000
committertkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2013-12-19 14:31:48 +0000
commit687d119265e13ce6b523a5db83bf5d9c4579831f (patch)
treefe907f44543efc7b4ffbb0d7c8f028683d27d110 /bkucommon/src/main/java
parent109b8c7d788b8d9f65e7db8e1b6c8f2c4432a268 (diff)
downloadmocca-687d119265e13ce6b523a5db83bf5d9c4579831f.tar.gz
mocca-687d119265e13ce6b523a5db83bf5d9c4579831f.tar.bz2
mocca-687d119265e13ce6b523a5db83bf5d9c4579831f.zip
Expand MimeTypes, use for CMSHashDataInput
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1268 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'bkucommon/src/main/java')
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/CMSHashDataInput.java43
1 files changed, 2 insertions, 41 deletions
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/CMSHashDataInput.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/CMSHashDataInput.java
index e596e5c8..e51c5823 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/CMSHashDataInput.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/CMSHashDataInput.java
@@ -27,6 +27,7 @@ package at.gv.egiz.bku.slcommands.impl.cms;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+import at.gv.egiz.bku.gui.viewer.MimeTypes;
import at.gv.egiz.stal.HashDataInput;
public class CMSHashDataInput implements HashDataInput {
@@ -58,51 +59,11 @@ public class CMSHashDataInput implements HashDataInput {
@Override
public String getFilename() {
- String fileName = DEFAULT_FILENAME;
- String extension = getExtensionForMimeType(mimeType);
- if (extension != null)
- fileName += extension;
- return fileName;
+ return DEFAULT_FILENAME + MimeTypes.getExtension(mimeType);
}
@Override
public InputStream getHashDataInput() {
return new ByteArrayInputStream(data);
}
- private static String getExtensionForMimeType(String mimeType) {
- if (mimeType.equalsIgnoreCase("application/pdf")) {
- return ".pdf";
- }
- else if (mimeType.equalsIgnoreCase("text/plain")) {
- return ".txt";
- }
- else if (mimeType.equalsIgnoreCase("text/xml")) {
- return ".xml";
- }
- else if (mimeType.equalsIgnoreCase("text/html")) {
- return ".html";
- }
- else if (mimeType.equalsIgnoreCase("application/xml")) {
- return ".xml";
- }
- else if (mimeType.equalsIgnoreCase("application/xhtml+xml")) {
- return ".html";
- }
- else if (mimeType.equalsIgnoreCase("application/zip")) {
- return ".zip";
- }
- else if (mimeType.equalsIgnoreCase("application/gzip")) {
- return ".gz";
- }
- else if (mimeType.equalsIgnoreCase("image/gif")) {
- return ".gif";
- }
- else if (mimeType.equalsIgnoreCase("image/jpeg")) {
- return ".jpg";
- }
- else if (mimeType.equalsIgnoreCase("image/png")) {
- return ".png";
- }
- return null;
- }
}