MNT-22409 Legacy transformer fails to generate multi-page TIFF preview

Originally fixed on 6.2.N. A couple of the Legacy classes no longer exist so changes are not on master. Changes to the renditions, default page limit and test still apply.

(cherry picked from commit 9d276aed7081e0078ed3f7f01dabdec20c599bfe)
(cherry picked from commit ddb299ab03)
This commit is contained in:
alandavis
2021-05-21 07:14:57 +01:00
parent 41000ae557
commit d88f8f7bbf
3 changed files with 41 additions and 7 deletions

View File

@@ -9,7 +9,9 @@
{"name": "allowEnlargement", "value": true},
{"name": "maintainAspectRatio", "value": true},
{"name": "autoOrient", "value": true},
{"name": "thumbnail", "value": true}
{"name": "thumbnail", "value": true},
{"name": "startPage", "value": "0"},
{"name": "endPage", "value": "0"}
]
},
{
@@ -21,7 +23,9 @@
{"name": "allowEnlargement", "value": false},
{"name": "maintainAspectRatio", "value": true},
{"name": "autoOrient", "value": true},
{"name": "thumbnail", "value": true}
{"name": "thumbnail", "value": true},
{"name": "startPage", "value": "0"},
{"name": "endPage", "value": "0"}
]
},
{
@@ -33,7 +37,9 @@
{"name": "allowEnlargement", "value": false},
{"name": "maintainAspectRatio", "value": true},
{"name": "autoOrient", "value": true},
{"name": "thumbnail", "value": true}
{"name": "thumbnail", "value": true},
{"name": "startPage", "value": "0"},
{"name": "endPage", "value": "0"}
]
},
{
@@ -45,7 +51,9 @@
{"name": "allowEnlargement", "value": false},
{"name": "maintainAspectRatio", "value": true},
{"name": "autoOrient", "value": true},
{"name": "thumbnail", "value": true}
{"name": "thumbnail", "value": true},
{"name": "startPage", "value": "0"},
{"name": "endPage", "value": "0"}
]
},
{
@@ -57,7 +65,9 @@
{"name": "allowEnlargement", "value": false},
{"name": "maintainAspectRatio", "value": true},
{"name": "autoOrient", "value": true},
{"name": "thumbnail", "value": true}
{"name": "thumbnail", "value": true},
{"name": "startPage", "value": "0"},
{"name": "endPage", "value": "0"}
]
},
{

View File

@@ -482,7 +482,7 @@ system.thumbnail.definition.default.timeoutMs=-1
system.thumbnail.definition.default.readLimitTimeMs=-1
system.thumbnail.definition.default.maxSourceSizeKBytes=-1
system.thumbnail.definition.default.readLimitKBytes=-1
system.thumbnail.definition.default.pageLimit=1
system.thumbnail.definition.default.pageLimit=-1
system.thumbnail.definition.default.maxPages=-1
# Max mimetype sizes to create thumbnail icons

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -32,10 +32,13 @@ import org.alfresco.repo.thumbnail.ThumbnailDefinition;
import org.alfresco.repo.thumbnail.ThumbnailRenditionConvertor;
import org.alfresco.service.cmr.rendition.RenditionDefinition;
import org.alfresco.service.cmr.rendition.RenditionService;
import org.alfresco.service.cmr.repository.PagedSourceOptions;
import org.alfresco.service.cmr.repository.TransformationOptions;
import org.alfresco.service.cmr.repository.TransformationSourceOptions;
import org.alfresco.util.BaseSpringTest;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -126,6 +129,27 @@ public class RenditionDefinitionTest extends BaseSpringTest
// than checking transformationOptions is equal to transformationOptions2.
if (!renditionName.equals("pdf") && !renditionName.equals("webpreview"))
{
// MNT-22409: We no longer have system.thumbnail.definition.default.pageLimit=1 as a default.
// It is -1 (unlimited), but to compensate for that the new OOTB renditions defined in
// 0100-baseRenditions now have startPage and endPage transform options. The following code modifies
// the transformationOptions so that they will be the same if there are no bugs.
Collection<TransformationSourceOptions> sourceOptionsList = transformationOptions2.getSourceOptionsList();
if (sourceOptionsList != null && sourceOptionsList.size() == 1)
{
TransformationSourceOptions sourceOptions = sourceOptionsList.iterator().next();
if (sourceOptions instanceof PagedSourceOptions)
{
PagedSourceOptions pagedSourceOptions = (PagedSourceOptions)sourceOptions;
if (pagedSourceOptions.getStartPageNumber() == 1 && pagedSourceOptions.getEndPageNumber() == 1)
{
if (transformationOptions.getSourceOptionsList() == null)
{
transformationOptions.setSourceOptionsList(sourceOptionsList);
}
}
}
}
assertEquals("The TransformationOptions used in transforms for " + renditionName + " should be the same",
transformationOptions.toStringAll(), transformationOptions2.toStringAll());
assertEquals("The transformationOptionsConverter back to the newer format was not the same for " +