Compare commits

...

9 Commits

33 changed files with 372 additions and 329 deletions

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<modules> <modules>

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<modules> <modules>

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<build> <build>

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<modules> <modules>

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<properties> <properties>

View File

@@ -5,7 +5,7 @@
# Version label # Version label
version.major=25 version.major=25
version.minor=1 version.minor=1
version.revision=0 version.revision=1
version.label= version.label=
# Edition label # Edition label

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<build> <build>

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<modules> <modules>

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<properties> <properties>

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<dependencies> <dependencies>

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<properties> <properties>

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<dependencies> <dependencies>

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
</project> </project>

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<properties> <properties>

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<modules> <modules>

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<modules> <modules>

View File

@@ -7,7 +7,7 @@
<parent> <parent>
<groupId>org.alfresco</groupId> <groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId> <artifactId>alfresco-community-repo-tests</artifactId>
<version>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<organization> <organization>

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<developers> <developers>

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<developers> <developers>

View File

@@ -8,7 +8,7 @@
<parent> <parent>
<groupId>org.alfresco</groupId> <groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId> <artifactId>alfresco-community-repo-tests</artifactId>
<version>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<properties> <properties>

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<developers> <developers>

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<properties> <properties>

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>Alfresco Community Repo Parent</name> <name>Alfresco Community Repo Parent</name>
@@ -25,7 +25,7 @@
<properties> <properties>
<acs.version.major>25</acs.version.major> <acs.version.major>25</acs.version.major>
<acs.version.minor>1</acs.version.minor> <acs.version.minor>1</acs.version.minor>
<acs.version.revision>0</acs.version.revision> <acs.version.revision>1</acs.version.revision>
<acs.version.label /> <acs.version.label />
<amp.min.version>${acs.version.major}.0.0</amp.min.version> <amp.min.version>${acs.version.major}.0.0</amp.min.version>
@@ -155,7 +155,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>25.1.0.71</tag> <tag>25.1.1.3</tag>
</scm> </scm>
<distributionManagement> <distributionManagement>

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<dependencies> <dependencies>

View File

@@ -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>25.1.0.71</version> <version>25.1.1.3</version>
</parent> </parent>
<dependencies> <dependencies>

View File

