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
ff5c2ff92f
@ -26,6 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.transformer;
|
package org.alfresco.transformer;
|
||||||
|
|
||||||
|
import static java.lang.Boolean.parseBoolean;
|
||||||
import static org.alfresco.transformer.executors.Tika.INCLUDE_CONTENTS;
|
import static org.alfresco.transformer.executors.Tika.INCLUDE_CONTENTS;
|
||||||
import static org.alfresco.transformer.executors.Tika.NOT_EXTRACT_BOOKMARKS_TEXT;
|
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.PDF_BOX;
|
||||||
@ -36,7 +37,6 @@ import static org.alfresco.transformer.fs.FileManager.createSourceFile;
|
|||||||
import static org.alfresco.transformer.fs.FileManager.createTargetFile;
|
import static org.alfresco.transformer.fs.FileManager.createTargetFile;
|
||||||
import static org.alfresco.transformer.fs.FileManager.createTargetFileName;
|
import static org.alfresco.transformer.fs.FileManager.createTargetFileName;
|
||||||
import static org.alfresco.transformer.util.MimetypeMap.MIMETYPE_TEXT_PLAIN;
|
import static org.alfresco.transformer.util.MimetypeMap.MIMETYPE_TEXT_PLAIN;
|
||||||
import static org.alfresco.transformer.util.Util.stringToBoolean;
|
|
||||||
import static org.springframework.http.HttpStatus.OK;
|
import static org.springframework.http.HttpStatus.OK;
|
||||||
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE;
|
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE;
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ public class TikaController extends AbstractTransformerController
|
|||||||
@RequestParam("sourceMimetype") final String sourceMimetype,
|
@RequestParam("sourceMimetype") final String sourceMimetype,
|
||||||
@RequestParam("targetExtension") final String targetExtension,
|
@RequestParam("targetExtension") final String targetExtension,
|
||||||
@RequestParam("targetMimetype") final String targetMimetype,
|
@RequestParam("targetMimetype") final String targetMimetype,
|
||||||
@RequestParam("targetEncoding") final String targetEncoding,
|
@RequestParam(value = "targetEncoding", required = false, defaultValue = "UTF-8") final String targetEncoding,
|
||||||
|
|
||||||
@RequestParam(value = "timeout", required = false) final Long timeout,
|
@RequestParam(value = "timeout", required = false) final Long timeout,
|
||||||
@RequestParam(value = "testDelay", required = false) final Long testDelay,
|
@RequestParam(value = "testDelay", required = false) final Long testDelay,
|
||||||
@ -173,16 +173,18 @@ public class TikaController extends AbstractTransformerController
|
|||||||
logger.debug("Processing request with: sourceFile '{}', targetFile '{}', transformOptions" +
|
logger.debug("Processing request with: sourceFile '{}', targetFile '{}', transformOptions" +
|
||||||
" '{}', timeout {} ms", sourceFile, targetFile, transformOptions, timeout);
|
" '{}', timeout {} ms", sourceFile, targetFile, transformOptions, timeout);
|
||||||
|
|
||||||
final Boolean includeContents = stringToBoolean(transformOptions.get("includeContents"));
|
final boolean includeContents = parseBoolean(
|
||||||
final Boolean notExtractBookmarksText = stringToBoolean(
|
transformOptions.getOrDefault("includeContents", "false"));
|
||||||
transformOptions.get("notExtractBookmarksText"));
|
final boolean notExtractBookmarksText = parseBoolean(
|
||||||
final String targetEncoding = transformOptions.get("targetEncoding");
|
transformOptions.getOrDefault("notExtractBookmarksText", "false"));
|
||||||
|
final String targetEncoding = transformOptions.getOrDefault("targetEncoding", "UTF-8");
|
||||||
|
|
||||||
final String transform = getTransformerName(sourceFile, sourceMimetype, targetMimetype,
|
final String transform = getTransformerName(sourceFile, sourceMimetype, targetMimetype,
|
||||||
transformOptions);
|
transformOptions);
|
||||||
|
|
||||||
javaExecutor.call(sourceFile, targetFile, transform,
|
javaExecutor.call(sourceFile, targetFile, transform,
|
||||||
includeContents != null && includeContents ? INCLUDE_CONTENTS : null,
|
includeContents ? INCLUDE_CONTENTS : null,
|
||||||
notExtractBookmarksText != null && notExtractBookmarksText ? NOT_EXTRACT_BOOKMARKS_TEXT : null,
|
notExtractBookmarksText ? NOT_EXTRACT_BOOKMARKS_TEXT : null,
|
||||||
TARGET_MIMETYPE + targetMimetype, TARGET_ENCODING + targetEncoding);
|
TARGET_MIMETYPE + targetMimetype, TARGET_ENCODING + targetEncoding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,6 @@ public class TikaControllerTest extends AbstractTransformerControllerTest
|
|||||||
@SpyBean
|
@SpyBean
|
||||||
private TikaController controller;
|
private TikaController controller;
|
||||||
|
|
||||||
private String transform = PDF_BOX;
|
|
||||||
private String targetEncoding = "UTF-8";
|
private String targetEncoding = "UTF-8";
|
||||||
private String targetMimetype = MIMETYPE_TEXT_PLAIN;
|
private String targetMimetype = MIMETYPE_TEXT_PLAIN;
|
||||||
|
|
||||||
|
2
pom.xml
2
pom.xml
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>2.1.7.RELEASE</version>
|
<version>2.1.8.RELEASE</version>
|
||||||
<relativePath />
|
<relativePath />
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user