mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-24 14:32:01 +00:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
357ac27552 | ||
|
656aaa230b | ||
|
171fe54eb9 | ||
|
057cfb55a2 |
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-governance-services-automation-community-repo</artifactId>
|
<artifactId>alfresco-governance-services-automation-community-repo</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@@ -9,6 +9,6 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
</project>
|
</project>
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
4
pom.xml
4
pom.xml
@@ -2,7 +2,7 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>Alfresco Community Repo Parent</name>
|
<name>Alfresco Community Repo Parent</name>
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@
|
|||||||
<connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection>
|
<connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection>
|
||||||
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection>
|
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection>
|
||||||
<url>https://github.com/Alfresco/alfresco-community-repo</url>
|
<url>https://github.com/Alfresco/alfresco-community-repo</url>
|
||||||
<tag>HEAD</tag>
|
<tag>14.118.1</tag>
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco</groupId>
|
<groupId>org.alfresco</groupId>
|
||||||
<artifactId>alfresco-community-repo</artifactId>
|
<artifactId>alfresco-community-repo</artifactId>
|
||||||
<version>14.118-SNAPSHOT</version>
|
<version>14.118.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2019 Alfresco Software Limited
|
* Copyright (C) 2019-2022 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
|
||||||
@@ -39,6 +39,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static org.alfresco.transform.client.util.RequestParamMap.DIRECT_ACCESS_URL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transformer that passes a document through a pipeline of transformations to arrive at an target mimetype.
|
* Transformer that passes a document through a pipeline of transformations to arrive at an target mimetype.
|
||||||
*
|
*
|
||||||
@@ -118,6 +120,8 @@ public class LocalPipelineTransform extends AbstractLocalTransform
|
|||||||
|
|
||||||
transformer.intermediateTransformer.transform(currentReader, currentWriter, transformOptions, renditionName, sourceNodeRef);
|
transformer.intermediateTransformer.transform(currentReader, currentWriter, transformOptions, renditionName, sourceNodeRef);
|
||||||
|
|
||||||
|
removeDirectAccessUrlAfterFirstTransform(transformOptions);
|
||||||
|
|
||||||
// Clear the sourceNodeRef after the first transformation to avoid later transformers thinking the
|
// Clear the sourceNodeRef after the first transformation to avoid later transformers thinking the
|
||||||
// intermediate file is the original node.
|
// intermediate file is the original node.
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
@@ -132,4 +136,9 @@ public class LocalPipelineTransform extends AbstractLocalTransform
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void removeDirectAccessUrlAfterFirstTransform(Map<String, String> transformOptions)
|
||||||
|
{
|
||||||
|
transformOptions.remove(DIRECT_ACCESS_URL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -483,7 +483,7 @@ public class LocalTransformServiceRegistry extends TransformServiceRegistryImpl
|
|||||||
* @param transform the local transform.
|
* @param transform the local transform.
|
||||||
* @return {@code true} is supported, {@code false} otherwise.
|
* @return {@code true} is supported, {@code false} otherwise.
|
||||||
*/
|
*/
|
||||||
boolean isSupported(CoreFunction function, LocalTransform transform)
|
public boolean isSupported(CoreFunction function, LocalTransform transform)
|
||||||
{
|
{
|
||||||
return isSupported(function, transform.getName());
|
return isSupported(function, transform.getName());
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2021 Alfresco Software Limited
|
* Copyright (C) 2022 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
|
||||||
@@ -29,15 +29,22 @@ import org.alfresco.repo.content.transform.LocalTransform;
|
|||||||
import org.alfresco.repo.content.transform.LocalTransformServiceRegistry;
|
import org.alfresco.repo.content.transform.LocalTransformServiceRegistry;
|
||||||
import org.alfresco.repo.content.transform.UnsupportedTransformationException;
|
import org.alfresco.repo.content.transform.UnsupportedTransformationException;
|
||||||
import org.alfresco.service.cmr.repository.ContentReader;
|
import org.alfresco.service.cmr.repository.ContentReader;
|
||||||
|
import org.alfresco.service.cmr.repository.ContentService;
|
||||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||||
|
import org.alfresco.service.cmr.repository.DirectAccessUrl;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.transform.client.model.config.CoreFunction;
|
||||||
import org.alfresco.util.PropertyCheck;
|
import org.alfresco.util.PropertyCheck;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.alfresco.model.ContentModel.PROP_CONTENT;
|
||||||
|
import static org.alfresco.transform.client.util.RequestParamMap.DIRECT_ACCESS_URL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request synchronous transforms.
|
* Request synchronous transforms.
|
||||||
*
|
*
|
||||||
@@ -51,16 +58,30 @@ public class LocalSynchronousTransformClient implements SynchronousTransformClie
|
|||||||
private static Log logger = LogFactory.getLog(LocalTransformClient.class);
|
private static Log logger = LogFactory.getLog(LocalTransformClient.class);
|
||||||
|
|
||||||
private LocalTransformServiceRegistry localTransformServiceRegistry;
|
private LocalTransformServiceRegistry localTransformServiceRegistry;
|
||||||
|
private ContentService contentService;
|
||||||
|
private boolean directAccessUrlEnabled;
|
||||||
|
|
||||||
public void setLocalTransformServiceRegistry(LocalTransformServiceRegistry localTransformServiceRegistry)
|
public void setLocalTransformServiceRegistry(LocalTransformServiceRegistry localTransformServiceRegistry)
|
||||||
{
|
{
|
||||||
this.localTransformServiceRegistry = localTransformServiceRegistry;
|
this.localTransformServiceRegistry = localTransformServiceRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setContentService(ContentService contentService)
|
||||||
|
{
|
||||||
|
this.contentService = contentService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDirectAccessUrlEnabled(boolean directAccessUrlEnabled)
|
||||||
|
{
|
||||||
|
this.directAccessUrlEnabled = directAccessUrlEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception
|
public void afterPropertiesSet() throws Exception
|
||||||
{
|
{
|
||||||
PropertyCheck.mandatory(this, "localTransformServiceRegistry", localTransformServiceRegistry);
|
PropertyCheck.mandatory(this, "localTransformServiceRegistry", localTransformServiceRegistry);
|
||||||
|
PropertyCheck.mandatory(this, "contentService", contentService);
|
||||||
|
PropertyCheck.mandatory(this, "transformDirectAccessUrlEnabled", directAccessUrlEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -123,6 +144,7 @@ public class LocalSynchronousTransformClient implements SynchronousTransformClie
|
|||||||
logger.debug(TRANSFORM + "requested " + renditionName);
|
logger.debug(TRANSFORM + "requested " + renditionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actualOptions = addDirectAccessUrlToOptionsIfPossible(actualOptions, sourceNodeRef, transform);
|
||||||
transform.transform(reader, writer, actualOptions, renditionName, sourceNodeRef);
|
transform.transform(reader, writer, actualOptions, renditionName, sourceNodeRef);
|
||||||
|
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
@@ -140,6 +162,20 @@ public class LocalSynchronousTransformClient implements SynchronousTransformClie
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Map<String, String> addDirectAccessUrlToOptionsIfPossible(Map<String, String> actualOptions,
|
||||||
|
NodeRef sourceNodeRef, LocalTransform transform)
|
||||||
|
{
|
||||||
|
if (directAccessUrlEnabled &&
|
||||||
|
localTransformServiceRegistry.isSupported(CoreFunction.DIRECT_ACCESS_URL, transform) &&
|
||||||
|
contentService.isContentDirectUrlEnabled(sourceNodeRef, PROP_CONTENT))
|
||||||
|
{
|
||||||
|
DirectAccessUrl directAccessUrl = contentService.requestContentDirectUrl(sourceNodeRef, PROP_CONTENT, true);
|
||||||
|
actualOptions = new HashMap<>(actualOptions);
|
||||||
|
actualOptions.put(DIRECT_ACCESS_URL, directAccessUrl.getContentUrl());
|
||||||
|
}
|
||||||
|
return actualOptions;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2019 Alfresco Software Limited
|
* Copyright (C) 2022 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
|
||||||
@@ -32,18 +32,24 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
|||||||
import org.alfresco.service.cmr.repository.ContentReader;
|
import org.alfresco.service.cmr.repository.ContentReader;
|
||||||
import org.alfresco.service.cmr.repository.ContentService;
|
import org.alfresco.service.cmr.repository.ContentService;
|
||||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||||
|
import org.alfresco.service.cmr.repository.DirectAccessUrl;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.transaction.TransactionService;
|
import org.alfresco.service.transaction.TransactionService;
|
||||||
|
import org.alfresco.transform.client.model.config.CoreFunction;
|
||||||
import org.alfresco.util.PropertyCheck;
|
import org.alfresco.util.PropertyCheck;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
import static org.alfresco.model.ContentModel.PROP_CONTENT;
|
||||||
|
import static org.alfresco.transform.client.util.RequestParamMap.DIRECT_ACCESS_URL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requests rendition transforms take place using transforms available on the local machine (based on
|
* Requests rendition transforms take place using transforms available on the local machine (based on
|
||||||
* {@link LocalTransform}. The transform and consumption of the
|
* {@link LocalTransform}. The transform and consumption of the
|
||||||
@@ -61,6 +67,7 @@ public class LocalTransformClient implements TransformClient, InitializingBean
|
|||||||
private TransactionService transactionService;
|
private TransactionService transactionService;
|
||||||
private ContentService contentService;
|
private ContentService contentService;
|
||||||
private RenditionService2Impl renditionService2;
|
private RenditionService2Impl renditionService2;
|
||||||
|
private boolean directAccessUrlEnabled;
|
||||||
|
|
||||||
private ExecutorService executorService;
|
private ExecutorService executorService;
|
||||||
private ThreadLocal<LocalTransform> transform = new ThreadLocal<>();
|
private ThreadLocal<LocalTransform> transform = new ThreadLocal<>();
|
||||||
@@ -85,6 +92,11 @@ public class LocalTransformClient implements TransformClient, InitializingBean
|
|||||||
this.renditionService2 = renditionService2;
|
this.renditionService2 = renditionService2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDirectAccessUrlEnabled(boolean directAccessUrlEnabled)
|
||||||
|
{
|
||||||
|
this.directAccessUrlEnabled = directAccessUrlEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
public void setExecutorService(ExecutorService executorService)
|
public void setExecutorService(ExecutorService executorService)
|
||||||
{
|
{
|
||||||
this.executorService = executorService;
|
this.executorService = executorService;
|
||||||
@@ -97,6 +109,7 @@ public class LocalTransformClient implements TransformClient, InitializingBean
|
|||||||
PropertyCheck.mandatory(this, "transactionService", transactionService);
|
PropertyCheck.mandatory(this, "transactionService", transactionService);
|
||||||
PropertyCheck.mandatory(this, "contentService", contentService);
|
PropertyCheck.mandatory(this, "contentService", contentService);
|
||||||
PropertyCheck.mandatory(this, "renditionService2", renditionService2);
|
PropertyCheck.mandatory(this, "renditionService2", renditionService2);
|
||||||
|
PropertyCheck.mandatory(this, "directAccessUrlEnabled", directAccessUrlEnabled);
|
||||||
if (executorService == null)
|
if (executorService == null)
|
||||||
{
|
{
|
||||||
executorService = Executors.newCachedThreadPool();
|
executorService = Executors.newCachedThreadPool();
|
||||||
@@ -130,8 +143,9 @@ public class LocalTransformClient implements TransformClient, InitializingBean
|
|||||||
{
|
{
|
||||||
String renditionName = renditionDefinition.getRenditionName();
|
String renditionName = renditionDefinition.getRenditionName();
|
||||||
String targetMimetype = renditionDefinition.getTargetMimetype();
|
String targetMimetype = renditionDefinition.getTargetMimetype();
|
||||||
Map<String, String> actualOptions = renditionDefinition.getTransformOptions();
|
Map<String, String> renditionOptions = renditionDefinition.getTransformOptions();
|
||||||
LocalTransform localTransform = transform.get();
|
LocalTransform localTransform = transform.get();
|
||||||
|
Map<String, String> actualOptions = addDirectAccessUrlToOptionsIfPossible(renditionOptions, sourceNodeRef, localTransform);
|
||||||
|
|
||||||
executorService.submit(() ->
|
executorService.submit(() ->
|
||||||
{
|
{
|
||||||
@@ -187,4 +201,18 @@ public class LocalTransformClient implements TransformClient, InitializingBean
|
|||||||
}), user);
|
}), user);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Map<String, String> addDirectAccessUrlToOptionsIfPossible(Map<String, String> actualOptions,
|
||||||
|
NodeRef sourceNodeRef, LocalTransform transform)
|
||||||
|
{
|
||||||
|
if (directAccessUrlEnabled &&
|
||||||
|
localTransformServiceRegistry.isSupported(CoreFunction.DIRECT_ACCESS_URL, transform) &&
|
||||||
|
contentService.isContentDirectUrlEnabled(sourceNodeRef, PROP_CONTENT))
|
||||||
|
{
|
||||||
|
DirectAccessUrl directAccessUrl = contentService.requestContentDirectUrl(sourceNodeRef, PROP_CONTENT, true);
|
||||||
|
actualOptions = new HashMap<>(actualOptions);
|
||||||
|
actualOptions.put(DIRECT_ACCESS_URL, directAccessUrl.getContentUrl());
|
||||||
|
}
|
||||||
|
return actualOptions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -81,12 +81,15 @@
|
|||||||
<property name="transactionService" ref="transactionService" />
|
<property name="transactionService" ref="transactionService" />
|
||||||
<property name="contentService" ref="contentService" />
|
<property name="contentService" ref="contentService" />
|
||||||
<property name="renditionService2" ref="renditionService2" />
|
<property name="renditionService2" ref="renditionService2" />
|
||||||
|
<property name="directAccessUrlEnabled" value="${local.transform.directAccessUrl.enabled}"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="synchronousTransformClient" parent="localSynchronousTransformClient" />
|
<bean id="synchronousTransformClient" parent="localSynchronousTransformClient" />
|
||||||
|
|
||||||
<bean id="localSynchronousTransformClient" class="org.alfresco.repo.rendition2.LocalSynchronousTransformClient">
|
<bean id="localSynchronousTransformClient" class="org.alfresco.repo.rendition2.LocalSynchronousTransformClient">
|
||||||
<property name="localTransformServiceRegistry" ref="localTransformServiceRegistry" />
|
<property name="localTransformServiceRegistry" ref="localTransformServiceRegistry" />
|
||||||
|
<property name="contentService" ref="contentService" />
|
||||||
|
<property name="directAccessUrlEnabled" value="${local.transform.directAccessUrl.enabled}"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- Deprecated bean that converts transform properties to the deprecated TransformationOptions format -->
|
<!-- Deprecated bean that converts transform properties to the deprecated TransformationOptions format -->
|
||||||
|
@@ -1313,6 +1313,9 @@ restApi.directAccessUrl.enabled=false
|
|||||||
# Direct Access Url REST API calls cannot request an explicit expiry time.
|
# Direct Access Url REST API calls cannot request an explicit expiry time.
|
||||||
restApi.directAccessUrl.defaultExpiryTimeInSec=30
|
restApi.directAccessUrl.defaultExpiryTimeInSec=30
|
||||||
|
|
||||||
|
# Controls whether direct access url URLs may be used in transforms.
|
||||||
|
local.transform.directAccessUrl.enabled=true
|
||||||
|
|
||||||
# Creates additional indexes on alf_node and alf_transaction. Recommended for large repositories.
|
# Creates additional indexes on alf_node and alf_transaction. Recommended for large repositories.
|
||||||
system.new-node-transaction-indexes.ignored=true
|
system.new-node-transaction-indexes.ignored=true
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user