@@ -2,93 +2,96 @@
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2025 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
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
package org.alfresco.repo.action.executer; package org.alfresco.repo.action.executer;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.alfresco.repo.action.ParameterDefinitionImpl; import org.alfresco.repo.action.ParameterDefinitionImpl;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; import org.alfresco.repo.action.access.ActionAccessRestriction;
import org.alfresco.service.cmr.action.Action; import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.cmr.action.ParameterDefinition; import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition; import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName; import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.transaction.TransactionService; import org.alfresco.service.namespace.QName;
import org.alfresco.service.transaction.TransactionService;
/**
* Add features action executor implementation. /**
* * Add features action executor implementation.
* @author Roy Wetherall *
*/ * @author Roy Wetherall
public class AddFeaturesActionExecuter extends ActionExecuterAbstractBase */
{ public class AddFeaturesActionExecuter extends ActionExecuterAbstractBase
/** {
* Action constants /**
*/ * Action constants
public static final String NAME = "add-features"; */
public static final String PARAM_ASPECT_NAME = "aspect-name"; public static final String NAME = "add-features";
public static final String PARAM_CONSTRAINT = "ac-aspects"; public static final String PARAM_ASPECT_NAME = "aspect-name";
public static final String PARAM_CONSTRAINT = "ac-aspects";
/**
* The node service /**
*/ * The node service
private NodeService nodeService; */
private NodeService nodeService;
/** Transaction Service, used for retrying operations */
private TransactionService transactionService; /** Transaction Service, used for retrying operations */
private TransactionService transactionService;
/**
* Set the node service /**
* * Set the node service
* @param nodeService the node service *
*/ * @param nodeService
public void setNodeService(NodeService nodeService) * the node service
{ */
this.nodeService = nodeService; public void setNodeService(NodeService nodeService)
} {
this.nodeService = nodeService;
/** }
* Set the transaction service
* /**
* @param transactionService the transaction service * Set the transaction service
*/ *
public void setTransactionService(TransactionService transactionService) * @param transactionService
{ * the transaction service
this.transactionService = transactionService; */
} public void setTransactionService(TransactionService transactionService)
{
/** this.transactionService = transactionService;
* Adhoc properties are allowed for this executor }
*/
@Override /**
protected boolean getAdhocPropertiesAllowed() * Adhoc properties are allowed for this executor
{ */
return true; @Override
protected boolean getAdhocPropertiesAllowed()
{
return true;
} }
/** /**
@@ -96,55 +99,61 @@ public class AddFeaturesActionExecuter extends ActionExecuterAbstractBase
*/ */
public void executeImpl(final Action ruleAction, final NodeRef actionedUponNodeRef) public void executeImpl(final Action ruleAction, final NodeRef actionedUponNodeRef)
{ {
if (this.nodeService.exists(actionedUponNodeRef)) if (this.nodeService.exists(actionedUponNodeRef))
{ {
transactionService.getRetryingTransactionHelper().doInTransaction( transactionService.getRetryingTransactionHelper().doInTransaction(
new RetryingTransactionCallback<Void>() new RetryingTransactionCallback<Void>() {
{ public Void execute() throws Throwable
public Void execute() throws Throwable {
{ Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(); QName aspectQName = null;
QName aspectQName = null;
if (!nodeService.exists(actionedUponNodeRef))
if(! nodeService.exists(actionedUponNodeRef)) {
{ // Node has gone away, skip
// Node has gone away, skip return null;
return null; }
}
// Build the aspect details
// Build the aspect details Map<String, Serializable> paramValues = ruleAction.getParameterValues();
Map<String, Serializable> paramValues = ruleAction.getParameterValues(); removeActionContextParameter(paramValues);
for (Map.Entry<String, Serializable> entry : paramValues.entrySet()) for (Map.Entry<String, Serializable> entry : paramValues.entrySet())
{ {
if (entry.getKey().equals(PARAM_ASPECT_NAME) == true) if (entry.getKey().equals(PARAM_ASPECT_NAME) == true)
{ {
aspectQName = (QName)entry.getValue(); aspectQName = (QName) entry.getValue();
} }
else else
{ {
// Must be an adhoc property // Must be an adhoc property
QName propertyQName = QName.createQName(entry.getKey()); QName propertyQName = QName.createQName(entry.getKey());
Serializable propertyValue = entry.getValue(); Serializable propertyValue = entry.getValue();
properties.put(propertyQName, propertyValue); properties.put(propertyQName, propertyValue);
} }
} }
// Add the aspect // Add the aspect
nodeService.addAspect(actionedUponNodeRef, aspectQName, properties); nodeService.addAspect(actionedUponNodeRef, aspectQName, properties);
return null; return null;
} }
} });
); }
} }
}
/**
/** * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List)
* @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) */
*/ @Override
@Override protected void addParameterDefinitions(List<ParameterDefinition> paramList)
protected void addParameterDefinitions(List<ParameterDefinition> paramList) {
{ paramList.add(new ParameterDefinitionImpl(PARAM_ASPECT_NAME, DataTypeDefinition.QNAME, true, getParamDisplayLabel(PARAM_ASPECT_NAME), false, "ac-aspects"));
paramList.add(new ParameterDefinitionImpl(PARAM_ASPECT_NAME, DataTypeDefinition.QNAME, true, getParamDisplayLabel(PARAM_ASPECT_NAME), false, "ac-aspects")); }
}
/**
} * Remove actionContext from the parameter values to declassify as an adhoc property
*/
private void removeActionContextParameter(Map<String, Serializable> paramValues)
{
paramValues.remove(ActionAccessRestriction.ACTION_CONTEXT_PARAM_NAME);
}
}

View File

@@ -542,10 +542,7 @@ public class EventGenerator extends AbstractLifecycleBean implements Initializin
@Override @Override
protected void onShutdown(ApplicationEvent applicationEvent) protected void onShutdown(ApplicationEvent applicationEvent)
{ {
if (eventSender != null) // NOOP
{
eventSender.destroy();
}
} }
protected class EventTransactionListener extends TransactionListenerAdapter protected class EventTransactionListener extends TransactionListenerAdapter
@@ -819,4 +816,4 @@ public class EventGenerator extends AbstractLifecycleBean implements Initializin
return peerAssocs; return peerAssocs;
} }
} }
} }

View File

@@ -52,7 +52,7 @@ public interface EventSender
} }
/** /**
* It's called when the application context is closing, allowing {@link org.alfresco.repo.event2.EventGenerator} to perform cleanup operations. * It's called when the bean instance is destroyed, allowing to perform cleanup operations.
*/ */
default void destroy() default void destroy()
{ {
@@ -63,4 +63,4 @@ public interface EventSender
{ {
return false; return false;
} }
} }

View File

