MNT-16181 transformations for application/dita+xml

- StringExtractor is now able to extract text so searching is now working, which was the main reason for this Customer issue.
   - PdfBox.TextToPdf is now able to transform .dita fiels to .pdf. As a result it is also possible to preview the files (although the xml tags are visible) and
     to generate .png thumbnails using the complex.Text.Image transformer (which has an intermediate .pdf stage).
   - As expected TikaAuto (or our patched 1.6 version) does not know about the DITA mimetype application/dita+xml so is not claiming to transform this type even
     though it is just an XML file.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@130609 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2016-09-13 15:28:03 +00:00
parent f1a811ac8a
commit 735fee253a
3 changed files with 11 additions and 7 deletions

View File

@@ -71,7 +71,8 @@ public class StringExtractingContentTransformer extends AbstractContentTransform
// conversions from any plain text format are very reliable
return true;
}
else if (sourceMimetype.startsWith(PREFIX_TEXT))
else if (sourceMimetype.startsWith(PREFIX_TEXT) ||
sourceMimetype.equals(MimetypeMap.MIMETYPE_DITA))
{
// the source is text, but probably with some kind of markup
return true;
@@ -88,7 +89,7 @@ public class StringExtractingContentTransformer extends AbstractContentTransform
{
StringBuilder sb = new StringBuilder();
sb.append(super.getComments(available));
sb.append("# Only supports transformation of js and mimetypes starting with \"");
sb.append("# Only supports transformation of js, dita and mimetypes starting with \"");
sb.append(PREFIX_TEXT);
sb.append("\" to txt.\n");
return sb.toString();

View File

@@ -113,6 +113,7 @@ public class TextToPdfContentTransformer extends AbstractContentTransformer2
{
if ( (!MimetypeMap.MIMETYPE_TEXT_PLAIN.equals(sourceMimetype) &&
!MimetypeMap.MIMETYPE_TEXT_CSV.equals(sourceMimetype) &&
!MimetypeMap.MIMETYPE_DITA.equals(sourceMimetype) &&
!MimetypeMap.MIMETYPE_XML.equals(sourceMimetype) ) ||
!MimetypeMap.MIMETYPE_PDF.equals(targetMimetype))
{
@@ -129,7 +130,8 @@ public class TextToPdfContentTransformer extends AbstractContentTransformer2
public String getComments(boolean available)
{
return getCommentsOnlySupports(
Arrays.asList(new String[] {MimetypeMap.MIMETYPE_TEXT_PLAIN, MimetypeMap.MIMETYPE_TEXT_CSV, MimetypeMap.MIMETYPE_XML}),
Arrays.asList(new String[] {MimetypeMap.MIMETYPE_TEXT_PLAIN, MimetypeMap.MIMETYPE_TEXT_CSV,
MimetypeMap.MIMETYPE_DITA, MimetypeMap.MIMETYPE_XML}),
Arrays.asList(new String[] {MimetypeMap.MIMETYPE_PDF}), available);
}