mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-05-12 17:04:48 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
365923a6c1
@ -27,7 +27,7 @@
|
||||
{
|
||||
"transformerName": "imagemagick",
|
||||
"supportedSourceAndTargetList": [
|
||||
{"sourceMediaType": "image/x-raw-hasselblad", "targetMediaType": "image/x-raw-hasselblad" },
|
||||
{"sourceMediaType": "image/x-raw-hasselblad", "priority": 55, "targetMediaType": "image/x-raw-hasselblad" },
|
||||
{"sourceMediaType": "image/x-raw-hasselblad", "targetMediaType": "image/x-raw-sony" },
|
||||
{"sourceMediaType": "image/x-raw-hasselblad", "targetMediaType": "image/bmp" },
|
||||
{"sourceMediaType": "image/x-raw-hasselblad", "targetMediaType": "image/cgm" },
|
||||
@ -62,7 +62,7 @@
|
||||
{"sourceMediaType": "image/x-raw-hasselblad", "targetMediaType": "image/x-xwindowdump" },
|
||||
|
||||
{"sourceMediaType": "image/x-raw-sony", "targetMediaType": "image/x-raw-hasselblad" },
|
||||
{"sourceMediaType": "image/x-raw-sony", "targetMediaType": "image/x-raw-sony" },
|
||||
{"sourceMediaType": "image/x-raw-sony", "priority": 55, "targetMediaType": "image/x-raw-sony" },
|
||||
{"sourceMediaType": "image/x-raw-sony", "targetMediaType": "image/bmp" },
|
||||
{"sourceMediaType": "image/x-raw-sony", "targetMediaType": "image/cgm" },
|
||||
{"sourceMediaType": "image/x-raw-sony", "targetMediaType": "image/x-raw-canon" },
|
||||
@ -97,7 +97,7 @@
|
||||
|
||||
{"sourceMediaType": "image/bmp", "targetMediaType": "image/x-raw-hasselblad" },
|
||||
{"sourceMediaType": "image/bmp", "targetMediaType": "image/x-raw-sony" },
|
||||
{"sourceMediaType": "image/bmp", "targetMediaType": "image/bmp" },
|
||||
{"sourceMediaType": "image/bmp", "priority": 55, "targetMediaType": "image/bmp" },
|
||||
{"sourceMediaType": "image/bmp", "targetMediaType": "image/cgm" },
|
||||
{"sourceMediaType": "image/bmp", "targetMediaType": "image/x-raw-canon" },
|
||||
{"sourceMediaType": "image/bmp", "targetMediaType": "image/x-raw-adobe" },
|
||||
@ -132,7 +132,7 @@
|
||||
{"sourceMediaType": "image/cgm", "targetMediaType": "image/x-raw-hasselblad" },
|
||||
{"sourceMediaType": "image/cgm", "targetMediaType": "image/x-raw-sony" },
|
||||
{"sourceMediaType": "image/cgm", "targetMediaType": "image/bmp" },
|
||||
{"sourceMediaType": "image/cgm", "targetMediaType": "image/cgm" },
|
||||
{"sourceMediaType": "image/cgm", "priority": 55, "targetMediaType": "image/cgm" },
|
||||
{"sourceMediaType": "image/cgm", "targetMediaType": "image/x-raw-canon" },
|
||||
{"sourceMediaType": "image/cgm", "targetMediaType": "image/x-raw-adobe" },
|
||||
{"sourceMediaType": "image/cgm", "targetMediaType": "application/eps" },
|
||||
@ -167,7 +167,7 @@
|
||||
{"sourceMediaType": "image/x-raw-canon", "targetMediaType": "image/x-raw-sony" },
|
||||
{"sourceMediaType": "image/x-raw-canon", "targetMediaType": "image/bmp" },
|
||||
{"sourceMediaType": "image/x-raw-canon", "targetMediaType": "image/cgm" },
|
||||
{"sourceMediaType": "image/x-raw-canon", "targetMediaType": "image/x-raw-canon" },
|
||||
{"sourceMediaType": "image/x-raw-canon", "priority": 55, "targetMediaType": "image/x-raw-canon" },
|
||||
{"sourceMediaType": "image/x-raw-canon", "targetMediaType": "image/x-raw-adobe" },
|
||||
{"sourceMediaType": "image/x-raw-canon", "targetMediaType": "application/eps" },
|
||||
{"sourceMediaType": "image/x-raw-canon", "targetMediaType": "image/gif" },
|
||||
@ -202,7 +202,7 @@
|
||||
{"sourceMediaType": "image/x-raw-adobe", "targetMediaType": "image/bmp" },
|
||||
{"sourceMediaType": "image/x-raw-adobe", "targetMediaType": "image/cgm" },
|
||||
{"sourceMediaType": "image/x-raw-adobe", "targetMediaType": "image/x-raw-canon" },
|
||||
{"sourceMediaType": "image/x-raw-adobe", "targetMediaType": "image/x-raw-adobe" },
|
||||
{"sourceMediaType": "image/x-raw-adobe", "priority": 55, "targetMediaType": "image/x-raw-adobe" },
|
||||
{"sourceMediaType": "image/x-raw-adobe", "targetMediaType": "application/eps" },
|
||||
{"sourceMediaType": "image/x-raw-adobe", "targetMediaType": "image/gif" },
|
||||
{"sourceMediaType": "image/x-raw-adobe", "targetMediaType": "image/ief" },
|
||||
@ -237,7 +237,7 @@
|
||||
{"sourceMediaType": "application/eps", "targetMediaType": "image/cgm" },
|
||||
{"sourceMediaType": "application/eps", "targetMediaType": "image/x-raw-canon" },
|
||||
{"sourceMediaType": "application/eps", "targetMediaType": "image/x-raw-adobe" },
|
||||
{"sourceMediaType": "application/eps", "targetMediaType": "application/eps" },
|
||||
{"sourceMediaType": "application/eps", "priority": 55, "targetMediaType": "application/eps" },
|
||||
{"sourceMediaType": "application/eps", "targetMediaType": "image/gif" },
|
||||
{"sourceMediaType": "application/eps", "targetMediaType": "image/ief" },
|
||||
{"sourceMediaType": "application/eps", "targetMediaType": "image/jp2" },
|
||||
@ -272,7 +272,7 @@
|
||||
{"sourceMediaType": "image/gif", "targetMediaType": "image/x-raw-canon" },
|
||||
{"sourceMediaType": "image/gif", "targetMediaType": "image/x-raw-adobe" },
|
||||
{"sourceMediaType": "image/gif", "targetMediaType": "application/eps" },
|
||||
{"sourceMediaType": "image/gif", "targetMediaType": "image/gif" },
|
||||
{"sourceMediaType": "image/gif", "priority": 55, "targetMediaType": "image/gif" },
|
||||
{"sourceMediaType": "image/gif", "targetMediaType": "image/ief" },
|
||||
{"sourceMediaType": "image/gif", "targetMediaType": "image/jp2" },
|
||||
{"sourceMediaType": "image/gif", "targetMediaType": "image/jpeg" },
|
||||
@ -307,7 +307,7 @@
|
||||
{"sourceMediaType": "image/ief", "targetMediaType": "image/x-raw-adobe" },
|
||||
{"sourceMediaType": "image/ief", "targetMediaType": "application/eps" },
|
||||
{"sourceMediaType": "image/ief", "targetMediaType": "image/gif" },
|
||||
{"sourceMediaType": "image/ief", "targetMediaType": "image/ief" },
|
||||
{"sourceMediaType": "image/ief", "priority": 55, "targetMediaType": "image/ief" },
|
||||
{"sourceMediaType": "image/ief", "targetMediaType": "image/jp2" },
|
||||
{"sourceMediaType": "image/ief", "targetMediaType": "image/jpeg" },
|
||||
{"sourceMediaType": "image/ief", "targetMediaType": "image/x-raw-kodak" },
|
||||
@ -342,7 +342,7 @@
|
||||
{"sourceMediaType": "image/jp2", "targetMediaType": "application/eps" },
|
||||
{"sourceMediaType": "image/jp2", "targetMediaType": "image/gif" },
|
||||
{"sourceMediaType": "image/jp2", "targetMediaType": "image/ief" },
|
||||
{"sourceMediaType": "image/jp2", "targetMediaType": "image/jp2" },
|
||||
{"sourceMediaType": "image/jp2", "priority": 55, "targetMediaType": "image/jp2" },
|
||||
{"sourceMediaType": "image/jp2", "targetMediaType": "image/jpeg" },
|
||||
{"sourceMediaType": "image/jp2", "targetMediaType": "image/x-raw-kodak" },
|
||||
{"sourceMediaType": "image/jp2", "targetMediaType": "image/x-raw-minolta" },
|
||||
@ -377,7 +377,7 @@
|
||||
{"sourceMediaType": "image/jpeg", "targetMediaType": "image/gif" },
|
||||
{"sourceMediaType": "image/jpeg", "targetMediaType": "image/ief" },
|
||||
{"sourceMediaType": "image/jpeg", "targetMediaType": "image/jp2" },
|
||||
{"sourceMediaType": "image/jpeg", "targetMediaType": "image/jpeg" },
|
||||
{"sourceMediaType": "image/jpeg", "priority": 55, "targetMediaType": "image/jpeg" },
|
||||
{"sourceMediaType": "image/jpeg", "targetMediaType": "image/x-raw-kodak" },
|
||||
{"sourceMediaType": "image/jpeg", "targetMediaType": "image/x-raw-minolta" },
|
||||
{"sourceMediaType": "image/jpeg", "targetMediaType": "image/x-raw-nikon" },
|
||||
@ -412,7 +412,7 @@
|
||||
{"sourceMediaType": "image/x-raw-kodak", "targetMediaType": "image/ief" },
|
||||
{"sourceMediaType": "image/x-raw-kodak", "targetMediaType": "image/jp2" },
|
||||
{"sourceMediaType": "image/x-raw-kodak", "targetMediaType": "image/jpeg" },
|
||||
{"sourceMediaType": "image/x-raw-kodak", "targetMediaType": "image/x-raw-kodak" },
|
||||
{"sourceMediaType": "image/x-raw-kodak", "priority": 55, "targetMediaType": "image/x-raw-kodak" },
|
||||
{"sourceMediaType": "image/x-raw-kodak", "targetMediaType": "image/x-raw-minolta" },
|
||||
{"sourceMediaType": "image/x-raw-kodak", "targetMediaType": "image/x-raw-nikon" },
|
||||
{"sourceMediaType": "image/x-raw-kodak", "targetMediaType": "image/x-raw-olympus" },
|
||||
@ -447,7 +447,7 @@
|
||||
{"sourceMediaType": "image/x-raw-minolta", "targetMediaType": "image/jp2" },
|
||||
{"sourceMediaType": "image/x-raw-minolta", "targetMediaType": "image/jpeg" },
|
||||
{"sourceMediaType": "image/x-raw-minolta", "targetMediaType": "image/x-raw-kodak" },
|
||||
{"sourceMediaType": "image/x-raw-minolta", "targetMediaType": "image/x-raw-minolta" },
|
||||
{"sourceMediaType": "image/x-raw-minolta", "priority": 55, "targetMediaType": "image/x-raw-minolta" },
|
||||
{"sourceMediaType": "image/x-raw-minolta", "targetMediaType": "image/x-raw-nikon" },
|
||||
{"sourceMediaType": "image/x-raw-minolta", "targetMediaType": "image/x-raw-olympus" },
|
||||
{"sourceMediaType": "image/x-raw-minolta", "targetMediaType": "image/x-portable-bitmap" },
|
||||
@ -482,7 +482,7 @@
|
||||
{"sourceMediaType": "image/x-raw-nikon", "targetMediaType": "image/jpeg" },
|
||||
{"sourceMediaType": "image/x-raw-nikon", "targetMediaType": "image/x-raw-kodak" },
|
||||
{"sourceMediaType": "image/x-raw-nikon", "targetMediaType": "image/x-raw-minolta" },
|
||||
{"sourceMediaType": "image/x-raw-nikon", "targetMediaType": "image/x-raw-nikon" },
|
||||
{"sourceMediaType": "image/x-raw-nikon", "priority": 55, "targetMediaType": "image/x-raw-nikon" },
|
||||
{"sourceMediaType": "image/x-raw-nikon", "targetMediaType": "image/x-raw-olympus" },
|
||||
{"sourceMediaType": "image/x-raw-nikon", "targetMediaType": "image/x-portable-bitmap" },
|
||||
{"sourceMediaType": "image/x-raw-nikon", "targetMediaType": "image/x-raw-pentax" },
|
||||
@ -517,7 +517,7 @@
|
||||
{"sourceMediaType": "image/x-raw-olympus", "targetMediaType": "image/x-raw-kodak" },
|
||||
{"sourceMediaType": "image/x-raw-olympus", "targetMediaType": "image/x-raw-minolta" },
|
||||
{"sourceMediaType": "image/x-raw-olympus", "targetMediaType": "image/x-raw-nikon" },
|
||||
{"sourceMediaType": "image/x-raw-olympus", "targetMediaType": "image/x-raw-olympus" },
|
||||
{"sourceMediaType": "image/x-raw-olympus", "priority": 55, "targetMediaType": "image/x-raw-olympus" },
|
||||
{"sourceMediaType": "image/x-raw-olympus", "targetMediaType": "image/x-portable-bitmap" },
|
||||
{"sourceMediaType": "image/x-raw-olympus", "targetMediaType": "image/x-raw-pentax" },
|
||||
{"sourceMediaType": "image/x-raw-olympus", "targetMediaType": "image/x-portable-graymap" },
|
||||
@ -552,7 +552,7 @@
|
||||
{"sourceMediaType": "image/x-portable-bitmap", "targetMediaType": "image/x-raw-minolta" },
|
||||
{"sourceMediaType": "image/x-portable-bitmap", "targetMediaType": "image/x-raw-nikon" },
|
||||
{"sourceMediaType": "image/x-portable-bitmap", "targetMediaType": "image/x-raw-olympus" },
|
||||
{"sourceMediaType": "image/x-portable-bitmap", "targetMediaType": "image/x-portable-bitmap" },
|
||||
{"sourceMediaType": "image/x-portable-bitmap", "priority": 55, "targetMediaType": "image/x-portable-bitmap" },
|
||||
{"sourceMediaType": "image/x-portable-bitmap", "targetMediaType": "image/x-raw-pentax" },
|
||||
{"sourceMediaType": "image/x-portable-bitmap", "targetMediaType": "image/x-portable-graymap" },
|
||||
{"sourceMediaType": "image/x-portable-bitmap", "targetMediaType": "image/x-portable-anymap" },
|
||||
@ -587,7 +587,7 @@
|
||||
{"sourceMediaType": "image/x-raw-pentax", "targetMediaType": "image/x-raw-nikon" },
|
||||
{"sourceMediaType": "image/x-raw-pentax", "targetMediaType": "image/x-raw-olympus" },
|
||||
{"sourceMediaType": "image/x-raw-pentax", "targetMediaType": "image/x-portable-bitmap" },
|
||||
{"sourceMediaType": "image/x-raw-pentax", "targetMediaType": "image/x-raw-pentax" },
|
||||
{"sourceMediaType": "image/x-raw-pentax", "priority": 55, "targetMediaType": "image/x-raw-pentax" },
|
||||
{"sourceMediaType": "image/x-raw-pentax", "targetMediaType": "image/x-portable-graymap" },
|
||||
{"sourceMediaType": "image/x-raw-pentax", "targetMediaType": "image/x-portable-anymap" },
|
||||
{"sourceMediaType": "image/x-raw-pentax", "targetMediaType": "image/vnd.adobe.premiere" },
|
||||
@ -622,7 +622,7 @@
|
||||
{"sourceMediaType": "image/x-portable-graymap", "targetMediaType": "image/x-raw-olympus" },
|
||||
{"sourceMediaType": "image/x-portable-graymap", "targetMediaType": "image/x-portable-bitmap" },
|
||||
{"sourceMediaType": "image/x-portable-graymap", "targetMediaType": "image/x-raw-pentax" },
|
||||
{"sourceMediaType": "image/x-portable-graymap", "targetMediaType": "image/x-portable-graymap" },
|
||||
{"sourceMediaType": "image/x-portable-graymap", "priority": 55, "targetMediaType": "image/x-portable-graymap" },
|
||||
{"sourceMediaType": "image/x-portable-graymap", "targetMediaType": "image/x-portable-anymap" },
|
||||
{"sourceMediaType": "image/x-portable-graymap", "targetMediaType": "image/vnd.adobe.premiere" },
|
||||
{"sourceMediaType": "image/x-portable-graymap", "targetMediaType": "image/x-portable-pixmap" },
|
||||
@ -663,7 +663,7 @@
|
||||
{"sourceMediaType": "image/png", "targetMediaType": "image/vnd.adobe.photoshop" },
|
||||
{"sourceMediaType": "image/png", "targetMediaType": "image/x-raw-red" },
|
||||
{"sourceMediaType": "image/png", "targetMediaType": "image/x-raw-fuji" },
|
||||
{"sourceMediaType": "image/png", "targetMediaType": "image/png" },
|
||||
{"sourceMediaType": "image/png", "priority": 55, "targetMediaType": "image/png" },
|
||||
{"sourceMediaType": "image/png", "targetMediaType": "image/x-raw-panasonic" },
|
||||
{"sourceMediaType": "image/png", "targetMediaType": "image/x-raw-leica" },
|
||||
{"sourceMediaType": "image/png", "targetMediaType": "image/x-cmu-raster" },
|
||||
@ -691,7 +691,7 @@
|
||||
{"sourceMediaType": "image/x-portable-anymap", "targetMediaType": "image/x-portable-bitmap" },
|
||||
{"sourceMediaType": "image/x-portable-anymap", "targetMediaType": "image/x-raw-pentax" },
|
||||
{"sourceMediaType": "image/x-portable-anymap", "targetMediaType": "image/x-portable-graymap" },
|
||||
{"sourceMediaType": "image/x-portable-anymap", "targetMediaType": "image/x-portable-anymap" },
|
||||
{"sourceMediaType": "image/x-portable-anymap", "priority": 55, "targetMediaType": "image/x-portable-anymap" },
|
||||
{"sourceMediaType": "image/x-portable-anymap", "targetMediaType": "image/vnd.adobe.premiere" },
|
||||
{"sourceMediaType": "image/x-portable-anymap", "targetMediaType": "image/x-portable-pixmap" },
|
||||
{"sourceMediaType": "image/x-portable-anymap", "targetMediaType": "image/vnd.adobe.photoshop" },
|
||||
@ -726,7 +726,7 @@
|
||||
{"sourceMediaType": "image/vnd.adobe.premiere", "targetMediaType": "image/x-raw-pentax" },
|
||||
{"sourceMediaType": "image/vnd.adobe.premiere", "targetMediaType": "image/x-portable-graymap" },
|
||||
{"sourceMediaType": "image/vnd.adobe.premiere", "targetMediaType": "image/x-portable-anymap" },
|
||||
{"sourceMediaType": "image/vnd.adobe.premiere", "targetMediaType": "image/vnd.adobe.premiere" },
|
||||
{"sourceMediaType": "image/vnd.adobe.premiere", "priority": 55, "targetMediaType": "image/vnd.adobe.premiere" },
|
||||
{"sourceMediaType": "image/vnd.adobe.premiere", "targetMediaType": "image/x-portable-pixmap" },
|
||||
{"sourceMediaType": "image/vnd.adobe.premiere", "targetMediaType": "image/vnd.adobe.photoshop" },
|
||||
{"sourceMediaType": "image/vnd.adobe.premiere", "targetMediaType": "image/x-raw-red" },
|
||||
@ -761,7 +761,7 @@
|
||||
{"sourceMediaType": "image/x-portable-pixmap", "targetMediaType": "image/x-portable-graymap" },
|
||||
{"sourceMediaType": "image/x-portable-pixmap", "targetMediaType": "image/x-portable-anymap" },
|
||||
{"sourceMediaType": "image/x-portable-pixmap", "targetMediaType": "image/vnd.adobe.premiere" },
|
||||
{"sourceMediaType": "image/x-portable-pixmap", "targetMediaType": "image/x-portable-pixmap" },
|
||||
{"sourceMediaType": "image/x-portable-pixmap", "priority": 55, "targetMediaType": "image/x-portable-pixmap" },
|
||||
{"sourceMediaType": "image/x-portable-pixmap", "targetMediaType": "image/vnd.adobe.photoshop" },
|
||||
{"sourceMediaType": "image/x-portable-pixmap", "targetMediaType": "image/x-raw-red" },
|
||||
{"sourceMediaType": "image/x-portable-pixmap", "targetMediaType": "image/x-raw-fuji" },
|
||||
@ -796,7 +796,7 @@
|
||||
{"sourceMediaType": "mage/vnd.adobe.photoshop", "targetMediaType": "image/x-portable-anymap" },
|
||||
{"sourceMediaType": "mage/vnd.adobe.photoshop", "targetMediaType": "image/vnd.adobe.premiere" },
|
||||
{"sourceMediaType": "mage/vnd.adobe.photoshop", "targetMediaType": "image/x-portable-pixmap" },
|
||||
{"sourceMediaType": "mage/vnd.adobe.photoshop", "targetMediaType": "image/vnd.adobe.photoshop" },
|
||||
{"sourceMediaType": "mage/vnd.adobe.photoshop", "priority": 55, "targetMediaType": "image/vnd.adobe.photoshop" },
|
||||
{"sourceMediaType": "mage/vnd.adobe.photoshop", "targetMediaType": "image/x-raw-red" },
|
||||
{"sourceMediaType": "mage/vnd.adobe.photoshop", "targetMediaType": "image/x-raw-fuji" },
|
||||
{"sourceMediaType": "mage/vnd.adobe.photoshop", "targetMediaType": "image/png" },
|
||||
@ -831,7 +831,7 @@
|
||||
{"sourceMediaType": "image/x-raw-red", "targetMediaType": "image/vnd.adobe.premiere" },
|
||||
{"sourceMediaType": "image/x-raw-red", "targetMediaType": "image/x-portable-pixmap" },
|
||||
{"sourceMediaType": "image/x-raw-red", "targetMediaType": "image/vnd.adobe.photoshop" },
|
||||
{"sourceMediaType": "image/x-raw-red", "targetMediaType": "image/x-raw-red" },
|
||||
{"sourceMediaType": "image/x-raw-red", "priority": 55, "targetMediaType": "image/x-raw-red" },
|
||||
{"sourceMediaType": "image/x-raw-red", "targetMediaType": "image/x-raw-fuji" },
|
||||
{"sourceMediaType": "image/x-raw-red", "targetMediaType": "image/png" },
|
||||
{"sourceMediaType": "image/x-raw-red", "targetMediaType": "image/x-raw-panasonic" },
|
||||
@ -866,7 +866,7 @@
|
||||
{"sourceMediaType": "image/x-raw-fuji", "targetMediaType": "image/x-portable-pixmap" },
|
||||
{"sourceMediaType": "image/x-raw-fuji", "targetMediaType": "image/vnd.adobe.photoshop" },
|
||||
{"sourceMediaType": "image/x-raw-fuji", "targetMediaType": "image/x-raw-red" },
|
||||
{"sourceMediaType": "image/x-raw-fuji", "targetMediaType": "image/x-raw-fuji" },
|
||||
{"sourceMediaType": "image/x-raw-fuji", "priority": 55, "targetMediaType": "image/x-raw-fuji" },
|
||||
{"sourceMediaType": "image/x-raw-fuji", "targetMediaType": "image/png" },
|
||||
{"sourceMediaType": "image/x-raw-fuji", "targetMediaType": "image/x-raw-panasonic" },
|
||||
{"sourceMediaType": "image/x-raw-fuji", "targetMediaType": "image/x-raw-leica" },
|
||||
@ -904,7 +904,7 @@
|
||||
{"sourceMediaType": "image/x-cmu-raster", "targetMediaType": "image/png" },
|
||||
{"sourceMediaType": "image/x-cmu-raster", "targetMediaType": "image/x-raw-panasonic" },
|
||||
{"sourceMediaType": "image/x-cmu-raster", "targetMediaType": "image/x-raw-leica" },
|
||||
{"sourceMediaType": "image/x-cmu-raster", "targetMediaType": "image/x-cmu-raster" },
|
||||
{"sourceMediaType": "image/x-cmu-raster", "priority": 55, "targetMediaType": "image/x-cmu-raster" },
|
||||
{"sourceMediaType": "image/x-cmu-raster", "targetMediaType": "image/tiff" },
|
||||
{"sourceMediaType": "image/x-cmu-raster", "targetMediaType": "image/x-raw-sigma" },
|
||||
{"sourceMediaType": "image/x-cmu-raster", "targetMediaType": "image/x-xbitmap" },
|
||||
@ -936,7 +936,7 @@
|
||||
{"sourceMediaType": "image/x-raw-panasonic", "targetMediaType": "image/x-raw-red" },
|
||||
{"sourceMediaType": "image/x-raw-panasonic", "targetMediaType": "image/x-raw-fuji" },
|
||||
{"sourceMediaType": "image/x-raw-panasonic", "targetMediaType": "image/png" },
|
||||
{"sourceMediaType": "image/x-raw-panasonic", "targetMediaType": "image/x-raw-panasonic" },
|
||||
{"sourceMediaType": "image/x-raw-panasonic", "priority": 55, "targetMediaType": "image/x-raw-panasonic" },
|
||||
{"sourceMediaType": "image/x-raw-panasonic", "targetMediaType": "image/x-raw-leica" },
|
||||
{"sourceMediaType": "image/x-raw-panasonic", "targetMediaType": "image/x-cmu-raster" },
|
||||
{"sourceMediaType": "image/x-raw-panasonic", "targetMediaType": "image/tiff" },
|
||||
@ -971,7 +971,7 @@
|
||||
{"sourceMediaType": "image/x-raw-leica", "targetMediaType": "image/x-raw-fuji" },
|
||||
{"sourceMediaType": "image/x-raw-leica", "targetMediaType": "image/png" },
|
||||
{"sourceMediaType": "image/x-raw-leica", "targetMediaType": "image/x-raw-panasonic" },
|
||||
{"sourceMediaType": "image/x-raw-leica", "targetMediaType": "image/x-raw-leica" },
|
||||
{"sourceMediaType": "image/x-raw-leica", "priority": 55, "targetMediaType": "image/x-raw-leica" },
|
||||
{"sourceMediaType": "image/x-raw-leica", "targetMediaType": "image/x-cmu-raster" },
|
||||
{"sourceMediaType": "image/x-raw-leica", "targetMediaType": "image/tiff" },
|
||||
{"sourceMediaType": "image/x-raw-leica", "targetMediaType": "image/x-raw-sigma" },
|
||||
@ -1007,7 +1007,7 @@
|
||||
{"sourceMediaType": "image/tiff", "targetMediaType": "image/x-raw-panasonic" },
|
||||
{"sourceMediaType": "image/tiff", "targetMediaType": "image/x-raw-leica" },
|
||||
{"sourceMediaType": "image/tiff", "targetMediaType": "image/x-cmu-raster" },
|
||||
{"sourceMediaType": "image/tiff", "targetMediaType": "image/tiff" },
|
||||
{"sourceMediaType": "image/tiff", "priority": 55, "targetMediaType": "image/tiff" },
|
||||
{"sourceMediaType": "image/tiff", "targetMediaType": "image/x-raw-sigma" },
|
||||
{"sourceMediaType": "image/tiff", "targetMediaType": "image/x-xbitmap" },
|
||||
{"sourceMediaType": "image/tiff", "targetMediaType": "image/x-xpixmap" },
|
||||
@ -1043,7 +1043,7 @@
|
||||
{"sourceMediaType": "image/x-raw-sigma", "targetMediaType": "image/x-raw-leica" },
|
||||
{"sourceMediaType": "image/x-raw-sigma", "targetMediaType": "image/x-cmu-raster" },
|
||||
{"sourceMediaType": "image/x-raw-sigma", "targetMediaType": "image/tiff" },
|
||||
{"sourceMediaType": "image/x-raw-sigma", "targetMediaType": "image/x-raw-sigma" },
|
||||
{"sourceMediaType": "image/x-raw-sigma", "priority": 55, "targetMediaType": "image/x-raw-sigma" },
|
||||
{"sourceMediaType": "image/x-raw-sigma", "targetMediaType": "image/x-xbitmap" },
|
||||
{"sourceMediaType": "image/x-raw-sigma", "targetMediaType": "image/x-xpixmap" },
|
||||
{"sourceMediaType": "image/x-raw-sigma", "targetMediaType": "image/x-xwindowdump" },
|
||||
@ -1078,7 +1078,7 @@
|
||||
{"sourceMediaType": "image/x-xbitmap", "targetMediaType": "image/x-cmu-raster" },
|
||||
{"sourceMediaType": "image/x-xbitmap", "targetMediaType": "image/tiff" },
|
||||
{"sourceMediaType": "image/x-xbitmap", "targetMediaType": "image/x-raw-sigma" },
|
||||
{"sourceMediaType": "image/x-xbitmap", "targetMediaType": "image/x-xbitmap" },
|
||||
{"sourceMediaType": "image/x-xbitmap", "priority": 55, "targetMediaType": "image/x-xbitmap" },
|
||||
{"sourceMediaType": "image/x-xbitmap", "targetMediaType": "image/x-xpixmap" },
|
||||
{"sourceMediaType": "image/x-xbitmap", "targetMediaType": "image/x-xwindowdump" },
|
||||
|
||||
@ -1113,7 +1113,7 @@
|
||||
{"sourceMediaType": "image/x-xpixmap", "targetMediaType": "image/tiff" },
|
||||
{"sourceMediaType": "image/x-xpixmap", "targetMediaType": "image/x-raw-sigma" },
|
||||
{"sourceMediaType": "image/x-xpixmap", "targetMediaType": "image/x-xbitmap" },
|
||||
{"sourceMediaType": "image/x-xpixmap", "targetMediaType": "image/x-xpixmap" },
|
||||
{"sourceMediaType": "image/x-xpixmap", "priority": 55, "targetMediaType": "image/x-xpixmap" },
|
||||
{"sourceMediaType": "image/x-xpixmap", "targetMediaType": "image/x-xwindowdump" },
|
||||
|
||||
{"sourceMediaType": "image/x-xwindowdump", "targetMediaType": "image/x-raw-hasselblad" },
|
||||
@ -1148,7 +1148,7 @@
|
||||
{"sourceMediaType": "image/x-xwindowdump", "targetMediaType": "image/x-raw-sigma" },
|
||||
{"sourceMediaType": "image/x-xwindowdump", "targetMediaType": "image/x-xbitmap" },
|
||||
{"sourceMediaType": "image/x-xwindowdump", "targetMediaType": "image/x-xpixmap" },
|
||||
{"sourceMediaType": "image/x-xwindowdump", "targetMediaType": "image/x-xwindowdump" }
|
||||
{"sourceMediaType": "image/x-xwindowdump", "priority": 55, "targetMediaType": "image/x-xwindowdump" }
|
||||
],
|
||||
"transformOptions": [
|
||||
"imageMagickOptions"
|
||||
|
@ -8,7 +8,7 @@
|
||||
{"sourceMediaType": "text/csv", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet-template" },
|
||||
{"sourceMediaType": "text/csv", "targetMediaType": "text/tab-separated-values" },
|
||||
{"sourceMediaType": "text/csv", "targetMediaType": "application/vnd.ms-excel" },
|
||||
{"sourceMediaType": "text/csv", "maxSourceSizeBytes": 10485760, "targetMediaType": "application/pdf" },
|
||||
{"sourceMediaType": "text/csv", "maxSourceSizeBytes": 10485760, "priority": 55, "targetMediaType": "application/pdf" },
|
||||
|
||||
{"sourceMediaType": "application/msword", "targetMediaType": "text/html" },
|
||||
{"sourceMediaType": "application/msword", "targetMediaType": "application/vnd.oasis.opendocument.text" },
|
||||
@ -40,7 +40,7 @@
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "maxSourceSizeBytes": 786432, "targetMediaType": "application/pdf" },
|
||||
|
||||
{"sourceMediaType": "text/html", "targetMediaType": "application/msword" },
|
||||
{"sourceMediaType": "text/html", "targetMediaType": "text/html" },
|
||||
{"sourceMediaType": "text/html", "priority": 55, "targetMediaType": "text/html" },
|
||||
{"sourceMediaType": "text/html", "targetMediaType": "application/vnd.oasis.opendocument.text" },
|
||||
{"sourceMediaType": "text/html", "targetMediaType": "application/rtf" },
|
||||
|
||||
@ -164,7 +164,7 @@
|
||||
{"sourceMediaType": "application/vnd.sun.xml.writer", "targetMediaType": "application/rtf" },
|
||||
{"sourceMediaType": "application/vnd.sun.xml.writer", "targetMediaType": "application/pdf" },
|
||||
|
||||
{"sourceMediaType": "text/tab-separated-values", "targetMediaType": "text/html" },
|
||||
{"sourceMediaType": "text/tab-separated-values", "priority": 55, "targetMediaType": "text/html" },
|
||||
{"sourceMediaType": "text/tab-separated-values", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet" },
|
||||
{"sourceMediaType": "text/tab-separated-values", "targetMediaType": "application/vnd.oasis.opendocument.spreadsheet-template" },
|
||||
{"sourceMediaType": "text/tab-separated-values", "targetMediaType": "text/csv" },
|
||||
|
@ -87,7 +87,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<version>1.62</version>
|
||||
<version>1.63</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
|
@ -31,14 +31,12 @@ import static org.alfresco.transformer.executors.Tika.NOT_EXTRACT_BOOKMARKS_TEXT
|
||||
import static org.alfresco.transformer.executors.Tika.PDF_BOX;
|
||||
import static org.alfresco.transformer.executors.Tika.TARGET_ENCODING;
|
||||
import static org.alfresco.transformer.executors.Tika.TARGET_MIMETYPE;
|
||||
import static org.alfresco.transformer.executors.Tika.TRANSFORM_NAMES;
|
||||
import static org.alfresco.transformer.fs.FileManager.createAttachment;
|
||||
import static org.alfresco.transformer.fs.FileManager.createSourceFile;
|
||||
import static org.alfresco.transformer.fs.FileManager.createTargetFile;
|
||||
import static org.alfresco.transformer.fs.FileManager.createTargetFileName;
|
||||
import static org.alfresco.transformer.util.MimetypeMap.MIMETYPE_TEXT_PLAIN;
|
||||
import static org.alfresco.transformer.util.Util.stringToBoolean;
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE;
|
||||
|
||||
@ -47,7 +45,6 @@ import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transformer.executors.TikaJavaExecutor;
|
||||
import org.alfresco.transformer.logging.LogEntry;
|
||||
import org.alfresco.transformer.probes.ProbeTestTransform;
|
||||
@ -121,43 +118,50 @@ public class TikaController extends AbstractTransformerController
|
||||
|
||||
@PostMapping(value = "/transform", consumes = MULTIPART_FORM_DATA_VALUE)
|
||||
public ResponseEntity<Resource> transform(HttpServletRequest request,
|
||||
@RequestParam("file") MultipartFile sourceMultipartFile,
|
||||
@RequestParam("targetExtension") String targetExtension,
|
||||
@RequestParam("targetMimetype") String targetMimetype,
|
||||
@RequestParam("targetEncoding") String targetEncoding,
|
||||
@RequestParam("file") final MultipartFile sourceMultipartFile,
|
||||
@RequestParam("sourceMimetype") final String sourceMimetype,
|
||||
@RequestParam("targetExtension") final String targetExtension,
|
||||
@RequestParam("targetMimetype") final String targetMimetype,
|
||||
@RequestParam("targetEncoding") final String targetEncoding,
|
||||
|
||||
@RequestParam(value = "timeout", required = false) Long timeout,
|
||||
@RequestParam(value = "testDelay", required = false) Long testDelay,
|
||||
@RequestParam(value = "timeout", required = false) final Long timeout,
|
||||
@RequestParam(value = "testDelay", required = false) final Long testDelay,
|
||||
|
||||
@RequestParam(value = "transform") String transform,
|
||||
@RequestParam(value = "includeContents", required = false) Boolean includeContents,
|
||||
@RequestParam(value = "notExtractBookmarksText", required = false) Boolean notExtractBookmarksText)
|
||||
@RequestParam(value = "includeContents", required = false) final Boolean includeContents,
|
||||
@RequestParam(value = "notExtractBookmarksText", required = false) final Boolean notExtractBookmarksText)
|
||||
{
|
||||
if (!TRANSFORM_NAMES.contains(transform))
|
||||
{
|
||||
throw new TransformException(BAD_REQUEST.value(), "Invalid transform value");
|
||||
}
|
||||
final String targetFilename = createTargetFileName(
|
||||
sourceMultipartFile.getOriginalFilename(), targetExtension);
|
||||
|
||||
String targetFilename = createTargetFileName(sourceMultipartFile.getOriginalFilename(),
|
||||
targetExtension);
|
||||
getProbeTestTransform().incrementTransformerCount();
|
||||
File sourceFile = createSourceFile(request, sourceMultipartFile);
|
||||
File targetFile = createTargetFile(request, targetFilename);
|
||||
|
||||
final File sourceFile = createSourceFile(request, sourceMultipartFile);
|
||||
final File targetFile = createTargetFile(request, targetFilename);
|
||||
// Both files are deleted by TransformInterceptor.afterCompletion
|
||||
|
||||
// TODO Consider streaming the request and response rather than using temporary files
|
||||
// https://www.logicbig.com/tutorials/spring-framework/spring-web-mvc/streaming-response-body.html
|
||||
|
||||
final Map<String, String> transformOptions = createTransformOptions(
|
||||
"includeContents", includeContents,
|
||||
"notExtractBookmarksText", notExtractBookmarksText,
|
||||
"targetEncoding", targetEncoding);
|
||||
|
||||
final String transform = getTransformerName(sourceFile, sourceMimetype, targetMimetype,
|
||||
transformOptions);
|
||||
|
||||
javaExecutor.call(sourceFile, targetFile, transform,
|
||||
includeContents != null && includeContents ? INCLUDE_CONTENTS : null,
|
||||
notExtractBookmarksText != null && notExtractBookmarksText ? NOT_EXTRACT_BOOKMARKS_TEXT : null,
|
||||
TARGET_MIMETYPE + targetMimetype, TARGET_ENCODING + targetEncoding);
|
||||
|
||||
final ResponseEntity<Resource> body = createAttachment(targetFilename, targetFile);
|
||||
|
||||
LogEntry.setTargetSize(targetFile.length());
|
||||
long time = LogEntry.setStatusCodeAndMessage(OK.value(), "Success");
|
||||
time += LogEntry.addDelay(testDelay);
|
||||
getProbeTestTransform().recordTransformTime(time);
|
||||
|
||||
return body;
|
||||
}
|
||||
|
||||
@ -169,11 +173,13 @@ public class TikaController extends AbstractTransformerController
|
||||
logger.debug("Processing request with: sourceFile '{}', targetFile '{}', transformOptions" +
|
||||
" '{}', timeout {} ms", sourceFile, targetFile, transformOptions, timeout);
|
||||
|
||||
final String transform = transformOptions.get("transform");
|
||||
final Boolean includeContents = stringToBoolean("includeContents");
|
||||
final Boolean notExtractBookmarksText = stringToBoolean("notExtractBookmarksText");
|
||||
final Boolean includeContents = stringToBoolean(transformOptions.get("includeContents"));
|
||||
final Boolean notExtractBookmarksText = stringToBoolean(
|
||||
transformOptions.get("notExtractBookmarksText"));
|
||||
final String targetEncoding = transformOptions.get("targetEncoding");
|
||||
|
||||
final String transform = getTransformerName(sourceFile, sourceMimetype, targetMimetype,
|
||||
transformOptions);
|
||||
javaExecutor.call(sourceFile, targetFile, transform,
|
||||
includeContents != null && includeContents ? INCLUDE_CONTENTS : null,
|
||||
notExtractBookmarksText != null && notExtractBookmarksText ? NOT_EXTRACT_BOOKMARKS_TEXT : null,
|
||||
|
@ -1,16 +1,20 @@
|
||||
{
|
||||
"transformOptions": {
|
||||
"tikaOptions": [
|
||||
{"value": {"name": "transform"}},
|
||||
{"value": {"name": "targetEncoding"}}
|
||||
],
|
||||
"archiveOptions": [
|
||||
{"value": {"name": "includeContents"}},
|
||||
{"value": {"name": "targetEncoding"}}
|
||||
],
|
||||
"pdfboxOptions": [
|
||||
{"value": {"name": "notExtractBookmarksText"}},
|
||||
{"value": {"name": "targetMimetype"}},
|
||||
{"value": {"name": "targetEncoding"}}
|
||||
]
|
||||
},
|
||||
"transformers": [
|
||||
{
|
||||
"transformerName": "tika",
|
||||
"transformerName": "Archive",
|
||||
"supportedSourceAndTargetList": [
|
||||
{"sourceMediaType": "application/x-cpio", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/x-cpio", "targetMediaType": "text/plain"},
|
||||
@ -30,34 +34,229 @@
|
||||
{"sourceMediaType": "application/zip", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/zip", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/zip", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/zip", "targetMediaType": "text/xml"},
|
||||
{"sourceMediaType": "application/zip", "targetMediaType": "text/xml"}
|
||||
],
|
||||
"transformOptions": [
|
||||
"archiveOptions"
|
||||
]
|
||||
},
|
||||
{
|
||||
"transformerName": "OutlookMsg",
|
||||
"supportedSourceAndTargetList": [
|
||||
{"sourceMediaType": "application/vnd.ms-outlook", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-outlook", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-outlook", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-outlook", "targetMediaType": "text/xml"}
|
||||
],
|
||||
"transformOptions": [
|
||||
"tikaOptions"
|
||||
]
|
||||
},
|
||||
{
|
||||
"transformerName": "PdfBox",
|
||||
"supportedSourceAndTargetList": [
|
||||
{"sourceMediaType": "application/pdf", "targetMediaType": "text/csv"},
|
||||
{"sourceMediaType": "application/pdf", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/pdf", "maxSourceSizeBytes": 26214400, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/pdf", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/pdf", "targetMediaType": "text/xml"}
|
||||
],
|
||||
"transformOptions": [
|
||||
"pdfboxOptions"
|
||||
]
|
||||
},
|
||||
{
|
||||
"transformerName": "Office",
|
||||
"supportedSourceAndTargetList": [
|
||||
{"sourceMediaType": "application/msword", "priority": 60, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/msword", "priority": 60, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/msword", "priority": 60, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/msword", "priority": 60, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-project", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-project", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-project", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-project", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-outlook", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-outlook", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-outlook", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-outlook", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint", "priority": 60, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.visio", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.visio", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.visio", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.visio", "priority": 55, "targetMediaType": "text/xml"}
|
||||
],
|
||||
"transformOptions": [
|
||||
"tikaOptions"
|
||||
]
|
||||
},
|
||||
{
|
||||
"transformerName": "Poi",
|
||||
"supportedSourceAndTargetList": [
|
||||
{"sourceMediaType": "application/vnd.ms-excel", "priority": 55, "targetMediaType": "text/csv"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel", "priority": 60, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 55, "targetMediaType": "text/csv"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 65, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 60, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 60, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 60, "targetMediaType": "text/xml"}
|
||||
],
|
||||
"transformOptions": [
|
||||
"tikaOptions"
|
||||
]
|
||||
},
|
||||
{
|
||||
"transformerName": "OOXML",
|
||||
"supportedSourceAndTargetList": [
|
||||
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "priority": 60, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "priority": 60, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "priority": 60, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "priority": 60, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "priority": 60, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "priority": 60, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 60, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "priority": 60, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "priority": 55, "targetMediaType": "text/xml"}
|
||||
],
|
||||
"transformOptions": [
|
||||
"tikaOptions"
|
||||
]
|
||||
},
|
||||
{
|
||||
"transformerName": "TikaAuto",
|
||||
"supportedSourceAndTargetList": [
|
||||
{"sourceMediaType": "application/x-cpio", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/x-cpio", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/x-cpio", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/x-cpio", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/java-archive", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/java-archive", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/java-archive", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/java-archive", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/x-netcdf", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/x-netcdf", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/x-netcdf", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/x-netcdf", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/msword", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/msword", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/msword", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/msword", "targetMediaType": "text/xml"},
|
||||
{"sourceMediaType": "application/msword", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/msword", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/msword", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/msword", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-word.document.macroenabled.12", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document" , "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-word.template.macroenabled.12", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "targetMediaType": "text/xml"},
|
||||
@ -73,12 +272,12 @@
|
||||
{"sourceMediaType": "application/x-hdf", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "text/html", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "text/html", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/html", "priority": 60, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/html", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "text/html", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "text/x-java-source", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "text/x-java-source", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/x-java-source", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/x-java-source", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "text/x-java-source", "targetMediaType": "text/xml"},
|
||||
|
||||
@ -110,12 +309,12 @@
|
||||
{"sourceMediaType": "application/vnd.oasis.opendocument.text-master", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.oasis.opendocument.text-master", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.oasis.opendocument.spreadsheet", "targetMediaType": "text/xml"},
|
||||
@ -135,7 +334,7 @@
|
||||
{"sourceMediaType": "application/vnd.oasis.opendocument.text-web", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.oasis.opendocument.text-web", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation-template", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation-template", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation-template", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation-template", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.oasis.opendocument.presentation-template", "targetMediaType": "text/xml"},
|
||||
@ -154,22 +353,22 @@
|
||||
{"sourceMediaType": "application/vnd.apple.pages", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.apple.pages", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/pdf", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/pdf", "maxSourceSizeBytes": 26214400, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/pdf", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/pdf", "targetMediaType": "text/xml"},
|
||||
{"sourceMediaType": "application/pdf", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/pdf", "maxSourceSizeBytes": 26214400, "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/pdf", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/pdf", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.template.macroenabled.12", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.template", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.addin.macroenabled.12", "targetMediaType": "text/xml"},
|
||||
@ -184,17 +383,17 @@
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.presentation.macroenabled.12", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "targetMediaType": "text/xml"},
|
||||
@ -214,12 +413,12 @@
|
||||
{"sourceMediaType": "application/rtf", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/rtf", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-powerpoint.slide.macroenabled.12", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.presentationml.slide", "targetMediaType": "text/xml"},
|
||||
@ -229,8 +428,13 @@
|
||||
{"sourceMediaType": "application/vnd.sun.xml.writer", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.sun.xml.writer", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "text/xml", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "text/xml", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/plain", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "text/plain", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/plain", "priority": 55, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "text/plain", "priority": 55, "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "text/xml", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "text/xml", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/xml", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "text/xml", "targetMediaType": "text/xml"},
|
||||
|
||||
@ -249,22 +453,22 @@
|
||||
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.addin.macroenabled.12", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-excel", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.sheet.binary.macroenabled.12", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.sheet.macroenabled.12", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "targetMediaType": "text/xml"},
|
||||
@ -274,7 +478,7 @@
|
||||
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-excel.template.macroenabled.12", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "priority": 55, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "targetMediaType": "text/xml"},
|
||||
@ -282,12 +486,19 @@
|
||||
{"sourceMediaType": "application/x-compress", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/x-compress", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/x-compress", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/x-compress", "targetMediaType": "text/xml"},
|
||||
|
||||
{"sourceMediaType": "application/vnd.ms-outlook", "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/vnd.ms-outlook", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/vnd.ms-outlook", "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/vnd.ms-outlook", "targetMediaType": "text/xml"}
|
||||
{"sourceMediaType": "application/x-compress", "targetMediaType": "text/xml"}
|
||||
],
|
||||
"transformOptions": [
|
||||
"tikaOptions"
|
||||
]
|
||||
},
|
||||
{
|
||||
"transformerName": "TextMining",
|
||||
"supportedSourceAndTargetList": [
|
||||
{"sourceMediaType": "application/msword", "priority": 65, "targetMediaType": "text/html"},
|
||||
{"sourceMediaType": "application/msword", "priority": 65, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "application/msword", "priority": 65, "targetMediaType": "application/xhtml+xml"},
|
||||
{"sourceMediaType": "application/msword", "targetMediaType": "text/xml"}
|
||||
],
|
||||
"transformOptions": [
|
||||
"tikaOptions"
|
||||
|
@ -5,20 +5,8 @@
|
||||
<h2>Tika Test Transformations</h2>
|
||||
<form method="POST" enctype="multipart/form-data" action="/transform">
|
||||
<table>
|
||||
<tr><td><div style="text-align:right">transform *</div></td><td><select name="transform">
|
||||
<option value="Archive">Archive</option>
|
||||
<option value="OutlookMsg">OutlookMsg</option>
|
||||
<option selected="selected" value="PdfBox">PdfBox</option>
|
||||
<option value="Office">Office</option>
|
||||
<option value="Poi">Poi</option>
|
||||
<option value="OOXML">OOXML</option>
|
||||
<option value="TikaAuto">TikaAuto</option>
|
||||
<option value="TextMining">TextMining</option>
|
||||
<option value="UNSET"></option>
|
||||
<option value="BADVALUE">BADVALUE</option>
|
||||
<option value="MIXED CASE TikaAuto">TikaAuto</option>
|
||||
</select></td></tr>
|
||||
<tr><td><div style="text-align:right">file *</div></td><td><input type="file" name="file" /></td></tr>
|
||||
<tr><td><div style="text-align:right">sourceMimetype *</div></td><td><input type="text" name="sourceMimetype" value="application/msword" /></td></tr>
|
||||
<tr><td><div style="text-align:right">targetExtension *</div></td><td><input type="text" name="targetExtension" value="txt" /></td></tr>
|
||||
<tr><td><div style="text-align:right">targetMimetype *</div></td><td><input type="text" name="targetMimetype" value="text/plain" /></td></tr>
|
||||
<tr><td><div style="text-align:right">targetEncoding *</div></td><td><input type="text" name="targetEncoding" value="UTF-8" /></td></tr>
|
||||
|
@ -236,7 +236,6 @@ public class TikaControllerTest extends AbstractTransformerControllerTest
|
||||
{
|
||||
// We don't use targetFileBytes as some of the transforms contain different date text based on the os being used.
|
||||
mockTransformCommand(sourceExtension, targetExtension, sourceMimetype, false);
|
||||
this.transform = transform;
|
||||
this.targetMimetype = targetMimetype;
|
||||
|
||||
System.out.println("Test " + transform + " " + sourceExtension + " to " + targetExtension);
|
||||
@ -261,9 +260,9 @@ public class TikaControllerTest extends AbstractTransformerControllerTest
|
||||
String... params)
|
||||
{
|
||||
return super.mockMvcRequest(url, sourceFile, params)
|
||||
.param("transform", transform)
|
||||
.param("targetEncoding", targetEncoding)
|
||||
.param("targetMimetype", targetMimetype);
|
||||
.param("targetMimetype", targetMimetype)
|
||||
.param("sourceMimetype", sourceMimetype);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -540,8 +539,6 @@ public class TikaControllerTest extends AbstractTransformerControllerTest
|
||||
transformRequest.setTargetExtension(targetExtension);
|
||||
transformRequest.setSourceMediaType(APPLICATION_PDF_VALUE);
|
||||
transformRequest.setTargetMediaType(TEXT_PLAIN_VALUE);
|
||||
transformRequest.getTransformRequestOptions().put("transform", "PdfBox");
|
||||
transformRequest.getTransformRequestOptions().put("targetMimetype", TEXT_PLAIN_VALUE);
|
||||
transformRequest.getTransformRequestOptions().put("targetEncoding", "UTF-8");
|
||||
}
|
||||
|
||||
@ -563,6 +560,7 @@ public class TikaControllerTest extends AbstractTransformerControllerTest
|
||||
transformRequest.setSourceExtension(sourceExtension);
|
||||
transformRequest.setSourceSize(sourceFile.length());
|
||||
transformRequest.setTargetExtension(targetExtension);
|
||||
transformRequest.setSourceMediaType(sourceMimetype);
|
||||
|
||||
// HTTP Request
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
|
@ -26,10 +26,16 @@
|
||||
*/
|
||||
package org.alfresco.transformer;
|
||||
|
||||
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA;
|
||||
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
|
||||
/**
|
||||
* Tests TikaController with a server test harness.
|
||||
@ -49,4 +55,22 @@ public class TikaHttpRequestTest extends AbstractHttpRequestTest
|
||||
{
|
||||
return "pdf";
|
||||
}
|
||||
|
||||
// Override method as Tika requires sourceMimetype
|
||||
// If not provided then sourceMimetype request parameter error will be thrown.
|
||||
@Override
|
||||
protected void assertTransformError(boolean addFile, String errorMessage)
|
||||
{
|
||||
LinkedMultiValueMap<String, Object> parameters = new LinkedMultiValueMap<>();
|
||||
if (addFile)
|
||||
{
|
||||
parameters.add("file", new ClassPathResource("quick." + getSourceExtension()));
|
||||
}
|
||||
parameters.add("sourceMimetype", "application/pdf");
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MULTIPART_FORM_DATA);
|
||||
HttpEntity<LinkedMultiValueMap<String, Object>> entity = new HttpEntity<>(parameters,
|
||||
headers);
|
||||
super.sendTranformationRequest(entity, errorMessage);
|
||||
}
|
||||
}
|
||||
|
@ -66,14 +66,14 @@ public class TikaTransformationIT
|
||||
private final String sourceFile;
|
||||
private final String targetExtension;
|
||||
private final String targetMimetype;
|
||||
private final String transform;
|
||||
private final String sourceMimetype;
|
||||
|
||||
public TikaTransformationIT(final Triple<String, String, String> entry)
|
||||
{
|
||||
sourceFile = entry.getLeft();
|
||||
targetExtension = entry.getMiddle();
|
||||
targetMimetype = extensionMimetype.get(entry.getMiddle());
|
||||
transform = entry.getRight();
|
||||
sourceMimetype = entry.getRight();
|
||||
}
|
||||
|
||||
// TODO unit tests for the following file types (for which is difficult to find file samples):
|
||||
@ -87,57 +87,58 @@ public class TikaTransformationIT
|
||||
{
|
||||
return Stream
|
||||
.of(
|
||||
allTargets("quick.doc", "Office"),
|
||||
allTargets("quick.docx", "TikaAuto"),
|
||||
allTargets("quick.html", "TikaAuto"),
|
||||
allTargets("quick.jar", "TikaAuto"),
|
||||
allTargets("quick.java", "TikaAuto"),
|
||||
allTargets("quick.doc", "application/msword"),
|
||||
allTargets("quick.docx",
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"),
|
||||
allTargets("quick.html", "text/html"),
|
||||
allTargets("quick.jar", "application/java-archive"),
|
||||
allTargets("quick.java", "text/x-java-source"),
|
||||
Stream.of(
|
||||
Triple.of("quick.key", "html", "TikaAuto"),
|
||||
// Does not work, alfresco-docker-transform-misc can handle this target mimetype, removed from engine_config.json
|
||||
Triple.of("quick.key", "html", "application/vnd.apple.keynote"),
|
||||
// Does not work, alfresco-docker-sourceMimetype-misc can handle this target mimetype, removed from engine_config.json
|
||||
// Triple.of("quick.key", "txt", "TikaAuto"),
|
||||
Triple.of("quick.key", "xhtml", "TikaAuto"),
|
||||
Triple.of("quick.key", "xml", "TikaAuto")
|
||||
Triple.of("quick.key", "xhtml", "application/vnd.apple.keynote"),
|
||||
Triple.of("quick.key", "xml", "application/vnd.apple.keynote")
|
||||
),
|
||||
allTargets("quick.msg", "OutlookMsg"),
|
||||
allTargets("quick.msg", "application/vnd.ms-outlook"),
|
||||
Stream.of(
|
||||
Triple.of("quick.numbers", "html", "TikaAuto"),
|
||||
// Does not work, alfresco-docker-transform-misc can handle this target mimetype, removed from engine_config.json
|
||||
Triple.of("quick.numbers", "html", "application/vnd.apple.numbers"),
|
||||
// Does not work, alfresco-docker-sourceMimetype-misc can handle this target mimetype, removed from engine_config.json
|
||||
// Triple.of("quick.numbers", "txt", "TikaAuto"),
|
||||
Triple.of("quick.numbers", "xhtml", "TikaAuto"),
|
||||
Triple.of("quick.numbers", "xml", "TikaAuto")
|
||||
Triple.of("quick.numbers", "xhtml", "application/vnd.apple.numbers"),
|
||||
Triple.of("quick.numbers", "xml", "application/vnd.apple.numbers")
|
||||
),
|
||||
allTargets("quick.odp", "TikaAuto"),
|
||||
allTargets("quick.ods", "TikaAuto"),
|
||||
allTargets("quick.odt", "TikaAuto"),
|
||||
allTargets("quick.otp", "TikaAuto"),
|
||||
allTargets("quick.ots", "TikaAuto"),
|
||||
allTargets("quick.ott", "TikaAuto"),
|
||||
allTargets("quick.odp", "application/vnd.oasis.opendocument.presentation"),
|
||||
allTargets("quick.ods", "application/vnd.oasis.opendocument.spreadsheet"),
|
||||
allTargets("quick.odt", "application/vnd.oasis.opendocument.text"),
|
||||
allTargets("quick.otp", "application/vnd.oasis.opendocument.presentation-template"),
|
||||
allTargets("quick.ots", "application/vnd.oasis.opendocument.spreadsheet-template"),
|
||||
allTargets("quick.ott", "application/vnd.oasis.opendocument.text-template"),
|
||||
Stream.of(
|
||||
Triple.of("quick.pages", "html", "TikaAuto"),
|
||||
// Does not work, alfresco-docker-transform-misc can handle this target mimetype, removed from engine_config.json
|
||||
Triple.of("quick.pages", "html", "application/vnd.apple.pages"),
|
||||
// Does not work, alfresco-docker-sourceMimetype-misc can handle this target mimetype, removed from engine_config.json
|
||||
// Triple.of("quick.pages", "txt", "TikaAuto"),
|
||||
Triple.of("quick.pages", "xhtml", "TikaAuto"),
|
||||
Triple.of("quick.pages", "xml", "TikaAuto")
|
||||
Triple.of("quick.pages", "xhtml", "application/vnd.apple.pages"),
|
||||
Triple.of("quick.pages", "xml", "application/vnd.apple.pages")
|
||||
),
|
||||
allTargets("quick.pdf", "TikaAuto"),
|
||||
allTargets("quick.ppt", "TikaAuto"),
|
||||
allTargets("quick.pptx", "TikaAuto"),
|
||||
allTargets("quick.sxw", "TikaAuto"),
|
||||
allTargets("quick.txt", "TikaAuto"),
|
||||
allTargets("quick.vsd", "TikaAuto"),
|
||||
allTargets("quick.xls", "TikaAuto"),
|
||||
allTargets("quick.xslx", "TikaAuto"),
|
||||
allTargets("quick.zip", "TikaAuto"),
|
||||
allTargets("quick.zip", "Archive"),
|
||||
allTargets("quick.jar", "Archive"),
|
||||
allTargets("quick.tar", "Archive"),
|
||||
allTargets("sample.rtf", "TikaAuto"),
|
||||
allTargets("quick.xml", "TikaAuto"),
|
||||
allTargets("sample.xhtml.txt", "TikaAuto"),
|
||||
allTargets("sample.rss", "TikaAuto"),
|
||||
//allTargets("quick.rar", "TikaAuto"),
|
||||
allTargets("quick.tar.gz", "TikaAuto"))
|
||||
allTargets("quick.pdf", "application/pdf"),
|
||||
allTargets("quick.ppt", "application/vnd.ms-powerpoint"),
|
||||
allTargets("quick.pptx",
|
||||
"application/vnd.openxmlformats-officedocument.presentationml.presentation"),
|
||||
allTargets("quick.sxw", "application/vnd.sun.xml.writer"),
|
||||
allTargets("quick.txt", "text/plain"),
|
||||
allTargets("quick.vsd", "application/vnd.visio"),
|
||||
allTargets("quick.xls", "application/vnd.ms-excel"),
|
||||
allTargets("quick.xslx",
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),
|
||||
allTargets("quick.zip", "application/zip"),
|
||||
allTargets("quick.tar", "application/x-tar"),
|
||||
allTargets("sample.rtf", "application/rtf"),
|
||||
allTargets("quick.xml", "text/xml"),
|
||||
allTargets("sample.xhtml.txt", "application/xhtml+xml"),
|
||||
allTargets("sample.rss", "application/rss+xml"),
|
||||
//allTargets("quick.rar", "application/x-rar-compressed"),
|
||||
allTargets("quick.tar.gz", "application/x-gzip"))
|
||||
.flatMap(identity())
|
||||
.collect(toSet());
|
||||
}
|
||||
@ -145,15 +146,15 @@ public class TikaTransformationIT
|
||||
@Test
|
||||
public void testTransformation()
|
||||
{
|
||||
final String descriptor = format("Transform ({0} -> {1}, {2}, transform={3})",
|
||||
sourceFile, targetMimetype, targetExtension, transform);
|
||||
final String descriptor = format("Transform ({0} -> {1}, {2}, sourceMimetype={3})",
|
||||
sourceFile, targetMimetype, targetExtension, sourceMimetype);
|
||||
|
||||
try
|
||||
{
|
||||
final ResponseEntity<Resource> response = sendTRequest(ENGINE_URL, sourceFile, null,
|
||||
targetMimetype, targetExtension, ImmutableMap.of(
|
||||
"targetEncoding", "UTF-8",
|
||||
"transform", transform));
|
||||
"sourceMimetype", sourceMimetype));
|
||||
assertEquals(descriptor, OK, response.getStatusCode());
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -163,11 +164,11 @@ public class TikaTransformationIT
|
||||
}
|
||||
|
||||
private static Stream<Triple<String, String, String>> allTargets(final String sourceFile,
|
||||
final String transform)
|
||||
final String sourceMimetype)
|
||||
{
|
||||
return extensionMimetype
|
||||
.keySet()
|
||||
.stream()
|
||||
.map(k -> Triple.of(sourceFile, k, transform));
|
||||
.map(k -> Triple.of(sourceFile, k, sourceMimetype));
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ import static org.alfresco.transformer.fs.FileManager.createSourceFile;
|
||||
import static org.alfresco.transformer.fs.FileManager.createTargetFile;
|
||||
import static org.alfresco.transformer.fs.FileManager.createTargetFileName;
|
||||
import static org.alfresco.transformer.transformers.HtmlParserContentTransformer.SOURCE_ENCODING;
|
||||
import static org.alfresco.transformer.transformers.HtmlParserContentTransformer.TARGET_ENCODING;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE;
|
||||
|
||||
@ -90,9 +89,8 @@ public class MiscController extends AbstractTransformerController
|
||||
{
|
||||
Map<String, String> parameters = new HashMap<>();
|
||||
parameters.put(SOURCE_ENCODING, "UTF-8");
|
||||
parameters.put(TARGET_ENCODING, "UTF-8");
|
||||
transformer.transform(sourceFile, targetFile, MIMETYPE_HTML, MIMETYPE_TEXT_PLAIN,
|
||||
parameters);
|
||||
transformer.transform("html", sourceFile, targetFile, MIMETYPE_HTML,
|
||||
MIMETYPE_TEXT_PLAIN, parameters);
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -109,7 +107,9 @@ public class MiscController extends AbstractTransformerController
|
||||
" '{}', timeout {} ms", sourceFile, targetFile, transformOptions, timeout);
|
||||
}
|
||||
|
||||
transformer.transform(sourceFile, targetFile, sourceMimetype, targetMimetype,
|
||||
final String transform = getTransformerName(sourceFile, sourceMimetype, targetMimetype,
|
||||
transformOptions);
|
||||
transformer.transform(transform, sourceFile, targetFile, sourceMimetype, targetMimetype,
|
||||
transformOptions);
|
||||
}
|
||||
|
||||
@ -118,15 +118,19 @@ public class MiscController extends AbstractTransformerController
|
||||
@RequestParam("file") MultipartFile sourceMultipartFile,
|
||||
@RequestParam("targetExtension") String targetExtension,
|
||||
@RequestParam("targetMimetype") String targetMimetype,
|
||||
@RequestParam(value = "targetEncoding", required = false) String targetEncoding,
|
||||
@RequestParam("sourceMimetype") String sourceMimetype,
|
||||
@RequestParam(value = "testDelay", required = false) Long testDelay,
|
||||
@RequestParam Map<String, String> parameters)
|
||||
@RequestParam(value = "sourceEncoding", required = false) String sourceEncoding,
|
||||
@RequestParam(value = "pageLimit", required = false) String pageLimit,
|
||||
@RequestParam(value = "testDelay", required = false) Long testDelay)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug(
|
||||
"Processing request with: sourceMimetype '{}', targetMimetype '{}' , targetExtension '{}' " +
|
||||
", parameters '{}'", sourceMimetype, targetMimetype, targetExtension, parameters);
|
||||
"Processing request with: sourceMimetype '{}', sourceEncoding '{}', " +
|
||||
"targetMimetype '{}', targetExtension '{}', targetEncoding '{}', pageLimit '{}'",
|
||||
sourceMimetype, sourceEncoding, targetMimetype, targetExtension, targetEncoding,
|
||||
pageLimit);
|
||||
}
|
||||
|
||||
final String targetFilename = createTargetFileName(
|
||||
@ -135,7 +139,15 @@ public class MiscController extends AbstractTransformerController
|
||||
final File sourceFile = createSourceFile(request, sourceMultipartFile);
|
||||
final File targetFile = createTargetFile(request, targetFilename);
|
||||
|
||||
transformer.transform(sourceFile, targetFile, sourceMimetype, targetMimetype, parameters);
|
||||
final Map<String, String> transformOptions = createTransformOptions(
|
||||
"sourceEncoding", sourceEncoding,
|
||||
"targetEncoding", targetEncoding,
|
||||
"pageLimit", pageLimit);
|
||||
|
||||
final String transform = getTransformerName(sourceFile, sourceMimetype, targetMimetype,
|
||||
transformOptions);
|
||||
transformer.transform(transform, sourceFile, targetFile, sourceMimetype, targetMimetype,
|
||||
transformOptions);
|
||||
|
||||
final ResponseEntity<Resource> body = createAttachment(targetFilename, targetFile);
|
||||
LogEntry.setTargetSize(targetFile.length());
|
||||
|
@ -27,9 +27,6 @@
|
||||
package org.alfresco.transformer.transformers;
|
||||
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IMAGE_JPEG;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IWORK_KEYNOTE;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IWORK_NUMBERS;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IWORK_PAGES;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
@ -76,15 +73,6 @@ public class AppleIWorksContentTransformer implements SelectableTransformer
|
||||
// (225 x 173) preview-web.jpg
|
||||
// (53 x 41) preview-micro.jpg
|
||||
|
||||
@Override
|
||||
public boolean isTransformable(String sourceMimetype, String targetMimetype,
|
||||
Map<String, String> parameters)
|
||||
{
|
||||
return MIMETYPE_IWORK_KEYNOTE.equals(sourceMimetype) ||
|
||||
MIMETYPE_IWORK_NUMBERS.equals(sourceMimetype) ||
|
||||
MIMETYPE_IWORK_PAGES.equals(sourceMimetype);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final File sourceFile, final File targetFile, final String sourceMimetype,
|
||||
final String targetMimetype, final Map<String, String> parameters)
|
||||
|
@ -26,19 +26,13 @@
|
||||
*/
|
||||
package org.alfresco.transformer.transformers;
|
||||
|
||||
import org.alfresco.transformer.fs.FileManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_HTML;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_MULTIPART_ALTERNATIVE;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_RFC822;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
@ -55,6 +49,9 @@ import javax.mail.Part;
|
||||
import javax.mail.Session;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
|
||||
import org.alfresco.transformer.fs.FileManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Uses javax.mail.MimeMessage to generate plain text versions of RFC822 email
|
||||
@ -67,7 +64,6 @@ import javax.mail.internet.MimeMessage;
|
||||
* <p>
|
||||
* This code is based on a class of the same name originally implemented in alfresco-repository.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public class EMLTransformer implements SelectableTransformer
|
||||
|
||||
@ -77,31 +73,18 @@ public class EMLTransformer implements SelectableTransformer
|
||||
private static final String CHARSET = "charset";
|
||||
private static final String DEFAULT_ENCODING = "UTF-8";
|
||||
|
||||
@Override
|
||||
public boolean isTransformable(String sourceMimetype, String targetMimetype, Map<String, String> parameters)
|
||||
{
|
||||
if (!MIMETYPE_RFC822.equals(sourceMimetype)
|
||||
|| !MIMETYPE_TEXT_PLAIN.equals(targetMimetype))
|
||||
{
|
||||
// only support RFC822 -> TEXT
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final File sourceFile, final File targetFile, final String sourceMimetype,
|
||||
final String targetMimetype, final Map<String, String> parameters) throws Exception
|
||||
{
|
||||
logger.debug("Performing RFC822 to text transform.");
|
||||
// Use try with resource
|
||||
try (InputStream contentInputStream = new BufferedInputStream( new FileInputStream(sourceFile));
|
||||
try (InputStream contentInputStream = new BufferedInputStream(
|
||||
new FileInputStream(sourceFile));
|
||||
Writer bufferedFileWriter = new BufferedWriter(new FileWriter(targetFile)))
|
||||
{
|
||||
MimeMessage mimeMessage = new MimeMessage(Session.getDefaultInstance(new Properties()), contentInputStream);
|
||||
MimeMessage mimeMessage = new MimeMessage(Session.getDefaultInstance(new Properties()),
|
||||
contentInputStream);
|
||||
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
Object content = mimeMessage.getContent();
|
||||
@ -125,9 +108,11 @@ public class EMLTransformer implements SelectableTransformer
|
||||
* @throws MessagingException
|
||||
* @throws IOException
|
||||
*/
|
||||
private void processMultiPart(Multipart multipart, StringBuilder sb) throws MessagingException, IOException
|
||||
private void processMultiPart(Multipart multipart, StringBuilder sb) throws MessagingException,
|
||||
IOException
|
||||
{
|
||||
boolean isAlternativeMultipart = multipart.getContentType().contains(MIMETYPE_MULTIPART_ALTERNATIVE);
|
||||
boolean isAlternativeMultipart = multipart.getContentType().contains(
|
||||
MIMETYPE_MULTIPART_ALTERNATIVE);
|
||||
if (isAlternativeMultipart)
|
||||
{
|
||||
processAlternativeMultipart(multipart, sb);
|
||||
@ -157,7 +142,8 @@ public class EMLTransformer implements SelectableTransformer
|
||||
* @throws IOException
|
||||
* @throws MessagingException
|
||||
*/
|
||||
private void processAlternativeMultipart(Multipart multipart, StringBuilder sb) throws IOException, MessagingException
|
||||
private void processAlternativeMultipart(Multipart multipart, StringBuilder sb) throws
|
||||
IOException, MessagingException
|
||||
{
|
||||
Part partToUse = null;
|
||||
for (int i = 0, n = multipart.getCount(); i < n; i++)
|
||||
@ -211,9 +197,11 @@ public class EMLTransformer implements SelectableTransformer
|
||||
String mailPartContent = part.getContent().toString();
|
||||
|
||||
//create a temporary html file with same mail part content and encoding
|
||||
File tempHtmlFile = FileManager.TempFileProvider.createTempFile("EMLTransformer_", ".html");
|
||||
File tempHtmlFile = FileManager.TempFileProvider.createTempFile("EMLTransformer_",
|
||||
".html");
|
||||
String encoding = getMailPartContentEncoding(part);
|
||||
try (OutputStreamWriter osWriter = new OutputStreamWriter( new FileOutputStream( tempHtmlFile), encoding))
|
||||
try (OutputStreamWriter osWriter = new OutputStreamWriter(
|
||||
new FileOutputStream(tempHtmlFile), encoding))
|
||||
{
|
||||
osWriter.write(mailPartContent);
|
||||
}
|
||||
@ -237,9 +225,9 @@ public class EMLTransformer implements SelectableTransformer
|
||||
int startIndex = contentType.indexOf(CHARSET);
|
||||
if (startIndex > 0)
|
||||
{
|
||||
encoding = contentType.substring(startIndex + CHARSET.length() + 1).replaceAll("\"", "");
|
||||
encoding = contentType.substring(startIndex + CHARSET.length() + 1)
|
||||
.replaceAll("\"", "");
|
||||
}
|
||||
return encoding;
|
||||
}
|
||||
|
||||
}
|
@ -26,9 +26,6 @@
|
||||
*/
|
||||
package org.alfresco.transformer.transformers;
|
||||
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_HTML;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
@ -77,13 +74,6 @@ public class HtmlParserContentTransformer implements SelectableTransformer
|
||||
private static final Logger logger = LoggerFactory.getLogger(
|
||||
HtmlParserContentTransformer.class);
|
||||
|
||||
@Override
|
||||
public boolean isTransformable(String sourceMimetype, String targetMimetype,
|
||||
Map<String, String> parameters)
|
||||
{
|
||||
return MIMETYPE_HTML.equals(sourceMimetype) && MIMETYPE_TEXT_PLAIN.equals(targetMimetype);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final File sourceFile, final File targetFile, final String sourceMimetype,
|
||||
final String targetMimetype, final Map<String, String> parameters) throws Exception
|
||||
|
@ -26,33 +26,11 @@
|
||||
*/
|
||||
package org.alfresco.transformer.transformers;
|
||||
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IMAGE_JPEG;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_PRESENTATION;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_PRESENTATION_ADDIN;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_PRESENTATION_MACRO;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_PRESENTATION_SLIDE;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_PRESENTATION_SLIDESHOW;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_PRESENTATION_SLIDESHOW_MACRO;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_PRESENTATION_SLIDE_MACRO;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_PRESENTATION_TEMPLATE;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_PRESENTATION_TEMPLATE_MACRO;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_SPREADSHEET;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_SPREADSHEET_ADDIN_MACRO;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_SPREADSHEET_BINARY_MACRO;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_SPREADSHEET_MACRO;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_SPREADSHEET_TEMPLATE;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_SPREADSHEET_TEMPLATE_MACRO;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_WORDPROCESSING;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_WORDPROCESSING_MACRO;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_WORD_TEMPLATE;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_WORD_TEMPLATE_MACRO;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||
@ -63,8 +41,6 @@ import org.apache.poi.openxml4j.opc.PackageRelationshipTypes;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
/**
|
||||
* Extracts out Thumbnail JPEGs from OOXML files for thumbnailing and previewing.
|
||||
* This transformer will only work for OOXML files where thumbnailing was enabled,
|
||||
@ -82,36 +58,6 @@ public class OOXMLThumbnailContentTransformer implements SelectableTransformer
|
||||
private static final Logger logger = LoggerFactory.getLogger(
|
||||
OOXMLThumbnailContentTransformer.class);
|
||||
|
||||
private static final List<String> OOXML_MIMETYPES = ImmutableList.of(
|
||||
MIMETYPE_OPENXML_WORDPROCESSING,
|
||||
MIMETYPE_OPENXML_WORDPROCESSING_MACRO,
|
||||
MIMETYPE_OPENXML_WORD_TEMPLATE,
|
||||
MIMETYPE_OPENXML_WORD_TEMPLATE_MACRO,
|
||||
MIMETYPE_OPENXML_PRESENTATION,
|
||||
MIMETYPE_OPENXML_PRESENTATION_MACRO,
|
||||
MIMETYPE_OPENXML_PRESENTATION_SLIDESHOW,
|
||||
MIMETYPE_OPENXML_PRESENTATION_SLIDESHOW_MACRO,
|
||||
MIMETYPE_OPENXML_PRESENTATION_TEMPLATE,
|
||||
MIMETYPE_OPENXML_PRESENTATION_TEMPLATE_MACRO,
|
||||
MIMETYPE_OPENXML_PRESENTATION_ADDIN,
|
||||
MIMETYPE_OPENXML_PRESENTATION_SLIDE,
|
||||
MIMETYPE_OPENXML_PRESENTATION_SLIDE_MACRO,
|
||||
MIMETYPE_OPENXML_SPREADSHEET,
|
||||
MIMETYPE_OPENXML_SPREADSHEET_TEMPLATE,
|
||||
MIMETYPE_OPENXML_SPREADSHEET_MACRO,
|
||||
MIMETYPE_OPENXML_SPREADSHEET_TEMPLATE_MACRO,
|
||||
MIMETYPE_OPENXML_SPREADSHEET_ADDIN_MACRO,
|
||||
MIMETYPE_OPENXML_SPREADSHEET_BINARY_MACRO);
|
||||
|
||||
@Override
|
||||
public boolean isTransformable(String sourceMimetype, String targetMimetype,
|
||||
Map<String, String> parameters)
|
||||
{
|
||||
// only support [OOXML] -> JPEG
|
||||
return MIMETYPE_IMAGE_JPEG.equals(targetMimetype) &&
|
||||
OOXML_MIMETYPES.contains(sourceMimetype);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final File sourceFile, final File targetFile, final String sourceMimetype,
|
||||
final String targetMimetype, final Map<String, String> parameters) throws Exception
|
||||
|
@ -49,15 +49,4 @@ public interface SelectableTransformer
|
||||
*/
|
||||
void transform(File sourceFile, File targetFile, String sourceMimetype,
|
||||
String targetMimetype, Map<String, String> parameters) throws Exception;
|
||||
|
||||
/**
|
||||
* Determine whether this transformer is applicable for the given MIME types.
|
||||
*
|
||||
* @param sourceMimetype
|
||||
* @param targetMimetype
|
||||
* @param parameters
|
||||
* @return
|
||||
*/
|
||||
boolean isTransformable(String sourceMimetype, String targetMimetype,
|
||||
Map<String, String> parameters);
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
@ -40,7 +39,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
/**
|
||||
* The SelectingTransformer selects a registered {@link SelectableTransformer}
|
||||
@ -53,35 +52,31 @@ public class SelectingTransformer
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(SelectingTransformer.class);
|
||||
|
||||
private final List<SelectableTransformer> transformers;
|
||||
|
||||
public SelectingTransformer()
|
||||
{
|
||||
transformers = ImmutableList.of(
|
||||
new AppleIWorksContentTransformer(),
|
||||
new HtmlParserContentTransformer(),
|
||||
new StringExtractingContentTransformer(),
|
||||
new TextToPdfContentTransformer(),
|
||||
new EMLTransformer()
|
||||
// new OOXMLThumbnailContentTransformer()); // Doesn't work with java 11, transformer and test disabled
|
||||
);
|
||||
}
|
||||
private final Map<String, SelectableTransformer> transformers = ImmutableMap
|
||||
.<String, SelectableTransformer>builder()
|
||||
.put("appleIWorks", new AppleIWorksContentTransformer())
|
||||
.put("html", new HtmlParserContentTransformer())
|
||||
.put("string", new StringExtractingContentTransformer())
|
||||
.put("textToPdf", new TextToPdfContentTransformer())
|
||||
.put("rfc822", new EMLTransformer())
|
||||
.put("ooXmlThumbnail", new OOXMLThumbnailContentTransformer())
|
||||
.build();
|
||||
|
||||
/**
|
||||
* Performs a transform using a transformer selected based on the provided sourceMimetype and targetMimetype
|
||||
*
|
||||
* @param transform the name of the transformer
|
||||
* @param sourceFile File to transform from
|
||||
* @param targetFile File to transform to
|
||||
* @param sourceMimetype Mimetype of the source file
|
||||
* @throws TransformException
|
||||
* @throws TransformException if there was a problem internally
|
||||
*/
|
||||
public void transform(File sourceFile, File targetFile, String sourceMimetype,
|
||||
public void transform(String transform, File sourceFile, File targetFile, String sourceMimetype,
|
||||
String targetMimetype, Map<String, String> parameters) throws TransformException
|
||||
{
|
||||
try
|
||||
{
|
||||
final SelectableTransformer transformer = selectTransformer(sourceMimetype,
|
||||
targetMimetype, parameters);
|
||||
final SelectableTransformer transformer = transformers.get(transform);
|
||||
logOptions(sourceFile, targetFile, parameters);
|
||||
transformer.transform(sourceFile, targetFile, sourceMimetype, targetMimetype,
|
||||
parameters);
|
||||
@ -106,23 +101,6 @@ public class SelectingTransformer
|
||||
}
|
||||
}
|
||||
|
||||
private SelectableTransformer selectTransformer(String sourceMimetype, String targetMimetype,
|
||||
Map<String, String> parameters)
|
||||
{
|
||||
for (SelectableTransformer transformer : transformers)
|
||||
{
|
||||
if (transformer.isTransformable(sourceMimetype, targetMimetype, parameters))
|
||||
{
|
||||
logger.debug("Using {} to transform from {} to {}",
|
||||
transformer.getClass().getName(), sourceMimetype, targetMimetype);
|
||||
return transformer;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException(
|
||||
"Could not select a transformer for sourceMimetype=" + sourceMimetype
|
||||
+ " targetMimetype=" + targetMimetype);
|
||||
}
|
||||
|
||||
private static String getMessage(Exception e)
|
||||
{
|
||||
return e.getMessage() == null || e.getMessage().isEmpty() ? e.getClass().getSimpleName() : e.getMessage();
|
||||
|
@ -26,10 +26,6 @@
|
||||
*/
|
||||
package org.alfresco.transformer.transformers;
|
||||
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_DITA;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_JAVASCRIPT;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
@ -64,16 +60,6 @@ public class StringExtractingContentTransformer implements SelectableTransformer
|
||||
|
||||
private static final Log logger = LogFactory.getLog(StringExtractingContentTransformer.class);
|
||||
|
||||
@Override
|
||||
public boolean isTransformable(String sourceMimetype, String targetMimetype,
|
||||
Map<String, String> parameters)
|
||||
{
|
||||
return (sourceMimetype.startsWith("text/")
|
||||
|| MIMETYPE_JAVASCRIPT.equals(sourceMimetype)
|
||||
|| MIMETYPE_DITA.equals(sourceMimetype))
|
||||
&& MIMETYPE_TEXT_PLAIN.equals(targetMimetype);
|
||||
}
|
||||
|
||||
/**
|
||||
* Text to text conversions are done directly using the content reader and writer string
|
||||
* manipulation methods.
|
||||
|
@ -26,12 +26,6 @@
|
||||
*/
|
||||
package org.alfresco.transformer.transformers;
|
||||
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_DITA;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_PDF;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_CSV;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_XML;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
@ -103,17 +97,6 @@ public class TextToPdfContentTransformer implements SelectableTransformer
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTransformable(String sourceMimetype, String targetMimetype,
|
||||
Map<String, String> parameters)
|
||||
{
|
||||
return (MIMETYPE_TEXT_PLAIN.equals(sourceMimetype) ||
|
||||
MIMETYPE_TEXT_CSV.equals(sourceMimetype) ||
|
||||
MIMETYPE_DITA.equals(sourceMimetype) ||
|
||||
MIMETYPE_XML.equals(sourceMimetype)) &&
|
||||
MIMETYPE_PDF.equals(targetMimetype);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(final File sourceFile, final File targetFile, final String sourceMimetype,
|
||||
final String targetMimetype, final Map<String, String> parameters) throws Exception
|
||||
|
@ -29,9 +29,8 @@
|
||||
{"sourceMediaType": "text/mediawiki", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/css", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/csv", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/javascript", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/xml", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/html", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/html", "priority": 55, "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/richtext", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/sgml", "targetMediaType": "text/plain"},
|
||||
{"sourceMediaType": "text/tab-separated-values", "targetMediaType": "text/plain"},
|
||||
@ -60,7 +59,7 @@
|
||||
{
|
||||
"transformerName": "textToPdf",
|
||||
"supportedSourceAndTargetList": [
|
||||
{"sourceMediaType": "text/plain", "targetMediaType": "application/pdf"},
|
||||
{"sourceMediaType": "text/plain", "priority": 55, "targetMediaType": "application/pdf"},
|
||||
{"sourceMediaType": "text/csv", "targetMediaType": "application/pdf"},
|
||||
{"sourceMediaType": "application/dita+xml", "targetMediaType": "application/pdf"},
|
||||
{"sourceMediaType": "text/xml", "targetMediaType": "application/pdf"}
|
||||
|
@ -33,8 +33,8 @@ import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IWORK_KEYNOT
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IWORK_NUMBERS;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_WORDPROCESSING;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_PDF;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_RFC822;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
@ -42,7 +42,6 @@ import static org.springframework.http.HttpStatus.OK;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
@ -90,7 +89,7 @@ public class MiscControllerTest extends AbstractTransformerControllerTest
|
||||
|
||||
@Override
|
||||
protected void mockTransformCommand(String sourceExtension, String targetExtension,
|
||||
String sourceMimetype, boolean readTargetFileBytes) throws IOException
|
||||
String sourceMimetype, boolean readTargetFileBytes)
|
||||
{
|
||||
}
|
||||
|
||||
@ -109,11 +108,18 @@ public class MiscControllerTest extends AbstractTransformerControllerTest
|
||||
protected MockHttpServletRequestBuilder mockMvcRequest(String url, MockMultipartFile sourceFile,
|
||||
String... params)
|
||||
{
|
||||
return super.mockMvcRequest(url, sourceFile, params)
|
||||
.param("targetEncoding", targetEncoding)
|
||||
final MockHttpServletRequestBuilder builder = super
|
||||
.mockMvcRequest(url, sourceFile, params)
|
||||
.param("sourceEncoding", sourceEncoding)
|
||||
.param("targetMimetype", targetMimetype)
|
||||
.param("sourceMimetype", sourceMimetype);
|
||||
|
||||
// Only the 'string' transformer should have the targetEncoding.
|
||||
if (!"message/rfc822".equals(sourceMimetype) && !"text/html".equals(sourceMimetype))
|
||||
{
|
||||
builder.param("targetEncoding", targetEncoding);
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -157,8 +163,9 @@ public class MiscControllerTest extends AbstractTransformerControllerTest
|
||||
null,
|
||||
readTestFile("spanish.eml"));
|
||||
|
||||
String contentResult = new String(result.getResponse().getContentAsByteArray(), "UTF-8");
|
||||
assertTrue("Content from eml transform didn't contain expected value. ", contentResult.contains(expected));
|
||||
String contentResult = new String(result.getResponse().getContentAsByteArray(), UTF_8);
|
||||
assertTrue("Content from eml transform didn't contain expected value. ",
|
||||
contentResult.contains(expected));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -254,7 +261,7 @@ public class MiscControllerTest extends AbstractTransformerControllerTest
|
||||
MIMETYPE_HTML,
|
||||
"txt",
|
||||
MIMETYPE_TEXT_PLAIN,
|
||||
"UTF-8",
|
||||
null,
|
||||
expected.getBytes());
|
||||
|
||||
String contentResult = new String(result.getResponse().getContentAsByteArray(),
|
||||
@ -325,7 +332,7 @@ public class MiscControllerTest extends AbstractTransformerControllerTest
|
||||
MIMETYPE_TEXT_PLAIN,
|
||||
"pdf",
|
||||
MIMETYPE_PDF,
|
||||
"UTF-8",
|
||||
null,
|
||||
expected.getBytes());
|
||||
|
||||
// Read back in the PDF and check it
|
||||
@ -346,7 +353,8 @@ public class MiscControllerTest extends AbstractTransformerControllerTest
|
||||
{
|
||||
MvcResult result = sendRequest("numbers", null, MIMETYPE_IWORK_NUMBERS,
|
||||
"jpeg", MIMETYPE_IMAGE_JPEG, null, readTestFile("pages"));
|
||||
assertTrue("Expected image content but content is empty.",result.getResponse().getContentLengthLong() > 0L);
|
||||
assertTrue("Expected image content but content is empty.",
|
||||
result.getResponse().getContentLengthLong() > 0L);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -354,7 +362,8 @@ public class MiscControllerTest extends AbstractTransformerControllerTest
|
||||
{
|
||||
MvcResult result = sendRequest("numbers", null, MIMETYPE_IWORK_NUMBERS,
|
||||
"jpeg", MIMETYPE_IMAGE_JPEG, null, readTestFile("numbers"));
|
||||
assertTrue("Expected image content but content is empty.",result.getResponse().getContentLengthLong() > 0L);
|
||||
assertTrue("Expected image content but content is empty.",
|
||||
result.getResponse().getContentLengthLong() > 0L);
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -362,7 +371,8 @@ public class MiscControllerTest extends AbstractTransformerControllerTest
|
||||
{
|
||||
MvcResult result = sendRequest("key", null, MIMETYPE_IWORK_KEYNOTE,
|
||||
"jpeg", MIMETYPE_IMAGE_JPEG, null, readTestFile("key"));
|
||||
assertTrue("Expected image content but content is empty.",result.getResponse().getContentLengthLong() > 0L);
|
||||
assertTrue("Expected image content but content is empty.",
|
||||
result.getResponse().getContentLengthLong() > 0L);
|
||||
}
|
||||
|
||||
// @Test
|
||||
@ -371,7 +381,8 @@ public class MiscControllerTest extends AbstractTransformerControllerTest
|
||||
{
|
||||
MvcResult result = sendRequest("docx", null, MIMETYPE_OPENXML_WORDPROCESSING,
|
||||
"jpeg", MIMETYPE_IMAGE_JPEG, null, readTestFile("docx"));
|
||||
assertTrue("Expected image content but content is empty.",result.getResponse().getContentLengthLong() > 0L);
|
||||
assertTrue("Expected image content but content is empty.",
|
||||
result.getResponse().getContentLengthLong() > 0L);
|
||||
}
|
||||
|
||||
private MvcResult sendRequest(String sourceExtension,
|
||||
@ -382,9 +393,11 @@ public class MiscControllerTest extends AbstractTransformerControllerTest
|
||||
String targetEncoding,
|
||||
byte[] content) throws Exception
|
||||
{
|
||||
MockMultipartFile sourceFile = new MockMultipartFile("file", "test_file." + sourceExtension, sourceMimetype, content);
|
||||
final MockMultipartFile sourceFile = new MockMultipartFile("file",
|
||||
"test_file." + sourceExtension, sourceMimetype, content);
|
||||
|
||||
MockHttpServletRequestBuilder requestBuilder = super.mockMvcRequest("/transform", sourceFile)
|
||||
final MockHttpServletRequestBuilder requestBuilder = super
|
||||
.mockMvcRequest("/transform", sourceFile)
|
||||
.param("targetExtension", targetExtension)
|
||||
.param("targetMimetype", targetMimetype)
|
||||
.param("sourceMimetype", sourceMimetype);
|
||||
@ -398,15 +411,15 @@ public class MiscControllerTest extends AbstractTransformerControllerTest
|
||||
requestBuilder.param("targetEncoding", targetEncoding);
|
||||
}
|
||||
|
||||
MvcResult result = mockMvc.perform(requestBuilder)
|
||||
return mockMvc.perform(requestBuilder)
|
||||
.andExpect(status().is(OK.value()))
|
||||
.andExpect(header().string("Content-Disposition", "attachment; filename*= "
|
||||
+(targetEncoding==null ? "UTF-8" : targetEncoding)+"''test_file." + targetExtension)).
|
||||
andReturn();
|
||||
return result;
|
||||
.andExpect(header().string("Content-Disposition",
|
||||
"attachment; filename*= " +
|
||||
(targetEncoding == null ? "UTF-8" : targetEncoding) +
|
||||
"''test_file." + targetExtension))
|
||||
.andReturn();
|
||||
}
|
||||
|
||||
|
||||
private String clean(String text)
|
||||
{
|
||||
text = text.replaceAll("\\s+\\r", "");
|
||||
|
@ -139,7 +139,6 @@ public class MiscTransformsIT
|
||||
SourceTarget.of("text/mediawiki", "text/plain"),
|
||||
SourceTarget.of("text/css", "text/plain"),
|
||||
SourceTarget.of("text/csv", "text/plain"),
|
||||
SourceTarget.of("text/javascript", "text/plain"),
|
||||
SourceTarget.of("text/xml", "text/plain"),
|
||||
SourceTarget.of("text/html", "text/plain"),
|
||||
SourceTarget.of("text/richtext", "text/plain"),
|
||||
|
@ -41,13 +41,14 @@ import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.util.StringUtils.getFilenameExtension;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.transform.client.model.TransformReply;
|
||||
import org.alfresco.transform.client.model.TransformRequest;
|
||||
import org.alfresco.transform.client.model.TransformRequestValidator;
|
||||
import org.alfresco.transform.client.model.config.TransformConfig;
|
||||
import org.alfresco.transform.client.registry.TransformServiceRegistry;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.alfresco.transformer.clients.AlfrescoSharedFileStoreClient;
|
||||
import org.alfresco.transformer.logging.LogEntry;
|
||||
@ -55,7 +56,6 @@ import org.alfresco.transformer.model.FileRefResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@ -70,8 +70,6 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.client.HttpClientErrorException;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
/**
|
||||
* <p>Abstract Controller, provides structure and helper methods to sub-class transformer controllers.</p>
|
||||
*
|
||||
@ -105,8 +103,6 @@ public abstract class AbstractTransformerController implements TransformControll
|
||||
private static final Logger logger = LoggerFactory.getLogger(
|
||||
AbstractTransformerController.class);
|
||||
|
||||
private static String ENGINE_CONFIG = "engine_config.json";
|
||||
|
||||
@Autowired
|
||||
private AlfrescoSharedFileStoreClient alfrescoSharedFileStoreClient;
|
||||
|
||||
@ -114,27 +110,16 @@ public abstract class AbstractTransformerController implements TransformControll
|
||||
private TransformRequestValidator transformRequestValidator;
|
||||
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
private TransformServiceRegistry transformRegistry;
|
||||
|
||||
@GetMapping(value = "/transform/config")
|
||||
public ResponseEntity<TransformConfig> info()
|
||||
{
|
||||
logger.info("GET Transform Config.");
|
||||
try
|
||||
{
|
||||
ClassPathResource classPathResource = new ClassPathResource(ENGINE_CONFIG);
|
||||
InputStream engineConfigFile = classPathResource.getInputStream();
|
||||
|
||||
TransformConfig transformConfig = objectMapper.readValue(engineConfigFile,
|
||||
TransformConfig.class);
|
||||
final TransformConfig transformConfig =
|
||||
((TransformRegistryImpl) transformRegistry).getTransformConfig();
|
||||
return new ResponseEntity<>(transformConfig, OK);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new TransformException(INTERNAL_SERVER_ERROR.value(),
|
||||
"Could not read Transform Config file.", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* '/transform' endpoint which consumes and produces 'application/json'
|
||||
@ -352,4 +337,39 @@ public abstract class AbstractTransformerController implements TransformControll
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
protected String getTransformerName(final File sourceFile, final String sourceMimetype,
|
||||
final String targetMimetype, final Map<String, String> transformOptions)
|
||||
{
|
||||
final long sourceSizeInBytes = sourceFile.length();
|
||||
final String transformerName = transformRegistry.findTransformerName(sourceMimetype,
|
||||
sourceSizeInBytes, targetMimetype, transformOptions, null);
|
||||
if (transformerName == null)
|
||||
{
|
||||
throw new TransformException(BAD_REQUEST.value(),
|
||||
"No transforms were able to handle the request");
|
||||
}
|
||||
return transformerName;
|
||||
}
|
||||
|
||||
protected Map<String, String> createTransformOptions(Object... namesAndValues)
|
||||
{
|
||||
if (namesAndValues.length % 2 != 0)
|
||||
{
|
||||
logger.error(
|
||||
"Incorrect number of parameters. Should have an even number as they are names and values.");
|
||||
}
|
||||
|
||||
Map<String, String> transformOptions = new HashMap<>();
|
||||
for (int i = 0; i < namesAndValues.length; i += 2)
|
||||
{
|
||||
String name = namesAndValues[i].toString();
|
||||
Object value = namesAndValues[i + 1];
|
||||
if (value != null)
|
||||
{
|
||||
transformOptions.put(name, value.toString());
|
||||
}
|
||||
}
|
||||
return transformOptions;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.transformer;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.alfresco.transform.client.model.config.TransformConfig;
|
||||
import org.alfresco.transform.client.registry.AbstractTransformRegistry;
|
||||
import org.alfresco.transform.client.registry.TransformCache;
|
||||
import org.alfresco.transform.exceptions.TransformException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
/**
|
||||
* Used by clients to work out if a transformation is supported based on the engine_config.json.
|
||||
*/
|
||||
public class TransformRegistryImpl extends AbstractTransformRegistry
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(TransformRegistryImpl.class);
|
||||
|
||||
private static final String ENGINE_CONFIG_JSON = "classpath:engine_config.json";
|
||||
|
||||
@Value(ENGINE_CONFIG_JSON)
|
||||
private Resource engineConfig;
|
||||
|
||||
// Holds the structures used by AbstractTransformRegistry to look up what is supported.
|
||||
// Unlike other sub classes this class does not extend Data or replace it at run time.
|
||||
private TransformCache data = new TransformCache();
|
||||
|
||||
private ObjectMapper jsonObjectMapper = new ObjectMapper();
|
||||
|
||||
TransformConfig getTransformConfig()
|
||||
{
|
||||
try (Reader reader = new InputStreamReader(engineConfig.getInputStream(), UTF_8))
|
||||
{
|
||||
return jsonObjectMapper.readValue(reader, TransformConfig.class);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new TransformException(INTERNAL_SERVER_ERROR.value(),
|
||||
"Could not read " + ENGINE_CONFIG_JSON, e);
|
||||
}
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void afterPropertiesSet()
|
||||
{
|
||||
TransformConfig transformConfig = getTransformConfig();
|
||||
registerAll(transformConfig, null, ENGINE_CONFIG_JSON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransformCache getData()
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void logError(String msg)
|
||||
{
|
||||
log.error(msg);
|
||||
}
|
||||
}
|
@ -27,7 +27,9 @@
|
||||
package org.alfresco.transformer.config;
|
||||
|
||||
import org.alfresco.transform.client.model.TransformRequestValidator;
|
||||
import org.alfresco.transform.client.registry.TransformServiceRegistry;
|
||||
import org.alfresco.transformer.TransformInterceptor;
|
||||
import org.alfresco.transformer.TransformRegistryImpl;
|
||||
import org.alfresco.transformer.clients.AlfrescoSharedFileStoreClient;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@ -42,8 +44,9 @@ public class WebApplicationConfig implements WebMvcConfigurer
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry)
|
||||
{
|
||||
registry.addInterceptor(transformInterceptor()).addPathPatterns("/transform", "/live",
|
||||
"/ready");
|
||||
registry
|
||||
.addInterceptor(transformInterceptor())
|
||||
.addPathPatterns("/transform", "/live", "/ready");
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ -69,4 +72,10 @@ public class WebApplicationConfig implements WebMvcConfigurer
|
||||
{
|
||||
return new TransformRequestValidator();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TransformServiceRegistry transformRegistry()
|
||||
{
|
||||
return new TransformRegistryImpl();
|
||||
}
|
||||
}
|
||||
|
@ -37,18 +37,18 @@ public class Util
|
||||
* @param param String to be converted
|
||||
* @return Null if param is null or converted value as {@link Integer}
|
||||
*/
|
||||
public static Integer stringToInteger(String param)
|
||||
public static Integer stringToInteger(final String param)
|
||||
{
|
||||
return param == null ? null : Integer.parseInt(param);
|
||||
}
|
||||
|
||||
/**
|
||||
* Safely converts a {@link String} to an {@link Integer}
|
||||
* Safely converts a {@link String} to a {@link Boolean}
|
||||
*
|
||||
* @param param String to be converted
|
||||
* @return Null if param is null or converted value as {@link Boolean}
|
||||
*/
|
||||
public static Boolean stringToBoolean(String param)
|
||||
public static Boolean stringToBoolean(final String param)
|
||||
{
|
||||
return param == null ? null : Boolean.parseBoolean(param);
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public abstract class AbstractHttpRequestTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void noTargetExtensionError() throws Exception
|
||||
public void noTargetExtensionError()
|
||||
{
|
||||
assertMissingParameter("targetExtension");
|
||||
}
|
||||
@ -106,7 +106,7 @@ public abstract class AbstractHttpRequestTest
|
||||
getTransformerName() + " - Request parameter '" + name + "' is missing");
|
||||
}
|
||||
|
||||
private void assertTransformError(boolean addFile, String errorMessage)
|
||||
protected void assertTransformError(boolean addFile, String errorMessage)
|
||||
{
|
||||
LinkedMultiValueMap<String, Object> parameters = new LinkedMultiValueMap<>();
|
||||
if (addFile)
|
||||
@ -118,7 +118,14 @@ public abstract class AbstractHttpRequestTest
|
||||
headers.setContentType(MULTIPART_FORM_DATA);
|
||||
HttpEntity<LinkedMultiValueMap<String, Object>> entity = new HttpEntity<>(parameters,
|
||||
headers);
|
||||
ResponseEntity<String> response = restTemplate.exchange("/transform", POST, entity,
|
||||
|
||||
sendTranformationRequest(entity, errorMessage);
|
||||
}
|
||||
|
||||
protected void sendTranformationRequest(
|
||||
final HttpEntity<LinkedMultiValueMap<String, Object>> entity, final String errorMessage)
|
||||
{
|
||||
final ResponseEntity<String> response = restTemplate.exchange("/transform", POST, entity,
|
||||
String.class, "");
|
||||
assertEquals(errorMessage, getErrorMessage(response.getBody()));
|
||||
}
|
||||
|
@ -60,11 +60,13 @@ import org.alfresco.transform.client.model.config.TransformOption;
|
||||
import org.alfresco.transform.client.model.config.TransformOptionGroup;
|
||||
import org.alfresco.transform.client.model.config.TransformOptionValue;
|
||||
import org.alfresco.transform.client.model.config.Transformer;
|
||||
import org.alfresco.transform.client.registry.TransformServiceRegistry;
|
||||
import org.alfresco.transformer.clients.AlfrescoSharedFileStoreClient;
|
||||
import org.alfresco.transformer.probes.ProbeTestTransform;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.boot.test.mock.mockito.SpyBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
@ -91,6 +93,9 @@ public abstract class AbstractTransformerControllerTest
|
||||
@MockBean
|
||||
protected AlfrescoSharedFileStoreClient alfrescoSharedFileStoreClient;
|
||||
|
||||
@SpyBean
|
||||
protected TransformServiceRegistry transformRegistry;
|
||||
|
||||
protected String sourceExtension;
|
||||
protected String targetExtension;
|
||||
protected String sourceMimetype;
|
||||
@ -100,6 +105,13 @@ public abstract class AbstractTransformerControllerTest
|
||||
protected String expectedSourceSuffix;
|
||||
protected Long expectedTimeout = 0L;
|
||||
protected byte[] expectedSourceFileBytes;
|
||||
|
||||
/**
|
||||
* The expected result. Taken resting target quick file's bytes.
|
||||
*
|
||||
* Note: These checks generally don't work on Windows (Mac and Linux are okay). Possibly to do with byte order
|
||||
* loading.
|
||||
*/
|
||||
protected byte[] expectedTargetFileBytes;
|
||||
|
||||
// Called by sub class
|
||||
@ -228,7 +240,7 @@ public abstract class AbstractTransformerControllerTest
|
||||
}
|
||||
|
||||
@Test
|
||||
// Is okay, as the target filename is built up from the whole source filename and the targetExtenstion
|
||||
// Is okay, as the target filename is built up from the whole source filename and the targetExtension
|
||||
public void noExtensionSourceFilenameTest() throws Exception
|
||||
{
|
||||
sourceFile = new MockMultipartFile("file", "../quick", sourceMimetype,
|
||||
@ -334,8 +346,8 @@ public abstract class AbstractTransformerControllerTest
|
||||
.readValue(new ClassPathResource("engine_config.json").getFile(),
|
||||
TransformConfig.class);
|
||||
|
||||
ReflectionTestUtils
|
||||
.setField(AbstractTransformerController.class, "ENGINE_CONFIG", "engine_config.json");
|
||||
ReflectionTestUtils.setField(transformRegistry, "engineConfig",
|
||||
new ClassPathResource("engine_config.json"));
|
||||
|
||||
String response = mockMvc
|
||||
.perform(MockMvcRequestBuilders.get("/transform/config"))
|
||||
@ -353,8 +365,8 @@ public abstract class AbstractTransformerControllerTest
|
||||
{
|
||||
TransformConfig expectedResult = buildCompleteTransformConfig();
|
||||
|
||||
ReflectionTestUtils.setField(AbstractTransformerController.class, "ENGINE_CONFIG",
|
||||
"engine_config_with_duplicates.json");
|
||||
ReflectionTestUtils.setField(transformRegistry, "engineConfig",
|
||||
new ClassPathResource("engine_config_with_duplicates.json"));
|
||||
|
||||
String response = mockMvc
|
||||
.perform(MockMvcRequestBuilders.get("/transform/config"))
|
||||
@ -380,8 +392,8 @@ public abstract class AbstractTransformerControllerTest
|
||||
TransformConfig expectedResult = new TransformConfig();
|
||||
expectedResult.setTransformers(ImmutableList.of(transformer));
|
||||
|
||||
ReflectionTestUtils.setField(AbstractTransformerController.class, "ENGINE_CONFIG",
|
||||
"engine_config_incomplete.json");
|
||||
ReflectionTestUtils.setField(transformRegistry, "engineConfig",
|
||||
new ClassPathResource("engine_config_incomplete.json"));
|
||||
|
||||
String response = mockMvc
|
||||
.perform(MockMvcRequestBuilders.get("/transform/config"))
|
||||
@ -403,8 +415,8 @@ public abstract class AbstractTransformerControllerTest
|
||||
TransformConfig expectedResult = new TransformConfig();
|
||||
expectedResult.setTransformers(ImmutableList.of(transformer));
|
||||
|
||||
ReflectionTestUtils.setField(AbstractTransformerController.class, "ENGINE_CONFIG",
|
||||
"engine_config_no_transform_options.json");
|
||||
ReflectionTestUtils.setField(transformRegistry, "engineConfig",
|
||||
new ClassPathResource("engine_config_no_transform_options.json"));
|
||||
|
||||
String response = mockMvc
|
||||
.perform(MockMvcRequestBuilders.get("/transform/config"))
|
||||
|
10
pom.xml
10
pom.xml
@ -23,7 +23,7 @@
|
||||
<dependency.pdfbox.version>2.0.16</dependency.pdfbox.version>
|
||||
<dependency.alfresco-jodconverter-core.version>3.0.1.1</dependency.alfresco-jodconverter-core.version>
|
||||
<env.project_version>${project.version}</env.project_version>
|
||||
<dependency.alfresco-transform-model.version>1.0.2.6</dependency.alfresco-transform-model.version>
|
||||
<dependency.alfresco-transform-model.version>1.0.2.8-SNAPSHOT</dependency.alfresco-transform-model.version>
|
||||
<dependency.activemq.version>5.15.9</dependency.activemq.version>
|
||||
<dependency.jackson.version>2.9.9</dependency.jackson.version>
|
||||
<dependency.jackson-databind.version>2.9.9.3</dependency.jackson-databind.version>
|
||||
@ -152,7 +152,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.18</version>
|
||||
<version>1.19</version>
|
||||
</dependency>
|
||||
<!-- Jsoup -->
|
||||
<dependency>
|
||||
@ -160,6 +160,12 @@
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>1.12.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.13</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user