@@ -25,15 +25,16 @@
*/ */
package org.alfresco.repo.event2; package org.alfresco.repo.event2;
import java.util.Optional;
import java.util.concurrent.Executor;
import jakarta.annotation.Nonnull; import jakarta.annotation.Nonnull;
import org.alfresco.util.PropertyCheck;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.AbstractFactoryBean; import org.springframework.beans.factory.config.AbstractFactoryBean;
import org.springframework.core.env.PropertyResolver; import org.springframework.core.env.PropertyResolver;
import java.util.Optional; import org.alfresco.util.PropertyCheck;
import java.util.concurrent.Executor;
public class EventSenderFactoryBean extends AbstractFactoryBean<EventSender> public class EventSenderFactoryBean extends AbstractFactoryBean<EventSender>
{ {
@@ -51,7 +52,7 @@ public class EventSenderFactoryBean extends AbstractFactoryBean<EventSender>
private boolean legacySkipQueueConfig; private boolean legacySkipQueueConfig;
public EventSenderFactoryBean(@Autowired PropertyResolver propertyResolver, Event2MessageProducer event2MessageProducer, public EventSenderFactoryBean(@Autowired PropertyResolver propertyResolver, Event2MessageProducer event2MessageProducer,
Executor enqueueThreadPoolExecutor, Executor dequeueThreadPoolExecutor) Executor enqueueThreadPoolExecutor, Executor dequeueThreadPoolExecutor)
{ {
super(); super();
PropertyCheck.mandatory(this, "propertyResolver", propertyResolver); PropertyCheck.mandatory(this, "propertyResolver", propertyResolver);
@@ -155,4 +156,13 @@ public class EventSenderFactoryBean extends AbstractFactoryBean<EventSender>
{ {
return event2MessageProducer; return event2MessageProducer;
} }
}
@Override
protected void destroyInstance(EventSender eventSender)
{
if (eventSender != null)
{
eventSender.destroy();
}
}
}

View File

@@ -37,6 +37,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.transaction.TransactionService; import org.alfresco.service.transaction.TransactionService;
import org.alfresco.transform.config.CoreFunction; import org.alfresco.transform.config.CoreFunction;
import org.alfresco.util.PropertyCheck; import org.alfresco.util.PropertyCheck;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
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;
@@ -46,6 +47,7 @@ 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 java.util.concurrent.ThreadFactory;
import static org.alfresco.model.ContentModel.PROP_CONTENT; import static org.alfresco.model.ContentModel.PROP_CONTENT;
import static org.alfresco.transform.common.RequestParamMap.DIRECT_ACCESS_URL; import static org.alfresco.transform.common.RequestParamMap.DIRECT_ACCESS_URL;
@@ -68,6 +70,7 @@ public class LocalTransformClient implements TransformClient, InitializingBean
private ContentService contentService; private ContentService contentService;
private RenditionService2Impl renditionService2; private RenditionService2Impl renditionService2;
private boolean directAccessUrlEnabled; private boolean directAccessUrlEnabled;
private int threadPoolSize;
private ExecutorService executorService; private ExecutorService executorService;
private ThreadLocal<LocalTransform> transform = new ThreadLocal<>(); private ThreadLocal<LocalTransform> transform = new ThreadLocal<>();
@@ -97,6 +100,11 @@ public class LocalTransformClient implements TransformClient, InitializingBean
this.directAccessUrlEnabled = directAccessUrlEnabled; this.directAccessUrlEnabled = directAccessUrlEnabled;
} }
public void setThreadPoolSize(int threadPoolSize)
{
this.threadPoolSize = threadPoolSize;
}
public void setExecutorService(ExecutorService executorService) public void setExecutorService(ExecutorService executorService)
{ {
this.executorService = executorService; this.executorService = executorService;
@@ -110,9 +118,11 @@ public class LocalTransformClient implements TransformClient, InitializingBean
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); PropertyCheck.mandatory(this, "directAccessUrlEnabled", directAccessUrlEnabled);
PropertyCheck.mandatory(this, "threadPoolSize", threadPoolSize);
if (executorService == null) if (executorService == null)
{ {
executorService = Executors.newCachedThreadPool(); ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("local-transform-%d").build();
executorService = Executors.newFixedThreadPool(threadPoolSize, threadFactory);
} }
} }

View File

@@ -82,6 +82,7 @@
<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}"/> <property name="directAccessUrlEnabled" value="${local.transform.directAccessUrl.enabled}"/>
<property name="threadPoolSize" value="${local.transform.threadPoolSize}" />
</bean> </bean>
<bean id="synchronousTransformClient" parent="localSynchronousTransformClient" /> <bean id="synchronousTransformClient" parent="localSynchronousTransformClient" />

