mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-10 14:11:58 +00:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
d015c24f23 | ||
|
e5d57c61f1 | ||
|
9550362ad0 | ||
|
357ac27552 | ||
|
656aaa230b | ||
|
171fe54eb9 | ||
|
057cfb55a2 |
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-automation-community-repo</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-parent</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-amps</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -9,6 +9,6 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
</project>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
6
pom.xml
6
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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Alfresco Community Repo Parent</name>
|
||||
|
||||
@@ -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.11</dependency.alfresco-transform-model.version>
|
||||
<dependency.alfresco-transform-model.version>1.4.13</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>
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
<connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection>
|
||||
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection>
|
||||
<url>https://github.com/Alfresco/alfresco-community-repo</url>
|
||||
<tag>HEAD</tag>
|
||||
<tag>14.118.2</tag>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>14.118-SNAPSHOT</version>
|
||||
<version>14.118.2</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2019 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
|
||||
@@ -39,6 +39,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
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.
|
||||
*
|
||||
@@ -118,6 +120,8 @@ public class LocalPipelineTransform extends AbstractLocalTransform
|
||||
|
||||
transformer.intermediateTransformer.transform(currentReader, currentWriter, transformOptions, renditionName, sourceNodeRef);
|
||||
|
||||
removeDirectAccessUrlAfterFirstTransform(transformOptions);
|
||||
|
||||
// Clear the sourceNodeRef after the first transformation to avoid later transformers thinking the
|
||||
// intermediate file is the original node.
|
||||
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.
|
||||
* @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());
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2021 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
|
||||
@@ -29,15 +29,22 @@ import org.alfresco.repo.content.transform.LocalTransform;
|
||||
import org.alfresco.repo.content.transform.LocalTransformServiceRegistry;
|
||||
import org.alfresco.repo.content.transform.UnsupportedTransformationException;
|
||||
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.DirectAccessUrl;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.transform.client.model.config.CoreFunction;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import java.util.HashMap;
|
||||
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.
|
||||
*
|
||||
@@ -51,16 +58,30 @@ public class LocalSynchronousTransformClient implements SynchronousTransformClie
|
||||
private static Log logger = LogFactory.getLog(LocalTransformClient.class);
|
||||
|
||||
private LocalTransformServiceRegistry localTransformServiceRegistry;
|
||||
private ContentService contentService;
|
||||
private boolean directAccessUrlEnabled;
|
||||
|
||||
public void setLocalTransformServiceRegistry(LocalTransformServiceRegistry localTransformServiceRegistry)
|
||||
{
|
||||
this.localTransformServiceRegistry = localTransformServiceRegistry;
|
||||
}
|
||||
|
||||
public void setContentService(ContentService contentService)
|
||||
{
|
||||
this.contentService = contentService;
|
||||
}
|
||||
|
||||
public void setDirectAccessUrlEnabled(boolean directAccessUrlEnabled)
|
||||
{
|
||||
this.directAccessUrlEnabled = directAccessUrlEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception
|
||||
{
|
||||
PropertyCheck.mandatory(this, "localTransformServiceRegistry", localTransformServiceRegistry);
|
||||
PropertyCheck.mandatory(this, "contentService", contentService);
|
||||
PropertyCheck.mandatory(this, "transformDirectAccessUrlEnabled", directAccessUrlEnabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -123,6 +144,7 @@ public class LocalSynchronousTransformClient implements SynchronousTransformClie
|
||||
logger.debug(TRANSFORM + "requested " + renditionName);
|
||||
}
|
||||
|
||||
actualOptions = addDirectAccessUrlToOptionsIfPossible(actualOptions, sourceNodeRef, transform);
|
||||
transform.transform(reader, writer, actualOptions, renditionName, sourceNodeRef);
|
||||
|
||||
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
|
||||
public String getName()
|
||||
{
|
||||
|
@@ -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
|
||||
@@ -32,18 +32,24 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
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.DirectAccessUrl;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.transform.client.model.config.CoreFunction;
|
||||
import org.alfresco.util.PropertyCheck;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
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
|
||||
* {@link LocalTransform}. The transform and consumption of the
|
||||
@@ -61,6 +67,7 @@ public class LocalTransformClient implements TransformClient, InitializingBean
|
||||
private TransactionService transactionService;
|
||||
private ContentService contentService;
|
||||
private RenditionService2Impl renditionService2;
|
||||
private boolean directAccessUrlEnabled;
|
||||
|
||||
private ExecutorService executorService;
|
||||
private ThreadLocal<LocalTransform> transform = new ThreadLocal<>();
|
||||
@@ -85,6 +92,11 @@ public class LocalTransformClient implements TransformClient, InitializingBean
|
||||
this.renditionService2 = renditionService2;
|
||||
}
|
||||
|
||||
public void setDirectAccessUrlEnabled(boolean directAccessUrlEnabled)
|
||||
{
|
||||
this.directAccessUrlEnabled = directAccessUrlEnabled;
|
||||
}
|
||||
|
||||
public void setExecutorService(ExecutorService executorService)
|
||||
{
|
||||
this.executorService = executorService;
|
||||
@@ -97,6 +109,7 @@ public class LocalTransformClient implements TransformClient, InitializingBean
|
||||
PropertyCheck.mandatory(this, "transactionService", transactionService);
|
||||
PropertyCheck.mandatory(this, "contentService", contentService);
|
||||
PropertyCheck.mandatory(this, "renditionService2", renditionService2);
|
||||
PropertyCheck.mandatory(this, "directAccessUrlEnabled", directAccessUrlEnabled);
|
||||
if (executorService == null)
|
||||
{
|
||||
executorService = Executors.newCachedThreadPool();
|
||||
@@ -130,8 +143,9 @@ public class LocalTransformClient implements TransformClient, InitializingBean
|
||||
{
|
||||
String renditionName = renditionDefinition.getRenditionName();
|
||||
String targetMimetype = renditionDefinition.getTargetMimetype();
|
||||
Map<String, String> actualOptions = renditionDefinition.getTransformOptions();
|
||||
Map<String, String> renditionOptions = renditionDefinition.getTransformOptions();
|
||||
LocalTransform localTransform = transform.get();
|
||||
Map<String, String> actualOptions = addDirectAccessUrlToOptionsIfPossible(renditionOptions, sourceNodeRef, localTransform);
|
||||
|
||||
executorService.submit(() ->
|
||||
{
|
||||
@@ -187,4 +201,18 @@ public class LocalTransformClient implements TransformClient, InitializingBean
|
||||
}), 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="contentService" ref="contentService" />
|
||||
<property name="renditionService2" ref="renditionService2" />
|
||||
<property name="directAccessUrlEnabled" value="${local.transform.directAccessUrl.enabled}"/>
|
||||
</bean>
|
||||
|
||||
<bean id="synchronousTransformClient" parent="localSynchronousTransformClient" />
|
||||
|
||||
<bean id="localSynchronousTransformClient" class="org.alfresco.repo.rendition2.LocalSynchronousTransformClient">
|
||||
<property name="localTransformServiceRegistry" ref="localTransformServiceRegistry" />
|
||||
<property name="contentService" ref="contentService" />
|
||||
<property name="directAccessUrlEnabled" value="${local.transform.directAccessUrl.enabled}"/>
|
||||
</bean>
|
||||
|
||||
<!-- 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.
|
||||
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.
|
||||
system.new-node-transaction-indexes.ignored=true
|
||||
|
||||
|
Reference in New Issue
Block a user