mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
ACS-127 Repo Admin - List Mimetypes (Transforms) fails with 500 error (#979)
A V0 API is supplying transformer names. It really should not as the caller should not know the name, but just that the repo can do the transform.
(cherry picked from commit 9aeccfb693
)
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -25,12 +25,14 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.repo.rendition2;
|
package org.alfresco.repo.rendition2;
|
||||||
|
|
||||||
|
import org.alfresco.repo.content.transform.ContentTransformer;
|
||||||
import org.alfresco.repo.content.transform.TransformerDebug;
|
import org.alfresco.repo.content.transform.TransformerDebug;
|
||||||
import org.alfresco.service.cmr.repository.TransformationOptions;
|
import org.alfresco.service.cmr.repository.TransformationOptions;
|
||||||
import org.alfresco.transform.client.registry.TransformServiceRegistry;
|
import org.alfresco.transform.client.registry.TransformServiceRegistry;
|
||||||
import org.alfresco.util.PropertyCheck;
|
import org.alfresco.util.PropertyCheck;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
@@ -112,6 +114,21 @@ public class LegacyTransformServiceRegistry implements InitializingBean, Transfo
|
|||||||
@Override
|
@Override
|
||||||
public String findTransformerName(String sourceMimetype, long sourceSizeInBytes, String targetMimetype, Map<String, String> actualOptions, String renditionName)
|
public String findTransformerName(String sourceMimetype, long sourceSizeInBytes, String targetMimetype, Map<String, String> actualOptions, String renditionName)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Unsupported operation LegacyTransformServiceRegistry.findTransformerName");
|
String name = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
TransformationOptions transformationOptions = converter.getTransformationOptions(renditionName, actualOptions);
|
||||||
|
List<ContentTransformer> transformers = legacySynchronousTransformClient.getActiveTransformers(
|
||||||
|
sourceMimetype, sourceSizeInBytes, targetMimetype, transformationOptions);
|
||||||
|
if (!transformers.isEmpty())
|
||||||
|
{
|
||||||
|
name = legacySynchronousTransformClient.getName() + ":" + transformers.get(0).getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IllegalArgumentException ignore)
|
||||||
|
{
|
||||||
|
// Typically if the mimetype is invalid.
|
||||||
|
}
|
||||||
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -71,6 +71,11 @@ public class SwitchingTransformServiceRegistry implements TransformServiceRegist
|
|||||||
@Override
|
@Override
|
||||||
public String findTransformerName(String sourceMimetype, long sourceSizeInBytes, String targetMimetype, Map<String, String> actualOptions, String renditionName)
|
public String findTransformerName(String sourceMimetype, long sourceSizeInBytes, String targetMimetype, Map<String, String> actualOptions, String renditionName)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Unsupported operation SwitchingTransformServiceRegistry.findTransformerName");
|
String name = primary.findTransformerName(sourceMimetype, sourceSizeInBytes, targetMimetype, actualOptions, renditionName);
|
||||||
|
if (name == null)
|
||||||
|
{
|
||||||
|
name = secondary.findTransformerName(sourceMimetype, sourceSizeInBytes, targetMimetype, actualOptions, renditionName);
|
||||||
|
}
|
||||||
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user