From 68153fb1be8c227852adec9b0f5c56c620000821 Mon Sep 17 00:00:00 2001 From: Mohit Singh Date: Tue, 12 Mar 2024 18:55:17 +0530 Subject: [PATCH] [MNT-24127] Added rest endpoint implementation to calculating folder size --- .../main/java/org/alfresco/rest/api/impl/NodesImpl.java | 5 +++-- .../alfresco/rest/api/nodes/NodeFolderSizeRelation.java | 7 +++---- .../rest/framework/webscripts/ResourceWebScriptGet.java | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/remote-api/src/main/java/org/alfresco/rest/api/impl/NodesImpl.java b/remote-api/src/main/java/org/alfresco/rest/api/impl/NodesImpl.java index b553123ac6c..fa6b38855d8 100644 --- a/remote-api/src/main/java/org/alfresco/rest/api/impl/NodesImpl.java +++ b/remote-api/src/main/java/org/alfresco/rest/api/impl/NodesImpl.java @@ -3559,7 +3559,7 @@ public void validateProperties(Map properties, List excl /** * - * @param nodeId nodeId value. + * @param nodeId value. */ @Override public Map getFolderSize(String nodeId) @@ -3585,7 +3585,8 @@ private long getNodeSize(NodeRef nodeRef) try { size = contentData.getSize(); - } catch (Exception e) + } + catch (Exception e) { size = 0; } diff --git a/remote-api/src/main/java/org/alfresco/rest/api/nodes/NodeFolderSizeRelation.java b/remote-api/src/main/java/org/alfresco/rest/api/nodes/NodeFolderSizeRelation.java index fcb8417ea5c..3015e150978 100644 --- a/remote-api/src/main/java/org/alfresco/rest/api/nodes/NodeFolderSizeRelation.java +++ b/remote-api/src/main/java/org/alfresco/rest/api/nodes/NodeFolderSizeRelation.java @@ -35,11 +35,10 @@ import java.util.Map; /** - * Node + * Node Size * - * - folder size + * - get folder size * - * @author Mohit Singh */ @RelationshipResource(name = "size", entityResource = NodesEntityResource.class, title = "Folder size") public class NodeFolderSizeRelation implements @@ -59,7 +58,7 @@ public void afterPropertiesSet() } /** - * Folder Size - returns a size of folder. + * Folder Size - returns size of a folder. * * @param nodeId String id of folder - will also accept well-known alias, eg. -root- or -my- or -shared- * Please refer to OpenAPI spec for more details ! diff --git a/remote-api/src/main/java/org/alfresco/rest/framework/webscripts/ResourceWebScriptGet.java b/remote-api/src/main/java/org/alfresco/rest/framework/webscripts/ResourceWebScriptGet.java index 1238f7a11d9..c2572df4a07 100644 --- a/remote-api/src/main/java/org/alfresco/rest/framework/webscripts/ResourceWebScriptGet.java +++ b/remote-api/src/main/java/org/alfresco/rest/framework/webscripts/ResourceWebScriptGet.java @@ -242,7 +242,7 @@ else if (RelationshipResourceAction.FolderSize.class.isAssignableFrom(resource.g { if (resource.getMetaData().isDeleted(RelationshipResourceAction.FolderSize.class)) { - throw new DeletedResourceException("(GET by id) "+resource.getMetaData().getUniqueId()); + throw new DeletedResourceException("(GET by id) " + resource.getMetaData().getUniqueId()); } RelationshipResourceAction.FolderSize relationGetter = (RelationshipResourceAction.FolderSize) resource.getResource(); Object result = relationGetter.readById(params.getEntityId());