View File

@@ -1351,6 +1351,9 @@ restApi.directAccessUrl.defaultExpiryTimeInSec=30
# Controls whether direct access url URLs may be used in transforms. # Controls whether direct access url URLs may be used in transforms.
local.transform.directAccessUrl.enabled=true local.transform.directAccessUrl.enabled=true
# Controls size of thread pool used for transforms.
local.transform.threadPoolSize=8
# 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

View File

@@ -1,164 +1,177 @@
/* /*
* #%L * #%L
* Alfresco Repository * Alfresco Repository
* %% * %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited * Copyright (C) 2005 - 2025 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
* the paid license agreement will prevail. Otherwise, the software is * the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms: * provided under the following open source license terms:
* *
* Alfresco is free software: you can redistribute it and/or modify * Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* Alfresco is distributed in the hope that it will be useful, * Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>. * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L% * #L%
*/ */
package org.alfresco.repo.action.executer; package org.alfresco.repo.action.executer;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import org.alfresco.model.ContentModel; import org.junit.Before;
import org.alfresco.repo.action.ActionImpl; import org.junit.Test;
import org.alfresco.repo.security.authentication.AuthenticationComponent; import org.springframework.extensions.surf.util.I18NUtil;
import org.alfresco.service.cmr.action.ActionDefinition; import org.springframework.transaction.annotation.Transactional;
import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.repo.action.ActionImpl;
import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.repo.action.access.ActionAccessRestriction;
import org.alfresco.service.namespace.QName; import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.util.BaseSpringTest; import org.alfresco.service.cmr.action.ActionDefinition;
import org.alfresco.util.GUID; import org.alfresco.service.cmr.action.ParameterDefinition;
import org.junit.Before; import org.alfresco.service.cmr.repository.NodeRef;
import org.junit.Test; import org.alfresco.service.cmr.repository.NodeService;
import org.springframework.extensions.surf.util.I18NUtil; import org.alfresco.service.cmr.repository.StoreRef;
import org.springframework.transaction.annotation.Transactional; import org.alfresco.service.namespace.QName;
import org.alfresco.util.BaseSpringTest;
/** import org.alfresco.util.GUID;
* Add features action execution test
* /**
* @author Roy Wetherall * Add features action execution test
*/ *
@Transactional * @author Roy Wetherall
public class AddFeaturesActionExecuterTest extends BaseSpringTest */
{ @Transactional
/** public class AddFeaturesActionExecuterTest extends BaseSpringTest
* The node service {
*/ /**
private NodeService nodeService; * Id used to identify the test action created
*/
/** private final static String ID = GUID.generate();
* The store reference /**
*/ * The node service
private StoreRef testStoreRef; */
private NodeService nodeService;
/** /**
* The root node reference * The store reference
*/ */
private NodeRef rootNodeRef; private StoreRef testStoreRef;
/**
/** * The root node reference
* The test node reference */
*/ private NodeRef rootNodeRef;
private NodeRef nodeRef; /**
* The test node reference
/** */
* The add features action executer private NodeRef nodeRef;
*/ /**
private AddFeaturesActionExecuter executer; * The add features action executer
*/
/** private AddFeaturesActionExecuter executer;
* Id used to identify the test action created
*/ /**
private final static String ID = GUID.generate(); * Called at the begining of all tests
*/
/** @Before
* Called at the begining of all tests public void before() throws Exception
*/ {
@Before this.nodeService = (NodeService) this.applicationContext.getBean("nodeService");
public void before() throws Exception
{ AuthenticationComponent authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
this.nodeService = (NodeService)this.applicationContext.getBean("nodeService"); authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName());
AuthenticationComponent authenticationComponent = (AuthenticationComponent)applicationContext.getBean("authenticationComponent"); // Create the store and get the root node
authenticationComponent.setCurrentUser(authenticationComponent.getSystemUserName()); this.testStoreRef = this.nodeService.createStore(
StoreRef.PROTOCOL_WORKSPACE, "Test_"
// Create the store and get the root node + System.currentTimeMillis());
this.testStoreRef = this.nodeService.createStore( this.rootNodeRef = this.nodeService.getRootNode(this.testStoreRef);
StoreRef.PROTOCOL_WORKSPACE, "Test_"
+ System.currentTimeMillis()); // Create the node used for tests
this.rootNodeRef = this.nodeService.getRootNode(this.testStoreRef); this.nodeRef = this.nodeService.createNode(
this.rootNodeRef,
// Create the node used for tests ContentModel.ASSOC_CHILDREN,
this.nodeRef = this.nodeService.createNode( QName.createQName("{test}testnode"),
this.rootNodeRef, ContentModel.TYPE_CONTENT).getChildRef();
ContentModel.ASSOC_CHILDREN,
QName.createQName("{test}testnode"), // Get the executer instance
ContentModel.TYPE_CONTENT).getChildRef(); this.executer = (AddFeaturesActionExecuter) this.applicationContext.getBean(AddFeaturesActionExecuter.NAME);
}
// Get the executer instance
this.executer = (AddFeaturesActionExecuter)this.applicationContext.getBean(AddFeaturesActionExecuter.NAME); /**
} * Test execution
*/
/** @Test
* Test execution public void testExecution()
*/ {
@Test // Check that the node does not have the classifiable aspect
public void testExecution() assertFalse(this.nodeService.hasAspect(this.nodeRef, ContentModel.ASPECT_CLASSIFIABLE));
{
// Check that the node does not have the classifiable aspect // Execute the action
assertFalse(this.nodeService.hasAspect(this.nodeRef, ContentModel.ASPECT_CLASSIFIABLE)); ActionImpl action = new ActionImpl(null, ID, AddFeaturesActionExecuter.NAME, null);
action.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_CLASSIFIABLE);
// Execute the action this.executer.execute(action, this.nodeRef);
ActionImpl action = new ActionImpl(null, ID, AddFeaturesActionExecuter.NAME, null);
action.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_CLASSIFIABLE); // Check that the node now has the classifiable aspect applied
this.executer.execute(action, this.nodeRef); assertTrue(this.nodeService.hasAspect(this.nodeRef, ContentModel.ASPECT_CLASSIFIABLE));
}
// Check that the node now has the classifiable aspect applied
assertTrue(this.nodeService.hasAspect(this.nodeRef, ContentModel.ASPECT_CLASSIFIABLE)); /**
} * MNT-15802
*/
/** @Test
* MNT-15802 public void testCheckLocalizedParamDefintionWithConstraint()
*/ {
@Test // test for other than default locale
public void testCheckLocalizedParamDefintionWithConstraint() I18NUtil.setLocale(Locale.GERMAN);
{
// test for other than default locale ActionDefinition actionDef = executer.getActionDefinition();
I18NUtil.setLocale(Locale.GERMAN);
List<ParameterDefinition> paramDef = actionDef.getParameterDefinitions();
ActionDefinition actionDef = executer.getActionDefinition(); assertNotNull(paramDef);
List<ParameterDefinition> paramDef = actionDef.getParameterDefinitions(); String constraintName = paramDef.get(0).getParameterConstraintName();
assertNotNull(paramDef); assertNotNull(constraintName);
assertEquals(AddFeaturesActionExecuter.PARAM_CONSTRAINT, constraintName);
String constraintName = paramDef.get(0).getParameterConstraintName();
assertNotNull(constraintName); // test for other than default locale
assertEquals(AddFeaturesActionExecuter.PARAM_CONSTRAINT, constraintName); I18NUtil.setLocale(Locale.ITALY);
// test for other than default locale actionDef = executer.getActionDefinition();
I18NUtil.setLocale(Locale.ITALY);
paramDef = actionDef.getParameterDefinitions();
actionDef = executer.getActionDefinition(); assertNotNull(paramDef);
paramDef = actionDef.getParameterDefinitions(); constraintName = paramDef.get(0).getParameterConstraintName();
assertNotNull(paramDef); assertNotNull(constraintName);
assertEquals(AddFeaturesActionExecuter.PARAM_CONSTRAINT, constraintName);
constraintName = paramDef.get(0).getParameterConstraintName();
assertNotNull(constraintName); I18NUtil.setLocale(Locale.getDefault());
assertEquals(AddFeaturesActionExecuter.PARAM_CONSTRAINT, constraintName);
}
I18NUtil.setLocale(Locale.getDefault());
/**
} * Test check actionContext param is removed from adhoc properties
} */
@Test
public void testCheckActionContext()
{
// Execute the action
ActionImpl action = new ActionImpl(null, ID, AddFeaturesActionExecuter.NAME, null);
action.setParameterValue(ActionAccessRestriction.ACTION_CONTEXT_PARAM_NAME, ActionAccessRestriction.V1_ACTION_CONTEXT);
action.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_CLASSIFIABLE);
this.executer.execute(action, this.nodeRef);
// Ensure the actionContext parameter has been removed
assertFalse(nodeService.getProperties(this.nodeRef).containsKey(QName.createQName(ActionAccessRestriction.ACTION_CONTEXT_PARAM_NAME)));
}
}