Skip to content

Commit

Permalink
[MNT-23478] AsynchronousExtractor - Fix rendition obtaining (#2288) (#…
Browse files Browse the repository at this point in the history
…2293)

* [MNT-23478] AsynchronousExtractor - Fix rendition obtaining

* [MNT-23478] Only use default options if no rendition is found. PMD scan change.

(cherry picked from commit 3bd3689)
  • Loading branch information
tiagosalvado10 authored Nov 7, 2023
1 parent b4241ea commit d3dcfd0
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.alfresco.model.ContentModel;
import org.alfresco.repo.action.executer.ContentMetadataExtracter;
import org.alfresco.repo.content.transform.TransformerDebug;
import org.alfresco.repo.rendition2.RenditionDefinition2;
import org.alfresco.repo.rendition2.RenditionDefinitionRegistry2Impl;
import org.alfresco.repo.rendition2.RenditionService2;
import org.alfresco.repo.rendition2.TransformDefinition;
Expand Down Expand Up @@ -411,12 +412,21 @@ private void transform(NodeRef nodeRef, ContentReader reader, String targetMimet
// is used to cache the transform name that will be used.
String transformName = targetMimetype + '/' + sourceMimetype;
String renditionName = TransformDefinition.convertToRenditionName(transformName);
TransformDefinition transformDefinition = (TransformDefinition) renditionDefinitionRegistry2.getRenditionDefinition(renditionName);
if (transformDefinition == null)

Map<String, String> transformOptions = new HashMap<>();
RenditionDefinition2 renditionDefinition2 = renditionDefinitionRegistry2.getRenditionDefinition(renditionName);

if (renditionDefinition2 != null)
{
transformDefinition = new TransformDefinition(transformName, targetMimetype,
options, null, null, null, renditionDefinitionRegistry2);
transformOptions.putAll(renditionDefinition2.getTransformOptions());
}
else
{
transformOptions.putAll(options);
}

TransformDefinition transformDefinition = new TransformDefinition(transformName, targetMimetype, transformOptions, null,
null, null, renditionDefinitionRegistry2);

if (logger.isTraceEnabled())
{
Expand Down

0 comments on commit d3dcfd0

Please sign in to comment.