mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Removed .xls-.txt conversion from OpenOffice. Enabled and tested .sxw-.txt and .odt-.txt
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2125 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -35,7 +35,11 @@ import org.alfresco.util.TempFileProvider;
|
|||||||
/**
|
/**
|
||||||
* Makes use of the OpenOffice Uno interfaces to convert the content.
|
* Makes use of the OpenOffice Uno interfaces to convert the content.
|
||||||
* <p>
|
* <p>
|
||||||
* The conversions are slow but reliable.
|
* The conversions are slow but reliable. Not <b>all</b> possible combinations of transformations
|
||||||
|
* have been enabled because they don't necessarily work and need to be specifically tested before
|
||||||
|
* being made available generally. As the conversion process is mostly automated, the introduction
|
||||||
|
* of faulty transformations can lead to unnecessary bugs. Feel free to experiment and, assuming
|
||||||
|
* that the unit test works, report any interesting conversions that can be enabled.
|
||||||
*
|
*
|
||||||
* @author Derek Hulley
|
* @author Derek Hulley
|
||||||
*/
|
*/
|
||||||
@@ -49,6 +53,12 @@ public class UnoContentTransformer extends AbstractContentTransformer
|
|||||||
// Build the map of known Uno document formats and store by conversion key
|
// Build the map of known Uno document formats and store by conversion key
|
||||||
formatsByConversion = new HashMap<ContentTransformerRegistry.TransformationKey, DocumentFormatWrapper>(17);
|
formatsByConversion = new HashMap<ContentTransformerRegistry.TransformationKey, DocumentFormatWrapper>(17);
|
||||||
|
|
||||||
|
formatsByConversion.put(
|
||||||
|
new ContentTransformerRegistry.TransformationKey(MimetypeMap.MIMETYPE_OPENOFFICE_WRITER, MimetypeMap.MIMETYPE_TEXT_PLAIN),
|
||||||
|
new DocumentFormatWrapper(DocumentFormat.TEXT, 1.0));
|
||||||
|
formatsByConversion.put(
|
||||||
|
new ContentTransformerRegistry.TransformationKey(MimetypeMap.MIMETYPE_OPENDOCUMENT_TEXT, MimetypeMap.MIMETYPE_TEXT_PLAIN),
|
||||||
|
new DocumentFormatWrapper(DocumentFormat.TEXT, 1.0));
|
||||||
formatsByConversion.put(
|
formatsByConversion.put(
|
||||||
new ContentTransformerRegistry.TransformationKey(MimetypeMap.MIMETYPE_TEXT_PLAIN, MimetypeMap.MIMETYPE_HTML),
|
new ContentTransformerRegistry.TransformationKey(MimetypeMap.MIMETYPE_TEXT_PLAIN, MimetypeMap.MIMETYPE_HTML),
|
||||||
new DocumentFormatWrapper(DocumentFormat.HTML_WRITER, 1.0));
|
new DocumentFormatWrapper(DocumentFormat.HTML_WRITER, 1.0));
|
||||||
@@ -64,9 +74,6 @@ public class UnoContentTransformer extends AbstractContentTransformer
|
|||||||
formatsByConversion.put(
|
formatsByConversion.put(
|
||||||
new ContentTransformerRegistry.TransformationKey(MimetypeMap.MIMETYPE_WORD, MimetypeMap.MIMETYPE_PDF),
|
new ContentTransformerRegistry.TransformationKey(MimetypeMap.MIMETYPE_WORD, MimetypeMap.MIMETYPE_PDF),
|
||||||
new DocumentFormatWrapper(DocumentFormat.PDF_WRITER, 1.0));
|
new DocumentFormatWrapper(DocumentFormat.PDF_WRITER, 1.0));
|
||||||
formatsByConversion.put(
|
|
||||||
new ContentTransformerRegistry.TransformationKey(MimetypeMap.MIMETYPE_EXCEL, MimetypeMap.MIMETYPE_TEXT_PLAIN),
|
|
||||||
new DocumentFormatWrapper(DocumentFormat.TEXT_CALC, 0.8)); // only first sheet extracted
|
|
||||||
formatsByConversion.put(
|
formatsByConversion.put(
|
||||||
new ContentTransformerRegistry.TransformationKey(MimetypeMap.MIMETYPE_EXCEL, MimetypeMap.MIMETYPE_PDF),
|
new ContentTransformerRegistry.TransformationKey(MimetypeMap.MIMETYPE_EXCEL, MimetypeMap.MIMETYPE_PDF),
|
||||||
new DocumentFormatWrapper(DocumentFormat.PDF_CALC, 1.0));
|
new DocumentFormatWrapper(DocumentFormat.PDF_CALC, 1.0));
|
||||||
|
@@ -33,6 +33,7 @@ public class UnoContentTransformerTest extends AbstractContentTransformerTest
|
|||||||
{
|
{
|
||||||
transformer = new UnoContentTransformer();
|
transformer = new UnoContentTransformer();
|
||||||
transformer.setMimetypeService(mimetypeMap);
|
transformer.setMimetypeService(mimetypeMap);
|
||||||
|
transformer.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,7 +66,5 @@ public class UnoContentTransformerTest extends AbstractContentTransformerTest
|
|||||||
assertEquals("Mimetype should be supported", 1.0, reliability);
|
assertEquals("Mimetype should be supported", 1.0, reliability);
|
||||||
reliability = transformer.getReliability(MimetypeMap.MIMETYPE_WORD, MimetypeMap.MIMETYPE_TEXT_PLAIN);
|
reliability = transformer.getReliability(MimetypeMap.MIMETYPE_WORD, MimetypeMap.MIMETYPE_TEXT_PLAIN);
|
||||||
assertEquals("Mimetype should be supported", 1.0, reliability);
|
assertEquals("Mimetype should be supported", 1.0, reliability);
|
||||||
reliability = transformer.getReliability(MimetypeMap.MIMETYPE_EXCEL, MimetypeMap.MIMETYPE_TEXT_PLAIN);
|
|
||||||
assertEquals("Mimetype should be supported", 0.8, reliability);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user