ACS-2498 Add coreVersion to T-Engine config (#937)

Added isSupported(CoreFunction function, String transformerName) and isSupported(CoreFunction function, LocalTransform transform) ready for work on the ACS-2493 & ACS-2494.
This commit is contained in:
Alan Davis
2022-02-09 13:39:57 +00:00
committed by GitHub
parent fea50a2206
commit 338e2b93dd
8 changed files with 50 additions and 7 deletions

View File

@@ -51,7 +51,7 @@
<dependency.alfresco-log-sanitizer.version>0.2</dependency.alfresco-log-sanitizer.version>
<dependency.activiti-engine.version>5.23.0</dependency.activiti-engine.version>
<dependency.activiti.version>5.23.0</dependency.activiti.version>
<dependency.alfresco-transform-model.version>1.4.8</dependency.alfresco-transform-model.version>
<dependency.alfresco-transform-model.version>1.4.9</dependency.alfresco-transform-model.version>
<dependency.alfresco-greenmail.version>6.2</dependency.alfresco-greenmail.version>
<dependency.acs-event-model.version>0.0.13</dependency.acs-event-model.version>

View File

@@ -86,6 +86,7 @@ public abstract class AbstractLocalTransform implements LocalTransform
String renditionName, NodeRef sourceNodeRef)
throws UnsupportedTransformationException, ContentIOException;
@Override
public String getName()
{
return name;

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2019 Alfresco Software Limited
* Copyright (C) 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -25,6 +25,7 @@
*/
package org.alfresco.repo.content.transform;
import org.alfresco.transform.client.model.config.CoreFunction;
import org.alfresco.transform.client.registry.TransformServiceRegistry;
import java.util.Map;
@@ -49,4 +50,10 @@ public class DummyTransformServiceRegistry implements TransformServiceRegistry
{
return null;
}
@Override
public boolean isSupported(CoreFunction function, String transformerName)
{
return true;
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2019 Alfresco Software Limited
* Copyright (C) 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -54,4 +54,9 @@ public interface LocalTransform
void transform(ContentReader reader, ContentWriter writer, Map<String, String> transformOptions,
String renditionName, NodeRef sourceNodeRef)
throws UnsupportedTransformationException, ContentIOException;
/**
* @return the name of the transform.
*/
String getName();
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2019 - 2021 Alfresco Software Limited
* Copyright (C) 2019 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -36,6 +36,7 @@ import java.util.function.Consumer;
import java.util.stream.Collectors;
import org.alfresco.service.cmr.repository.MimetypeService;
import org.alfresco.transform.client.model.config.CoreFunction;
import org.alfresco.transform.client.model.config.TransformOptionGroup;
import org.alfresco.transform.client.registry.CombinedConfig;
import org.alfresco.transform.client.model.config.TransformOption;
@@ -473,4 +474,17 @@ public class LocalTransformServiceRegistry extends TransformServiceRegistryImpl
}
return localTransform;
}
/**
* Returns {@code true} if the {@code function} is supported by the transform. Not all transforms are
* able to support all functionality, as newer features may have been introduced into the core t-engine code since
* it was released.
* @param function to be checked.
* @param transform the local transform.
* @return {@code true} is supported, {@code false} otherwise.
*/
boolean isSupported(CoreFunction function, LocalTransform transform)
{
return isSupported(function, transform.getName());
}
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -25,6 +25,7 @@
*/
package org.alfresco.repo.rendition2;
import org.alfresco.transform.client.model.config.CoreFunction;
import org.alfresco.transform.client.registry.TransformServiceRegistry;
import java.util.Map;
@@ -78,4 +79,10 @@ public class SwitchingTransformServiceRegistry implements TransformServiceRegist
}
return name;
}
@Override
public boolean isSupported(CoreFunction function, String transformerName)
{
return primary.isSupported(function, transformerName) && secondary.isSupported(function, transformerName);
}
}

View File

@@ -47,6 +47,8 @@ import java.io.StringReader;
import java.util.Collections;
import java.util.List;
import static org.alfresco.transform.client.util.RequestParamMap.INCLUDE_CORE_VERSION;
/**
* This class reads multiple T-Engine config and local files and registers as if they were all
* in one file. Transform options are shared between all sources.<p>
@@ -104,7 +106,7 @@ public class CombinedConfig extends CombinedTransformConfig
private boolean addRemoteConfig(String baseUrl, String remoteType)
{
String url = baseUrl + (baseUrl.endsWith("/") ? "" : "/") + "transform/config";
String url = baseUrl + (baseUrl.endsWith("/") ? "" : "/") + "transform/config?" + INCLUDE_CORE_VERSION + "=" + true;
HttpGet httpGet = new HttpGet(url);
boolean successReadingConfig = true;
try

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -25,6 +25,7 @@
*/
package org.alfresco.repo.rendition2;
import org.alfresco.transform.client.model.config.CoreFunction;
import org.alfresco.transform.client.registry.TransformServiceRegistry;
import java.util.Map;
@@ -69,4 +70,10 @@ public class TestTransformServiceRegistry implements TransformServiceRegistry
{
throw new UnsupportedOperationException("not implemented");
}
@Override
public boolean isSupported(CoreFunction function, String transformerName)
{
return true;
}
}