[feature/MNT-24127-EndpointToCalculateFolderSize] Updated endpoints flow to calculate and retrieve folder size details

This commit is contained in:
mohit-singh4
2024-08-28 14:31:41 +05:30
parent 21b8354a4b
commit 7af7c29e0e
14 changed files with 79 additions and 82 deletions

View File

@@ -49,14 +49,14 @@ import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
/**
* NodeSizeDetailsActionExecutor
* NodeSizeDetailActionExecutor
* Executing Alfresco FTS Query to find size of Folder Node
*/
public class NodeSizeDetailsActionExecutor extends ActionExecuterAbstractBase
public class NodeSizeDetailActionExecutor extends ActionExecuterAbstractBase
{
private static final Logger LOG = LoggerFactory.getLogger(NodeSizeDetailsActionExecutor.class);
private static final Logger LOG = LoggerFactory.getLogger(NodeSizeDetailActionExecutor.class);
/**
* Action constants
@@ -160,13 +160,13 @@ public class NodeSizeDetailsActionExecutor extends ActionExecuterAbstractBase
}
catch (RuntimeException runtimeException)
{
LOG.error("Exception occurred in NodeSizeDetailsActionExecutor:results {} ", runtimeException.getMessage());
response.put(EXCEPTION,"Exception occurred in NodeSizeDetailsActionExecutor:results {} "+runtimeException.getMessage());
LOG.error("Exception occurred in NodeSizeDetailActionExecutor:results {} ", runtimeException.getMessage());
response.put(EXCEPTION,"Exception occurred in NodeSizeDetailActionExecutor:results {} "+runtimeException.getMessage());
simpleCache.put(nodeRef.getId(),response);
throw runtimeException;
}
LOG.debug(" Calculating size of Folder Node - NodeSizeDetailsActionExecutor:executeImpl ");
LOG.debug(" Calculating size of Folder Node - NodeSizeDetailActionExecutor:executeImpl ");
final LocalDateTime eventTimestamp = LocalDateTime.ofInstant(Instant.now(), ZoneId.systemDefault());
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy:MM:dd HH:mm:ss");
String formattedTimestamp = eventTimestamp.format(formatter);

View File

@@ -789,7 +789,7 @@
</property>
</bean>
<bean id="folder-size" class="org.alfresco.repo.action.executer.NodeSizeDetailsActionExecutor" parent="action-executer">
<bean id="folder-size" class="org.alfresco.repo.action.executer.NodeSizeDetailActionExecutor" parent="action-executer">
<property name="searchService" ref="searchService"/>
<property name="simpleCache" ref="folderSizeSharedCache" />
</bean>

View File

@@ -25,7 +25,7 @@
*/
package org.alfresco;
import org.alfresco.repo.action.executer.NodeSizeDetailsActionExecutorTest;
import org.alfresco.repo.action.executer.NodeSizeDetailActionExecutorTest;
import org.alfresco.util.testing.category.DBTests;
import org.alfresco.util.testing.category.NonBuildTests;
import org.junit.experimental.categories.Categories;
@@ -79,7 +79,7 @@ import org.junit.runners.Suite;
org.alfresco.repo.activities.SiteActivityTestCaseInsensitivity.class,
org.alfresco.repo.admin.registry.RegistryServiceImplTest.class,
org.alfresco.repo.bootstrap.DataDictionaryFolderTest.class,
org.alfresco.repo.action.executer.NodeSizeDetailsActionExecutorTest.class
NodeSizeDetailActionExecutorTest.class
})
public class AppContext01TestSuite
{

View File

@@ -43,7 +43,7 @@ import org.junit.Test;
import org.springframework.transaction.annotation.Transactional;
@Transactional
public class NodeSizeDetailsActionExecutorTest extends BaseSpringTest
public class NodeSizeDetailActionExecutorTest extends BaseSpringTest
{
/**
* The test node reference
@@ -53,7 +53,7 @@ public class NodeSizeDetailsActionExecutorTest extends BaseSpringTest
/**
* The folder Size executer
*/
private NodeSizeDetailsActionExecutor executer;
private NodeSizeDetailActionExecutor executer;
/**
* Id used to identify the test action created
@@ -93,7 +93,7 @@ public class NodeSizeDetailsActionExecutorTest extends BaseSpringTest
ContentModel.TYPE_CONTENT).getChildRef();
// Get the executer instance.
this.executer = (NodeSizeDetailsActionExecutor)this.applicationContext.getBean(NodeSizeDetailsActionExecutor.NAME);
this.executer = (NodeSizeDetailActionExecutor)this.applicationContext.getBean(NodeSizeDetailActionExecutor.NAME);
simpleCache = (SimpleCache<Serializable, Map<String,Object>>) this.applicationContext.getBean("folderSizeSharedCache");
}
@@ -105,8 +105,8 @@ public class NodeSizeDetailsActionExecutorTest extends BaseSpringTest
public void testExecution()
{
int maxItems = 1000;
ActionImpl action = new ActionImpl(null, ID, NodeSizeDetailsActionExecutor.NAME, null);
action.setParameterValue(NodeSizeDetailsActionExecutor.DEFAULT_SIZE, maxItems);
ActionImpl action = new ActionImpl(null, ID, NodeSizeDetailActionExecutor.NAME, null);
action.setParameterValue(NodeSizeDetailActionExecutor.DEFAULT_SIZE, maxItems);
this.executer.executeImpl(action, this.nodeRef);
Object resultAction = simpleCache.get(this.nodeRef.getId());
Map<String, Object> mapResult = (Map<String, Object>)resultAction;