From c0344fff0b22c22a978fe9a565a65dcd3a2556ba Mon Sep 17 00:00:00 2001 From: Mohit Singh Date: Fri, 1 Mar 2024 17:59:22 +0530 Subject: [PATCH 01/21] [APPS-2564]: Added endpoint to get Folder Size. --- .../java/org/alfresco/rest/api/Nodes.java | 16 ++-- .../org/alfresco/rest/api/impl/NodesImpl.java | 49 +++++++++--- .../api/nodes/NodeFolderSizeRelation.java | 77 +++++++++++++++++++ .../framework/core/ResourceInspector.java | 2 + .../RelationshipResourceAction.java | 9 +++ .../webscripts/ResourceWebScriptGet.java | 10 +++ .../alfresco/public-rest-context.xml | 4 + 7 files changed, 148 insertions(+), 19 deletions(-) create mode 100644 remote-api/src/main/java/org/alfresco/rest/api/nodes/NodeFolderSizeRelation.java diff --git a/remote-api/src/main/java/org/alfresco/rest/api/Nodes.java b/remote-api/src/main/java/org/alfresco/rest/api/Nodes.java index 25f3c102051..d8fff43c526 100644 --- a/remote-api/src/main/java/org/alfresco/rest/api/Nodes.java +++ b/remote-api/src/main/java/org/alfresco/rest/api/Nodes.java @@ -31,14 +31,7 @@ import java.util.Map; import java.util.Set; -import org.alfresco.rest.api.model.AssocChild; -import org.alfresco.rest.api.model.AssocTarget; -import org.alfresco.rest.api.model.Document; -import org.alfresco.rest.api.model.Folder; -import org.alfresco.rest.api.model.LockInfo; -import org.alfresco.rest.api.model.Node; -import org.alfresco.rest.api.model.PathInfo; -import org.alfresco.rest.api.model.UserInfo; +import org.alfresco.rest.api.model.*; import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException; import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException; import org.alfresco.rest.framework.resource.content.BasicContentInfo; @@ -419,6 +412,13 @@ default DirectAccessUrl requestContentDirectUrl(NodeRef nodeRef, boolean attachm void validateProperties(Map properties, List excludedNS, List excludedProperties); + /** + * Get the size of Folder. + * + * @param nodeId String + * @return Map Object. + */ + Map getFolderSize(String nodeId); /** * API Constants - query parameters, etc 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 e7fd991eea3..0d084fb6ae3 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 @@ -47,6 +47,10 @@ import java.util.StringTokenizer; import java.util.concurrent.ConcurrentHashMap; +import com.fasterxml.jackson.core.JsonGenerationException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; import org.alfresco.model.ApplicationModel; import org.alfresco.model.ContentModel; import org.alfresco.model.QuickShareModel; @@ -83,18 +87,8 @@ import org.alfresco.rest.api.ClassDefinitionMapper; import org.alfresco.rest.api.Nodes; import org.alfresco.rest.api.QuickShareLinks; -import org.alfresco.rest.api.model.AssocChild; -import org.alfresco.rest.api.model.AssocTarget; -import org.alfresco.rest.api.model.ClassDefinition; -import org.alfresco.rest.api.model.Document; -import org.alfresco.rest.api.model.Folder; -import org.alfresco.rest.api.model.LockInfo; -import org.alfresco.rest.api.model.Node; -import org.alfresco.rest.api.model.NodePermissions; -import org.alfresco.rest.api.model.PathInfo; +import org.alfresco.rest.api.model.*; import org.alfresco.rest.api.model.PathInfo.ElementInfo; -import org.alfresco.rest.api.model.QuickShareLink; -import org.alfresco.rest.api.model.UserInfo; import org.alfresco.rest.framework.core.exceptions.ConstraintViolatedException; import org.alfresco.rest.framework.core.exceptions.DisabledServiceException; import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException; @@ -169,6 +163,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.json.JSONObject; import org.springframework.dao.ConcurrencyFailureException; import org.springframework.extensions.surf.util.Content; import org.springframework.extensions.webscripts.servlet.FormData; @@ -3555,6 +3550,38 @@ public void validateProperties(Map properties, List excl }); } } + public Map getFolderSize(String FolderNodeId){ + + NodeRef nodeRef = this.validateNode(FolderNodeId); + long size=this.getNodeSize(nodeRef); + int k = 1024; + String[] sizes = {"Bytes", "KB", "MB", "GB", "TB", "PB"}; + int i = (int) Math.floor(Math.log(size) / Math.log(k)); + float finalSize=Float.parseFloat(String.valueOf((size / Math.pow(k, i)))); + Map response = new HashMap<>(); + response.put("id",FolderNodeId); + response.put("size",String.valueOf(finalSize + " " + sizes[i])); + return response; + } + + protected long getNodeSize(NodeRef nodeRef){ + long size=0; + + // Collecting current node size + ContentData contentData = (ContentData) nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT); + try { + size = contentData.getSize(); + } catch (Exception e) { + size = 0; + } + List chilAssocsList = nodeService.getChildAssocs(nodeRef); + for (ChildAssociationRef childAssociationRef : chilAssocsList) { + NodeRef childNodeRef = childAssociationRef.getChildRef(); + size = size + getNodeSize(childNodeRef); + } + return size; + } + /** * @author Jamal Kaabi-Mofrad 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 new file mode 100644 index 00000000000..212ec03e907 --- /dev/null +++ b/remote-api/src/main/java/org/alfresco/rest/api/nodes/NodeFolderSizeRelation.java @@ -0,0 +1,77 @@ +/* + * #%L + * Alfresco Remote API + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.rest.api.nodes; + +import org.alfresco.rest.api.Nodes; +import org.alfresco.rest.framework.WebApiDescription; +import org.alfresco.rest.framework.resource.RelationshipResource; +import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction; +import org.alfresco.util.ParameterCheck; +import org.springframework.beans.factory.InitializingBean; + +import java.util.Map; + +/** + * Node + * + * - folder size + * + * @author Mohit Singh + */ +@RelationshipResource(name = "size", entityResource = NodesEntityResource.class, title = "Folder size") +public class NodeFolderSizeRelation implements + RelationshipResourceAction.FolderSize>, InitializingBean +{ + private Nodes nodes; + + public void setNodes(Nodes nodes) + { + this.nodes = nodes; + } + + @Override + public void afterPropertiesSet() + { + ParameterCheck.mandatory("nodes", this.nodes); + } + + /** + * Folder Size - returns a size of 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 ! + * + * If NodeId does not exist, EntityNotFoundException (status 404). + * If NodeId does not represent a folder, InvalidArgumentException (status 400). + */ + @Override + @WebApiDescription(title = "Size of folder",description = "Return a size of folder") + public Map readAll(String NodeId) + { + return nodes.getFolderSize(NodeId); + } + +} diff --git a/remote-api/src/main/java/org/alfresco/rest/framework/core/ResourceInspector.java b/remote-api/src/main/java/org/alfresco/rest/framework/core/ResourceInspector.java index 146450667e9..7aa02749d5b 100644 --- a/remote-api/src/main/java/org/alfresco/rest/framework/core/ResourceInspector.java +++ b/remote-api/src/main/java/org/alfresco/rest/framework/core/ResourceInspector.java @@ -125,6 +125,7 @@ public class ResourceInspector ALL_RELATIONSHIP_RESOURCE_INTERFACES.add(RelationshipResourceAction.DeleteSetWithResponse.class); ALL_RELATIONSHIP_RESOURCE_INTERFACES.add(MultiPartRelationshipResourceAction.Create.class); + ALL_RELATIONSHIP_RESOURCE_INTERFACES.add(RelationshipResourceAction.FolderSize.class); ALL_PROPERTY_RESOURCE_INTERFACES.add(BinaryResourceAction.Read.class); ALL_PROPERTY_RESOURCE_INTERFACES.add(BinaryResourceAction.Delete.class); @@ -291,6 +292,7 @@ private static List inspectRelationship(RelationshipResource a findOperation(RelationshipResourceAction.DeleteSetWithResponse.class, DELETE, helper); findOperation(MultiPartRelationshipResourceAction.Create.class, POST, helper); + findOperation(RelationshipResourceAction.FolderSize.class, GET, helper); boolean noAuth = resource.isAnnotationPresent(WebApiNoAuth.class); if (noAuth) diff --git a/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java b/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java index 071641503fc..3d94f718b0c 100644 --- a/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java +++ b/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java @@ -163,4 +163,13 @@ public static interface DeleteSetWithResponse extends ResourceAction */ public void deleteSet(String entityResourceId, Parameters params, WithResponse withResponse); } + public static interface FolderSize extends ResourceAction + { + /** + * Return the size of Folder. + * + * @param NodeId Entity resource context for this relationship. + */ + public E readAll(String NodeId); + } } 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 87ee84c074f..f0cf1ef9d53 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 @@ -238,6 +238,16 @@ else if (EntityResourceAction.ReadByIdWithResponse.class.isAssignableFrom(resour CollectionWithPagingInfo relations = relationGetter.readAll(params.getEntityId(),params); return relations; } + else if (RelationshipResourceAction.FolderSize.class.isAssignableFrom(resource.getResource().getClass())) + { + if (resource.getMetaData().isDeleted(RelationshipResourceAction.FolderSize.class)) + { + throw new DeletedResourceException("(GET by id) "+resource.getMetaData().getUniqueId()); + } + RelationshipResourceAction.FolderSize> relationGetter = (RelationshipResourceAction.FolderSize>) resource.getResource(); + Object result = relationGetter.readAll(params.getEntityId()); + return result; + } else { if (resource.getMetaData().isDeleted(RelationshipResourceAction.ReadWithResponse.class)) diff --git a/remote-api/src/main/resources/alfresco/public-rest-context.xml b/remote-api/src/main/resources/alfresco/public-rest-context.xml index f5627ad8239..c182bd0c987 100644 --- a/remote-api/src/main/resources/alfresco/public-rest-context.xml +++ b/remote-api/src/main/resources/alfresco/public-rest-context.xml @@ -1768,4 +1768,8 @@ + + + + From 136f46eb408db625c988a5e5f75201369efba6a9 Mon Sep 17 00:00:00 2001 From: Mohit Singh Date: Mon, 4 Mar 2024 10:47:07 +0530 Subject: [PATCH 02/21] [APPS-2564]: Added endpoint to get Folder Size. --- .../main/java/org/alfresco/rest/api/Nodes.java | 9 ++++++++- .../org/alfresco/rest/api/impl/NodesImpl.java | 17 +++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/remote-api/src/main/java/org/alfresco/rest/api/Nodes.java b/remote-api/src/main/java/org/alfresco/rest/api/Nodes.java index d8fff43c526..bcdfd9cac40 100644 --- a/remote-api/src/main/java/org/alfresco/rest/api/Nodes.java +++ b/remote-api/src/main/java/org/alfresco/rest/api/Nodes.java @@ -31,7 +31,14 @@ import java.util.Map; import java.util.Set; -import org.alfresco.rest.api.model.*; +import org.alfresco.rest.api.model.AssocChild; +import org.alfresco.rest.api.model.AssocTarget; +import org.alfresco.rest.api.model.Document; +import org.alfresco.rest.api.model.Folder; +import org.alfresco.rest.api.model.LockInfo; +import org.alfresco.rest.api.model.Node; +import org.alfresco.rest.api.model.PathInfo; +import org.alfresco.rest.api.model.UserInfo; import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException; import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException; import org.alfresco.rest.framework.resource.content.BasicContentInfo; 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 0d084fb6ae3..ad9a0b354a7 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 @@ -47,10 +47,6 @@ import java.util.StringTokenizer; import java.util.concurrent.ConcurrentHashMap; -import com.fasterxml.jackson.core.JsonGenerationException; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; import org.alfresco.model.ApplicationModel; import org.alfresco.model.ContentModel; import org.alfresco.model.QuickShareModel; @@ -87,8 +83,18 @@ import org.alfresco.rest.api.ClassDefinitionMapper; import org.alfresco.rest.api.Nodes; import org.alfresco.rest.api.QuickShareLinks; -import org.alfresco.rest.api.model.*; +import org.alfresco.rest.api.model.AssocChild; +import org.alfresco.rest.api.model.AssocTarget; +import org.alfresco.rest.api.model.ClassDefinition; +import org.alfresco.rest.api.model.Document; +import org.alfresco.rest.api.model.Folder; +import org.alfresco.rest.api.model.LockInfo; +import org.alfresco.rest.api.model.Node; +import org.alfresco.rest.api.model.NodePermissions; +import org.alfresco.rest.api.model.PathInfo; import org.alfresco.rest.api.model.PathInfo.ElementInfo; +import org.alfresco.rest.api.model.QuickShareLink; +import org.alfresco.rest.api.model.UserInfo; import org.alfresco.rest.framework.core.exceptions.ConstraintViolatedException; import org.alfresco.rest.framework.core.exceptions.DisabledServiceException; import org.alfresco.rest.framework.core.exceptions.EntityNotFoundException; @@ -163,7 +169,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.json.JSONObject; import org.springframework.dao.ConcurrencyFailureException; import org.springframework.extensions.surf.util.Content; import org.springframework.extensions.webscripts.servlet.FormData; From 93426b301b278dd49a406f4fbb15c8caf4f78561 Mon Sep 17 00:00:00 2001 From: Mohit Singh Date: Mon, 4 Mar 2024 14:22:57 +0530 Subject: [PATCH 03/21] [APPS-2564]: Added endpoint to get Folder Size. --- .../org/alfresco/rest/api/impl/NodesImpl.java | 16 ++++++++-------- .../interfaces/RelationshipResourceAction.java | 4 ++-- 2 files changed, 10 insertions(+), 10 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 ad9a0b354a7..42b6cef2daf 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 @@ -3555,24 +3555,25 @@ public void validateProperties(Map properties, List excl }); } } - public Map getFolderSize(String FolderNodeId){ - NodeRef nodeRef = this.validateNode(FolderNodeId); + public Map getFolderSize(String folderNodeId){ + + NodeRef nodeRef = this.validateNode(folderNodeId); long size=this.getNodeSize(nodeRef); int k = 1024; String[] sizes = {"Bytes", "KB", "MB", "GB", "TB", "PB"}; int i = (int) Math.floor(Math.log(size) / Math.log(k)); - float finalSize=Float.parseFloat(String.valueOf((size / Math.pow(k, i)))); + float finalSize = Float.parseFloat(String.valueOf((size / Math.pow(k, i)))); Map response = new HashMap<>(); - response.put("id",FolderNodeId); - response.put("size",String.valueOf(finalSize + " " + sizes[i])); + response.put("id", folderNodeId); + response.put("size", String.valueOf(finalSize + " " + sizes[i])); return response; } protected long getNodeSize(NodeRef nodeRef){ - long size=0; - // Collecting current node size + long size=0; + // Collecting current node size. ContentData contentData = (ContentData) nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT); try { size = contentData.getSize(); @@ -3587,7 +3588,6 @@ protected long getNodeSize(NodeRef nodeRef){ return size; } - /** * @author Jamal Kaabi-Mofrad */ diff --git a/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java b/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java index 3d94f718b0c..0fc06ae0bff 100644 --- a/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java +++ b/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java @@ -168,8 +168,8 @@ public static interface FolderSize extends ResourceAction /** * Return the size of Folder. * - * @param NodeId Entity resource context for this relationship. + * @param nodeId Entity resource context for this relationship. */ - public E readAll(String NodeId); + public E readAll(String nodeId); } } From 66cb8946469604a2096869e0580edcfbb47d8ef1 Mon Sep 17 00:00:00 2001 From: Mohit Singh Date: Mon, 4 Mar 2024 14:23:55 +0530 Subject: [PATCH 04/21] [APPS-2564]: Added endpoint to get Folder Size. --- .../org/alfresco/rest/api/nodes/NodeFolderSizeRelation.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 212ec03e907..59a4d21a228 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 @@ -61,7 +61,7 @@ public void afterPropertiesSet() /** * Folder Size - returns a size of folder. * - * @param NodeId String id of folder - will also accept well-known alias, eg. -root- or -my- or -shared- + * @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 ! * * If NodeId does not exist, EntityNotFoundException (status 404). @@ -69,9 +69,9 @@ public void afterPropertiesSet() */ @Override @WebApiDescription(title = "Size of folder",description = "Return a size of folder") - public Map readAll(String NodeId) + public Map readAll(String nodeId) { - return nodes.getFolderSize(NodeId); + return nodes.getFolderSize(nodeId); } } From 2732e40822dc037737f0e58ccbb946a9670474f2 Mon Sep 17 00:00:00 2001 From: Mohit Singh Date: Mon, 4 Mar 2024 18:34:50 +0530 Subject: [PATCH 05/21] [MNT-24127] Developed endpoint for calculating the size of a folder --- .../src/main/java/org/alfresco/rest/api/impl/NodesImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 42b6cef2daf..a05433782c8 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 @@ -3555,7 +3555,11 @@ public void validateProperties(Map properties, List excl }); } } - + /** + * + * @param folderNodeId + */ + @Override public Map getFolderSize(String folderNodeId){ NodeRef nodeRef = this.validateNode(folderNodeId); From 412af0511e4dce043c8302a255f68fde8579294f Mon Sep 17 00:00:00 2001 From: Mohit Singh Date: Tue, 5 Mar 2024 12:56:07 +0530 Subject: [PATCH 06/21] [MNT-24127] Added endpoint implementation to calculating folder size. --- .../main/java/org/alfresco/rest/api/impl/NodesImpl.java | 8 ++------ .../actions/interfaces/RelationshipResourceAction.java | 4 ++-- 2 files changed, 4 insertions(+), 8 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 a05433782c8..4c7c72aa69e 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 @@ -3567,7 +3567,7 @@ public Map getFolderSize(String folderNodeId){ int k = 1024; String[] sizes = {"Bytes", "KB", "MB", "GB", "TB", "PB"}; int i = (int) Math.floor(Math.log(size) / Math.log(k)); - float finalSize = Float.parseFloat(String.valueOf((size / Math.pow(k, i)))); + float finalSize = Float.parseFloat(String.valueOf(size / Math.pow(k, i))); Map response = new HashMap<>(); response.put("id", folderNodeId); response.put("size", String.valueOf(finalSize + " " + sizes[i])); @@ -3579,11 +3579,7 @@ protected long getNodeSize(NodeRef nodeRef){ long size=0; // Collecting current node size. ContentData contentData = (ContentData) nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT); - try { - size = contentData.getSize(); - } catch (Exception e) { - size = 0; - } + size = contentData.getSize(); List chilAssocsList = nodeService.getChildAssocs(nodeRef); for (ChildAssociationRef childAssociationRef : chilAssocsList) { NodeRef childNodeRef = childAssociationRef.getChildRef(); diff --git a/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java b/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java index 0fc06ae0bff..443038b230c 100644 --- a/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java +++ b/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java @@ -163,13 +163,13 @@ public static interface DeleteSetWithResponse extends ResourceAction */ public void deleteSet(String entityResourceId, Parameters params, WithResponse withResponse); } - public static interface FolderSize extends ResourceAction + interface FolderSize extends ResourceAction { /** * Return the size of Folder. * * @param nodeId Entity resource context for this relationship. */ - public E readAll(String nodeId); + E readAll(String nodeId); } } From 37ec24c966fbf4826eaa2fed34a6bf4ca7f2e36a Mon Sep 17 00:00:00 2001 From: Mohit Singh Date: Tue, 5 Mar 2024 13:44:39 +0530 Subject: [PATCH 07/21] [MNT-24127] Added endpoint implementation to calculating folder size. --- .../src/main/java/org/alfresco/rest/api/impl/NodesImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 4c7c72aa69e..40827f79535 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 @@ -3557,7 +3557,7 @@ public void validateProperties(Map properties, List excl } /** * - * @param folderNodeId + * @param folderNodeId nodeId value. */ @Override public Map getFolderSize(String folderNodeId){ From bbebfec368e7fc3961c26b417735af5220e788be Mon Sep 17 00:00:00 2001 From: Mohit Singh Date: Tue, 5 Mar 2024 14:40:28 +0530 Subject: [PATCH 08/21] Revert "[MNT-24127] Added endpoint implementation to calculating folder size." This reverts commit 412af0511e4dce043c8302a255f68fde8579294f. --- .../main/java/org/alfresco/rest/api/impl/NodesImpl.java | 8 ++++++-- .../actions/interfaces/RelationshipResourceAction.java | 4 ++-- 2 files changed, 8 insertions(+), 4 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 40827f79535..3345b334348 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 @@ -3567,7 +3567,7 @@ public Map getFolderSize(String folderNodeId){ int k = 1024; String[] sizes = {"Bytes", "KB", "MB", "GB", "TB", "PB"}; int i = (int) Math.floor(Math.log(size) / Math.log(k)); - float finalSize = Float.parseFloat(String.valueOf(size / Math.pow(k, i))); + float finalSize = Float.parseFloat(String.valueOf((size / Math.pow(k, i)))); Map response = new HashMap<>(); response.put("id", folderNodeId); response.put("size", String.valueOf(finalSize + " " + sizes[i])); @@ -3579,7 +3579,11 @@ protected long getNodeSize(NodeRef nodeRef){ long size=0; // Collecting current node size. ContentData contentData = (ContentData) nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT); - size = contentData.getSize(); + try { + size = contentData.getSize(); + } catch (Exception e) { + size = 0; + } List chilAssocsList = nodeService.getChildAssocs(nodeRef); for (ChildAssociationRef childAssociationRef : chilAssocsList) { NodeRef childNodeRef = childAssociationRef.getChildRef(); diff --git a/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java b/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java index 443038b230c..0fc06ae0bff 100644 --- a/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java +++ b/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java @@ -163,13 +163,13 @@ public static interface DeleteSetWithResponse extends ResourceAction */ public void deleteSet(String entityResourceId, Parameters params, WithResponse withResponse); } - interface FolderSize extends ResourceAction + public static interface FolderSize extends ResourceAction { /** * Return the size of Folder. * * @param nodeId Entity resource context for this relationship. */ - E readAll(String nodeId); + public E readAll(String nodeId); } } From 9f2c0ee5ba119a43ff931e0ea522ba3d8aef9151 Mon Sep 17 00:00:00 2001 From: Mohit Singh Date: Tue, 5 Mar 2024 14:45:47 +0530 Subject: [PATCH 09/21] [MNT-24127] Added endpoint implementation to calculating folder size. --- .../main/java/org/alfresco/rest/api/impl/NodesImpl.java | 8 ++------ .../actions/interfaces/RelationshipResourceAction.java | 4 ++-- 2 files changed, 4 insertions(+), 8 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 3345b334348..40827f79535 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 @@ -3567,7 +3567,7 @@ public Map getFolderSize(String folderNodeId){ int k = 1024; String[] sizes = {"Bytes", "KB", "MB", "GB", "TB", "PB"}; int i = (int) Math.floor(Math.log(size) / Math.log(k)); - float finalSize = Float.parseFloat(String.valueOf((size / Math.pow(k, i)))); + float finalSize = Float.parseFloat(String.valueOf(size / Math.pow(k, i))); Map response = new HashMap<>(); response.put("id", folderNodeId); response.put("size", String.valueOf(finalSize + " " + sizes[i])); @@ -3579,11 +3579,7 @@ protected long getNodeSize(NodeRef nodeRef){ long size=0; // Collecting current node size. ContentData contentData = (ContentData) nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT); - try { - size = contentData.getSize(); - } catch (Exception e) { - size = 0; - } + size = contentData.getSize(); List chilAssocsList = nodeService.getChildAssocs(nodeRef); for (ChildAssociationRef childAssociationRef : chilAssocsList) { NodeRef childNodeRef = childAssociationRef.getChildRef(); diff --git a/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java b/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java index 0fc06ae0bff..443038b230c 100644 --- a/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java +++ b/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java @@ -163,13 +163,13 @@ public static interface DeleteSetWithResponse extends ResourceAction */ public void deleteSet(String entityResourceId, Parameters params, WithResponse withResponse); } - public static interface FolderSize extends ResourceAction + interface FolderSize extends ResourceAction { /** * Return the size of Folder. * * @param nodeId Entity resource context for this relationship. */ - public E readAll(String nodeId); + E readAll(String nodeId); } } From fed237c343d26152b36fa16097b7abfbeb78f1c5 Mon Sep 17 00:00:00 2001 From: Mohit Singh Date: Tue, 5 Mar 2024 15:07:59 +0530 Subject: [PATCH 10/21] [MNT-24127] Added endpoint implementation to calculating folder size. --- .../main/java/org/alfresco/rest/api/impl/NodesImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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 40827f79535..d0c06b872f6 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 @@ -3576,10 +3576,14 @@ public Map getFolderSize(String folderNodeId){ protected long getNodeSize(NodeRef nodeRef){ - long size=0; + long size; // Collecting current node size. ContentData contentData = (ContentData) nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT); - size = contentData.getSize(); + try { + size = contentData.getSize(); + } catch (Exception e) { + size = 0; + } List chilAssocsList = nodeService.getChildAssocs(nodeRef); for (ChildAssociationRef childAssociationRef : chilAssocsList) { NodeRef childNodeRef = childAssociationRef.getChildRef(); From b564b3ed1813e8a66dd55bdf92b9b723ce6bcf40 Mon Sep 17 00:00:00 2001 From: Alfresco CI User Date: Sun, 3 Mar 2024 00:03:20 +0000 Subject: [PATCH 11/21] [force] Force release for 2024-03-03. From 562ae8ca4efcba58d561656e159d4574fb98dc4e Mon Sep 17 00:00:00 2001 From: alfresco-build <8039454+alfresco-build@users.noreply.github.com> Date: Sun, 3 Mar 2024 00:05:42 +0000 Subject: [PATCH 12/21] [maven-release-plugin][skip ci] prepare release 23.3.0.6 --- amps/ags/pom.xml | 2 +- amps/ags/rm-automation/pom.xml | 2 +- .../rm-automation/rm-automation-community-rest-api/pom.xml | 2 +- amps/ags/rm-community/pom.xml | 2 +- amps/ags/rm-community/rm-community-repo/pom.xml | 2 +- amps/ags/rm-community/rm-community-rest-api-explorer/pom.xml | 2 +- amps/pom.xml | 2 +- amps/share-services/pom.xml | 2 +- core/pom.xml | 2 +- data-model/pom.xml | 2 +- mmt/pom.xml | 2 +- packaging/distribution/pom.xml | 2 +- packaging/docker-alfresco/pom.xml | 2 +- packaging/pom.xml | 2 +- packaging/tests/pom.xml | 2 +- packaging/tests/tas-cmis/pom.xml | 2 +- packaging/tests/tas-email/pom.xml | 2 +- packaging/tests/tas-integration/pom.xml | 2 +- packaging/tests/tas-restapi/pom.xml | 2 +- packaging/tests/tas-webdav/pom.xml | 2 +- packaging/war/pom.xml | 2 +- pom.xml | 4 ++-- remote-api/pom.xml | 2 +- repository/pom.xml | 2 +- 24 files changed, 25 insertions(+), 25 deletions(-) diff --git a/amps/ags/pom.xml b/amps/ags/pom.xml index 52a32153a5a..e015cd9c429 100644 --- a/amps/ags/pom.xml +++ b/amps/ags/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo-amps - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/amps/ags/rm-automation/pom.xml b/amps/ags/rm-automation/pom.xml index ca7be2a6707..104737be189 100644 --- a/amps/ags/rm-automation/pom.xml +++ b/amps/ags/rm-automation/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-governance-services-community-parent - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/pom.xml b/amps/ags/rm-automation/rm-automation-community-rest-api/pom.xml index 68265919b00..497fa57a90d 100644 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/pom.xml +++ b/amps/ags/rm-automation/rm-automation-community-rest-api/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-governance-services-automation-community-repo - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/amps/ags/rm-community/pom.xml b/amps/ags/rm-community/pom.xml index ac61c1702a7..d275a9b65c9 100644 --- a/amps/ags/rm-community/pom.xml +++ b/amps/ags/rm-community/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-governance-services-community-parent - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/amps/ags/rm-community/rm-community-repo/pom.xml b/amps/ags/rm-community/rm-community-repo/pom.xml index 4151818a110..0c24f553866 100644 --- a/amps/ags/rm-community/rm-community-repo/pom.xml +++ b/amps/ags/rm-community/rm-community-repo/pom.xml @@ -8,7 +8,7 @@ org.alfresco alfresco-governance-services-community-repo-parent - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/amps/ags/rm-community/rm-community-rest-api-explorer/pom.xml b/amps/ags/rm-community/rm-community-rest-api-explorer/pom.xml index b508064bf13..e6d8ae27007 100644 --- a/amps/ags/rm-community/rm-community-rest-api-explorer/pom.xml +++ b/amps/ags/rm-community/rm-community-rest-api-explorer/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-governance-services-community-repo-parent - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/amps/pom.xml b/amps/pom.xml index bcc8e0198f8..f02410b4e0a 100644 --- a/amps/pom.xml +++ b/amps/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/amps/share-services/pom.xml b/amps/share-services/pom.xml index 8752e885ec1..df8bcaf3763 100644 --- a/amps/share-services/pom.xml +++ b/amps/share-services/pom.xml @@ -8,7 +8,7 @@ org.alfresco alfresco-community-repo-amps - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/core/pom.xml b/core/pom.xml index 8692e4f4331..e32bfb92262 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/data-model/pom.xml b/data-model/pom.xml index e69b3a276a3..e42cfd93b61 100644 --- a/data-model/pom.xml +++ b/data-model/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/mmt/pom.xml b/mmt/pom.xml index 3d2dd1ae647..81f5d9eeb8b 100644 --- a/mmt/pom.xml +++ b/mmt/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/packaging/distribution/pom.xml b/packaging/distribution/pom.xml index d98dee5025f..087c9fc7cd8 100644 --- a/packaging/distribution/pom.xml +++ b/packaging/distribution/pom.xml @@ -9,6 +9,6 @@ org.alfresco alfresco-community-repo-packaging - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/packaging/docker-alfresco/pom.xml b/packaging/docker-alfresco/pom.xml index 0cb4a3425fd..995bba2a6b1 100644 --- a/packaging/docker-alfresco/pom.xml +++ b/packaging/docker-alfresco/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo-packaging - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/packaging/pom.xml b/packaging/pom.xml index dca3bc11e0a..49c45fd6478 100644 --- a/packaging/pom.xml +++ b/packaging/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/packaging/tests/pom.xml b/packaging/tests/pom.xml index e41113c1449..37db8a29d0f 100644 --- a/packaging/tests/pom.xml +++ b/packaging/tests/pom.xml @@ -6,7 +6,7 @@ org.alfresco alfresco-community-repo-packaging - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/packaging/tests/tas-cmis/pom.xml b/packaging/tests/tas-cmis/pom.xml index afd7c1885f7..ce1312d7caf 100644 --- a/packaging/tests/tas-cmis/pom.xml +++ b/packaging/tests/tas-cmis/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo-tests - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/packaging/tests/tas-email/pom.xml b/packaging/tests/tas-email/pom.xml index 7042f6c9927..2c809732dd6 100644 --- a/packaging/tests/tas-email/pom.xml +++ b/packaging/tests/tas-email/pom.xml @@ -9,7 +9,7 @@ org.alfresco alfresco-community-repo-tests - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/packaging/tests/tas-integration/pom.xml b/packaging/tests/tas-integration/pom.xml index 3b1a899cb8e..e68df3f323c 100644 --- a/packaging/tests/tas-integration/pom.xml +++ b/packaging/tests/tas-integration/pom.xml @@ -9,7 +9,7 @@ org.alfresco alfresco-community-repo-tests - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/packaging/tests/tas-restapi/pom.xml b/packaging/tests/tas-restapi/pom.xml index 8693623c65e..a024f4a173b 100644 --- a/packaging/tests/tas-restapi/pom.xml +++ b/packaging/tests/tas-restapi/pom.xml @@ -8,7 +8,7 @@ org.alfresco alfresco-community-repo-tests - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/packaging/tests/tas-webdav/pom.xml b/packaging/tests/tas-webdav/pom.xml index 1cff7f6006b..bebf708896b 100644 --- a/packaging/tests/tas-webdav/pom.xml +++ b/packaging/tests/tas-webdav/pom.xml @@ -9,7 +9,7 @@ org.alfresco alfresco-community-repo-tests - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/packaging/war/pom.xml b/packaging/war/pom.xml index 3cbf616440b..3fc1aecc12f 100644 --- a/packaging/war/pom.xml +++ b/packaging/war/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo-packaging - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/pom.xml b/pom.xml index d2a6cbb2d80..02024d3842c 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 alfresco-community-repo - 23.3.0.6-SNAPSHOT + 23.3.0.6 pom Alfresco Community Repo Parent @@ -151,7 +151,7 @@ scm:git:https://github.com/Alfresco/alfresco-community-repo.git scm:git:https://github.com/Alfresco/alfresco-community-repo.git https://github.com/Alfresco/alfresco-community-repo - HEAD + 23.3.0.6 diff --git a/remote-api/pom.xml b/remote-api/pom.xml index 5fed10a5555..b71efc93824 100644 --- a/remote-api/pom.xml +++ b/remote-api/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo - 23.3.0.6-SNAPSHOT + 23.3.0.6 diff --git a/repository/pom.xml b/repository/pom.xml index 6a783a3f6bf..a24c75c1c0d 100644 --- a/repository/pom.xml +++ b/repository/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo - 23.3.0.6-SNAPSHOT + 23.3.0.6 From 28246ef6ef8e47369ca311e1ef867aba14fd35f5 Mon Sep 17 00:00:00 2001 From: alfresco-build <8039454+alfresco-build@users.noreply.github.com> Date: Sun, 3 Mar 2024 00:05:44 +0000 Subject: [PATCH 13/21] [maven-release-plugin][skip ci] prepare for next development iteration --- amps/ags/pom.xml | 2 +- amps/ags/rm-automation/pom.xml | 2 +- .../rm-automation/rm-automation-community-rest-api/pom.xml | 2 +- amps/ags/rm-community/pom.xml | 2 +- amps/ags/rm-community/rm-community-repo/pom.xml | 2 +- amps/ags/rm-community/rm-community-rest-api-explorer/pom.xml | 2 +- amps/pom.xml | 2 +- amps/share-services/pom.xml | 2 +- core/pom.xml | 2 +- data-model/pom.xml | 2 +- mmt/pom.xml | 2 +- packaging/distribution/pom.xml | 2 +- packaging/docker-alfresco/pom.xml | 2 +- packaging/pom.xml | 2 +- packaging/tests/pom.xml | 2 +- packaging/tests/tas-cmis/pom.xml | 2 +- packaging/tests/tas-email/pom.xml | 2 +- packaging/tests/tas-integration/pom.xml | 2 +- packaging/tests/tas-restapi/pom.xml | 2 +- packaging/tests/tas-webdav/pom.xml | 2 +- packaging/war/pom.xml | 2 +- pom.xml | 4 ++-- remote-api/pom.xml | 2 +- repository/pom.xml | 2 +- 24 files changed, 25 insertions(+), 25 deletions(-) diff --git a/amps/ags/pom.xml b/amps/ags/pom.xml index e015cd9c429..6f0ed13cc13 100644 --- a/amps/ags/pom.xml +++ b/amps/ags/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo-amps - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/amps/ags/rm-automation/pom.xml b/amps/ags/rm-automation/pom.xml index 104737be189..1714f20e6f2 100644 --- a/amps/ags/rm-automation/pom.xml +++ b/amps/ags/rm-automation/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-governance-services-community-parent - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/pom.xml b/amps/ags/rm-automation/rm-automation-community-rest-api/pom.xml index 497fa57a90d..38e87e09d6f 100644 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/pom.xml +++ b/amps/ags/rm-automation/rm-automation-community-rest-api/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-governance-services-automation-community-repo - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/amps/ags/rm-community/pom.xml b/amps/ags/rm-community/pom.xml index d275a9b65c9..a86c70fcfbb 100644 --- a/amps/ags/rm-community/pom.xml +++ b/amps/ags/rm-community/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-governance-services-community-parent - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/amps/ags/rm-community/rm-community-repo/pom.xml b/amps/ags/rm-community/rm-community-repo/pom.xml index 0c24f553866..7e9dfbc7967 100644 --- a/amps/ags/rm-community/rm-community-repo/pom.xml +++ b/amps/ags/rm-community/rm-community-repo/pom.xml @@ -8,7 +8,7 @@ org.alfresco alfresco-governance-services-community-repo-parent - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/amps/ags/rm-community/rm-community-rest-api-explorer/pom.xml b/amps/ags/rm-community/rm-community-rest-api-explorer/pom.xml index e6d8ae27007..3705d41d768 100644 --- a/amps/ags/rm-community/rm-community-rest-api-explorer/pom.xml +++ b/amps/ags/rm-community/rm-community-rest-api-explorer/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-governance-services-community-repo-parent - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/amps/pom.xml b/amps/pom.xml index f02410b4e0a..139038545fd 100644 --- a/amps/pom.xml +++ b/amps/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/amps/share-services/pom.xml b/amps/share-services/pom.xml index df8bcaf3763..f7c9bea5d6e 100644 --- a/amps/share-services/pom.xml +++ b/amps/share-services/pom.xml @@ -8,7 +8,7 @@ org.alfresco alfresco-community-repo-amps - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/core/pom.xml b/core/pom.xml index e32bfb92262..e8a37163965 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/data-model/pom.xml b/data-model/pom.xml index e42cfd93b61..20bec76f794 100644 --- a/data-model/pom.xml +++ b/data-model/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/mmt/pom.xml b/mmt/pom.xml index 81f5d9eeb8b..c2095acac08 100644 --- a/mmt/pom.xml +++ b/mmt/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/packaging/distribution/pom.xml b/packaging/distribution/pom.xml index 087c9fc7cd8..f16c008985c 100644 --- a/packaging/distribution/pom.xml +++ b/packaging/distribution/pom.xml @@ -9,6 +9,6 @@ org.alfresco alfresco-community-repo-packaging - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/packaging/docker-alfresco/pom.xml b/packaging/docker-alfresco/pom.xml index 995bba2a6b1..2db6e31255e 100644 --- a/packaging/docker-alfresco/pom.xml +++ b/packaging/docker-alfresco/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo-packaging - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/packaging/pom.xml b/packaging/pom.xml index 49c45fd6478..ab2b8f3d5a4 100644 --- a/packaging/pom.xml +++ b/packaging/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/packaging/tests/pom.xml b/packaging/tests/pom.xml index 37db8a29d0f..83f7c449078 100644 --- a/packaging/tests/pom.xml +++ b/packaging/tests/pom.xml @@ -6,7 +6,7 @@ org.alfresco alfresco-community-repo-packaging - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/packaging/tests/tas-cmis/pom.xml b/packaging/tests/tas-cmis/pom.xml index ce1312d7caf..b5a93524711 100644 --- a/packaging/tests/tas-cmis/pom.xml +++ b/packaging/tests/tas-cmis/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo-tests - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/packaging/tests/tas-email/pom.xml b/packaging/tests/tas-email/pom.xml index 2c809732dd6..062ede6187c 100644 --- a/packaging/tests/tas-email/pom.xml +++ b/packaging/tests/tas-email/pom.xml @@ -9,7 +9,7 @@ org.alfresco alfresco-community-repo-tests - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/packaging/tests/tas-integration/pom.xml b/packaging/tests/tas-integration/pom.xml index e68df3f323c..510d51072e5 100644 --- a/packaging/tests/tas-integration/pom.xml +++ b/packaging/tests/tas-integration/pom.xml @@ -9,7 +9,7 @@ org.alfresco alfresco-community-repo-tests - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/packaging/tests/tas-restapi/pom.xml b/packaging/tests/tas-restapi/pom.xml index a024f4a173b..9cc3e1bedb6 100644 --- a/packaging/tests/tas-restapi/pom.xml +++ b/packaging/tests/tas-restapi/pom.xml @@ -8,7 +8,7 @@ org.alfresco alfresco-community-repo-tests - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/packaging/tests/tas-webdav/pom.xml b/packaging/tests/tas-webdav/pom.xml index bebf708896b..5339315cbdd 100644 --- a/packaging/tests/tas-webdav/pom.xml +++ b/packaging/tests/tas-webdav/pom.xml @@ -9,7 +9,7 @@ org.alfresco alfresco-community-repo-tests - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/packaging/war/pom.xml b/packaging/war/pom.xml index 3fc1aecc12f..e8554679bbe 100644 --- a/packaging/war/pom.xml +++ b/packaging/war/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo-packaging - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/pom.xml b/pom.xml index 02024d3842c..93ad2e26e0a 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 alfresco-community-repo - 23.3.0.6 + 23.3.0.7-SNAPSHOT pom Alfresco Community Repo Parent @@ -151,7 +151,7 @@ scm:git:https://github.com/Alfresco/alfresco-community-repo.git scm:git:https://github.com/Alfresco/alfresco-community-repo.git https://github.com/Alfresco/alfresco-community-repo - 23.3.0.6 + HEAD diff --git a/remote-api/pom.xml b/remote-api/pom.xml index b71efc93824..e30e0106835 100644 --- a/remote-api/pom.xml +++ b/remote-api/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo - 23.3.0.6 + 23.3.0.7-SNAPSHOT diff --git a/repository/pom.xml b/repository/pom.xml index a24c75c1c0d..3bab3f4b5cb 100644 --- a/repository/pom.xml +++ b/repository/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo - 23.3.0.6 + 23.3.0.7-SNAPSHOT From a5dc1226a8a72ad5bde805a85de3c5c37459308e Mon Sep 17 00:00:00 2001 From: Mohit Singh Date: Tue, 5 Mar 2024 14:40:28 +0530 Subject: [PATCH 14/21] Revert "[MNT-24127] Added endpoint implementation to calculating folder size." This reverts commit 412af0511e4dce043c8302a255f68fde8579294f. --- .../main/java/org/alfresco/rest/api/impl/NodesImpl.java | 8 ++++++-- .../actions/interfaces/RelationshipResourceAction.java | 4 ++-- 2 files changed, 8 insertions(+), 4 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 40827f79535..3345b334348 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 @@ -3567,7 +3567,7 @@ public Map getFolderSize(String folderNodeId){ int k = 1024; String[] sizes = {"Bytes", "KB", "MB", "GB", "TB", "PB"}; int i = (int) Math.floor(Math.log(size) / Math.log(k)); - float finalSize = Float.parseFloat(String.valueOf(size / Math.pow(k, i))); + float finalSize = Float.parseFloat(String.valueOf((size / Math.pow(k, i)))); Map response = new HashMap<>(); response.put("id", folderNodeId); response.put("size", String.valueOf(finalSize + " " + sizes[i])); @@ -3579,7 +3579,11 @@ protected long getNodeSize(NodeRef nodeRef){ long size=0; // Collecting current node size. ContentData contentData = (ContentData) nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT); - size = contentData.getSize(); + try { + size = contentData.getSize(); + } catch (Exception e) { + size = 0; + } List chilAssocsList = nodeService.getChildAssocs(nodeRef); for (ChildAssociationRef childAssociationRef : chilAssocsList) { NodeRef childNodeRef = childAssociationRef.getChildRef(); diff --git a/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java b/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java index 443038b230c..0fc06ae0bff 100644 --- a/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java +++ b/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java @@ -163,13 +163,13 @@ public static interface DeleteSetWithResponse extends ResourceAction */ public void deleteSet(String entityResourceId, Parameters params, WithResponse withResponse); } - interface FolderSize extends ResourceAction + public static interface FolderSize extends ResourceAction { /** * Return the size of Folder. * * @param nodeId Entity resource context for this relationship. */ - E readAll(String nodeId); + public E readAll(String nodeId); } } From 8260a186b3d62694deb8efcac72679c869f95daf Mon Sep 17 00:00:00 2001 From: Mohit Singh Date: Tue, 5 Mar 2024 14:45:47 +0530 Subject: [PATCH 15/21] [MNT-24127] Added endpoint implementation to calculating folder size. --- .../main/java/org/alfresco/rest/api/impl/NodesImpl.java | 8 ++------ .../actions/interfaces/RelationshipResourceAction.java | 4 ++-- 2 files changed, 4 insertions(+), 8 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 3345b334348..40827f79535 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 @@ -3567,7 +3567,7 @@ public Map getFolderSize(String folderNodeId){ int k = 1024; String[] sizes = {"Bytes", "KB", "MB", "GB", "TB", "PB"}; int i = (int) Math.floor(Math.log(size) / Math.log(k)); - float finalSize = Float.parseFloat(String.valueOf((size / Math.pow(k, i)))); + float finalSize = Float.parseFloat(String.valueOf(size / Math.pow(k, i))); Map response = new HashMap<>(); response.put("id", folderNodeId); response.put("size", String.valueOf(finalSize + " " + sizes[i])); @@ -3579,11 +3579,7 @@ protected long getNodeSize(NodeRef nodeRef){ long size=0; // Collecting current node size. ContentData contentData = (ContentData) nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT); - try { - size = contentData.getSize(); - } catch (Exception e) { - size = 0; - } + size = contentData.getSize(); List chilAssocsList = nodeService.getChildAssocs(nodeRef); for (ChildAssociationRef childAssociationRef : chilAssocsList) { NodeRef childNodeRef = childAssociationRef.getChildRef(); diff --git a/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java b/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java index 0fc06ae0bff..443038b230c 100644 --- a/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java +++ b/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java @@ -163,13 +163,13 @@ public static interface DeleteSetWithResponse extends ResourceAction */ public void deleteSet(String entityResourceId, Parameters params, WithResponse withResponse); } - public static interface FolderSize extends ResourceAction + interface FolderSize extends ResourceAction { /** * Return the size of Folder. * * @param nodeId Entity resource context for this relationship. */ - public E readAll(String nodeId); + E readAll(String nodeId); } } From 263c1bef6fed39c0f7ad5682571798a9320dbc3d Mon Sep 17 00:00:00 2001 From: Mohit Singh Date: Tue, 5 Mar 2024 15:07:59 +0530 Subject: [PATCH 16/21] [MNT-24127] Added endpoint implementation to calculating folder size. --- .../main/java/org/alfresco/rest/api/impl/NodesImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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 40827f79535..d0c06b872f6 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 @@ -3576,10 +3576,14 @@ public Map getFolderSize(String folderNodeId){ protected long getNodeSize(NodeRef nodeRef){ - long size=0; + long size; // Collecting current node size. ContentData contentData = (ContentData) nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT); - size = contentData.getSize(); + try { + size = contentData.getSize(); + } catch (Exception e) { + size = 0; + } List chilAssocsList = nodeService.getChildAssocs(nodeRef); for (ChildAssociationRef childAssociationRef : chilAssocsList) { NodeRef childNodeRef = childAssociationRef.getChildRef(); From 4309c894c6f8f5992e43861946926cc6cdb54ec1 Mon Sep 17 00:00:00 2001 From: Mohit Singh Date: Mon, 11 Mar 2024 17:19:33 +0530 Subject: [PATCH 17/21] [MNT-24127] Added endpoint implementation to calculating folder size. --- amps/ags/pom.xml | 2 +- amps/ags/rm-automation/pom.xml | 2 +- .../rm-automation/rm-automation-community-rest-api/pom.xml | 2 +- amps/ags/rm-community/pom.xml | 2 +- amps/ags/rm-community/rm-community-repo/pom.xml | 2 +- amps/ags/rm-community/rm-community-rest-api-explorer/pom.xml | 2 +- amps/pom.xml | 2 +- amps/share-services/pom.xml | 3 ++- core/pom.xml | 2 +- data-model/pom.xml | 2 +- mmt/pom.xml | 2 +- packaging/distribution/pom.xml | 2 +- packaging/docker-alfresco/pom.xml | 2 +- packaging/pom.xml | 2 +- packaging/tests/pom.xml | 2 +- packaging/tests/tas-cmis/pom.xml | 2 +- packaging/tests/tas-email/pom.xml | 2 +- packaging/tests/tas-integration/pom.xml | 2 +- packaging/tests/tas-restapi/pom.xml | 2 +- packaging/tests/tas-webdav/pom.xml | 2 +- packaging/war/pom.xml | 2 +- pom.xml | 4 ++-- remote-api/pom.xml | 2 +- repository/pom.xml | 2 +- 24 files changed, 26 insertions(+), 25 deletions(-) diff --git a/amps/ags/pom.xml b/amps/ags/pom.xml index 6f0ed13cc13..204b6c5fe98 100644 --- a/amps/ags/pom.xml +++ b/amps/ags/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo-amps - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT diff --git a/amps/ags/rm-automation/pom.xml b/amps/ags/rm-automation/pom.xml index 1714f20e6f2..bc561a4a2c0 100644 --- a/amps/ags/rm-automation/pom.xml +++ b/amps/ags/rm-automation/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-governance-services-community-parent - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT diff --git a/amps/ags/rm-automation/rm-automation-community-rest-api/pom.xml b/amps/ags/rm-automation/rm-automation-community-rest-api/pom.xml index 38e87e09d6f..55a705acb9b 100644 --- a/amps/ags/rm-automation/rm-automation-community-rest-api/pom.xml +++ b/amps/ags/rm-automation/rm-automation-community-rest-api/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-governance-services-automation-community-repo - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT diff --git a/amps/ags/rm-community/pom.xml b/amps/ags/rm-community/pom.xml index a86c70fcfbb..0629da3150d 100644 --- a/amps/ags/rm-community/pom.xml +++ b/amps/ags/rm-community/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-governance-services-community-parent - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT diff --git a/amps/ags/rm-community/rm-community-repo/pom.xml b/amps/ags/rm-community/rm-community-repo/pom.xml index 7e9dfbc7967..1745979c2b1 100644 --- a/amps/ags/rm-community/rm-community-repo/pom.xml +++ b/amps/ags/rm-community/rm-community-repo/pom.xml @@ -8,7 +8,7 @@ org.alfresco alfresco-governance-services-community-repo-parent - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT diff --git a/amps/ags/rm-community/rm-community-rest-api-explorer/pom.xml b/amps/ags/rm-community/rm-community-rest-api-explorer/pom.xml index 3705d41d768..7c7552959e2 100644 --- a/amps/ags/rm-community/rm-community-rest-api-explorer/pom.xml +++ b/amps/ags/rm-community/rm-community-rest-api-explorer/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-governance-services-community-repo-parent - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT diff --git a/amps/pom.xml b/amps/pom.xml index 139038545fd..21a5e024720 100644 --- a/amps/pom.xml +++ b/amps/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT diff --git a/amps/share-services/pom.xml b/amps/share-services/pom.xml index f7c9bea5d6e..e15bef6733f 100644 --- a/amps/share-services/pom.xml +++ b/amps/share-services/pom.xml @@ -8,11 +8,12 @@ org.alfresco alfresco-community-repo-amps - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT ${project.parent.scm.url} + ${buildNumber} diff --git a/core/pom.xml b/core/pom.xml index e8a37163965..715d45a9c39 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT diff --git a/data-model/pom.xml b/data-model/pom.xml index 20bec76f794..731a5d1ec8a 100644 --- a/data-model/pom.xml +++ b/data-model/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT diff --git a/mmt/pom.xml b/mmt/pom.xml index c2095acac08..c5e6f6b4e8a 100644 --- a/mmt/pom.xml +++ b/mmt/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT diff --git a/packaging/distribution/pom.xml b/packaging/distribution/pom.xml index f16c008985c..84c6136f6d0 100644 --- a/packaging/distribution/pom.xml +++ b/packaging/distribution/pom.xml @@ -9,6 +9,6 @@ org.alfresco alfresco-community-repo-packaging - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT diff --git a/packaging/docker-alfresco/pom.xml b/packaging/docker-alfresco/pom.xml index 2db6e31255e..6c7c98559af 100644 --- a/packaging/docker-alfresco/pom.xml +++ b/packaging/docker-alfresco/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo-packaging - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT diff --git a/packaging/pom.xml b/packaging/pom.xml index ab2b8f3d5a4..2329dc71c55 100644 --- a/packaging/pom.xml +++ b/packaging/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT diff --git a/packaging/tests/pom.xml b/packaging/tests/pom.xml index 83f7c449078..7f0dde7488b 100644 --- a/packaging/tests/pom.xml +++ b/packaging/tests/pom.xml @@ -6,7 +6,7 @@ org.alfresco alfresco-community-repo-packaging - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT diff --git a/packaging/tests/tas-cmis/pom.xml b/packaging/tests/tas-cmis/pom.xml index b5a93524711..4182721373e 100644 --- a/packaging/tests/tas-cmis/pom.xml +++ b/packaging/tests/tas-cmis/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo-tests - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT diff --git a/packaging/tests/tas-email/pom.xml b/packaging/tests/tas-email/pom.xml index 062ede6187c..b1363dc7044 100644 --- a/packaging/tests/tas-email/pom.xml +++ b/packaging/tests/tas-email/pom.xml @@ -9,7 +9,7 @@ org.alfresco alfresco-community-repo-tests - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT diff --git a/packaging/tests/tas-integration/pom.xml b/packaging/tests/tas-integration/pom.xml index 510d51072e5..29f4553b9ea 100644 --- a/packaging/tests/tas-integration/pom.xml +++ b/packaging/tests/tas-integration/pom.xml @@ -9,7 +9,7 @@ org.alfresco alfresco-community-repo-tests - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT diff --git a/packaging/tests/tas-restapi/pom.xml b/packaging/tests/tas-restapi/pom.xml index 9cc3e1bedb6..d01ee59146e 100644 --- a/packaging/tests/tas-restapi/pom.xml +++ b/packaging/tests/tas-restapi/pom.xml @@ -8,7 +8,7 @@ org.alfresco alfresco-community-repo-tests - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT diff --git a/packaging/tests/tas-webdav/pom.xml b/packaging/tests/tas-webdav/pom.xml index 5339315cbdd..d085ec9ac26 100644 --- a/packaging/tests/tas-webdav/pom.xml +++ b/packaging/tests/tas-webdav/pom.xml @@ -9,7 +9,7 @@ org.alfresco alfresco-community-repo-tests - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT diff --git a/packaging/war/pom.xml b/packaging/war/pom.xml index e8554679bbe..6b671fd0702 100644 --- a/packaging/war/pom.xml +++ b/packaging/war/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo-packaging - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT diff --git a/pom.xml b/pom.xml index 93ad2e26e0a..a12a907a87a 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 alfresco-community-repo - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT pom Alfresco Community Repo Parent @@ -58,7 +58,7 @@ 1.9.20.1 6.0.14 - 6.1.4 + 6.2.2 3.5.3 2.15.2 4.0.2 diff --git a/remote-api/pom.xml b/remote-api/pom.xml index e30e0106835..ea87a60493d 100644 --- a/remote-api/pom.xml +++ b/remote-api/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT diff --git a/repository/pom.xml b/repository/pom.xml index 3bab3f4b5cb..081e153a6b4 100644 --- a/repository/pom.xml +++ b/repository/pom.xml @@ -7,7 +7,7 @@ org.alfresco alfresco-community-repo - 23.3.0.7-SNAPSHOT + 23.3.0.9-SNAPSHOT From 473e368a180858767a81adb664cf83ef3f09b4ed Mon Sep 17 00:00:00 2001 From: Mohit Singh Date: Mon, 11 Mar 2024 17:22:28 +0530 Subject: [PATCH 18/21] [MNT-24127] Added endpoint implementation to calculating folder size. --- amps/share-services/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/amps/share-services/pom.xml b/amps/share-services/pom.xml index e15bef6733f..24cf76eed11 100644 --- a/amps/share-services/pom.xml +++ b/amps/share-services/pom.xml @@ -13,7 +13,6 @@ ${project.parent.scm.url} - ${buildNumber} From 2d8231e5508b5ecd8d15249bd1f6daea56e360e4 Mon Sep 17 00:00:00 2001 From: Mohit Singh Date: Tue, 12 Mar 2024 15:55:46 +0530 Subject: [PATCH 19/21] [MNT-24127] Added rest endpoint implementation to calculating folder size --- .../src/main/java/org/alfresco/rest/api/impl/NodesImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 d0c06b872f6..bdde2a72569 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 @@ -32,6 +32,7 @@ import java.io.Serializable; import java.math.BigInteger; import java.nio.charset.Charset; +import java.text.DecimalFormat; import java.util.AbstractList; import java.util.ArrayList; import java.util.Arrays; @@ -3568,9 +3569,10 @@ public Map getFolderSize(String folderNodeId){ String[] sizes = {"Bytes", "KB", "MB", "GB", "TB", "PB"}; int i = (int) Math.floor(Math.log(size) / Math.log(k)); float finalSize = Float.parseFloat(String.valueOf(size / Math.pow(k, i))); + DecimalFormat form = new DecimalFormat("0.00"); Map response = new HashMap<>(); response.put("id", folderNodeId); - response.put("size", String.valueOf(finalSize + " " + sizes[i])); + response.put("size", String.valueOf(form.format(finalSize) + " " + sizes[i])); return response; } From b0d64de3616fec6b9d97b0b0e191d5e9c3aff8af Mon Sep 17 00:00:00 2001 From: Mohit Singh Date: Tue, 12 Mar 2024 18:43:19 +0530 Subject: [PATCH 20/21] [MNT-24127] Added rest endpoint implementation to calculating folder size --- .../org/alfresco/rest/api/impl/NodesImpl.java | 28 +++++++++++-------- .../api/nodes/NodeFolderSizeRelation.java | 2 +- .../RelationshipResourceAction.java | 2 +- .../webscripts/ResourceWebScriptGet.java | 4 +-- 4 files changed, 20 insertions(+), 16 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 bdde2a72569..b553123ac6c 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 @@ -3556,38 +3556,42 @@ public void validateProperties(Map properties, List excl }); } } + /** * - * @param folderNodeId nodeId value. + * @param nodeId nodeId value. */ @Override - public Map getFolderSize(String folderNodeId){ - - NodeRef nodeRef = this.validateNode(folderNodeId); - long size=this.getNodeSize(nodeRef); + public Map getFolderSize(String nodeId) + { + NodeRef nodeRef = validateNode(nodeId); + long size = getNodeSize(nodeRef); int k = 1024; String[] sizes = {"Bytes", "KB", "MB", "GB", "TB", "PB"}; int i = (int) Math.floor(Math.log(size) / Math.log(k)); float finalSize = Float.parseFloat(String.valueOf(size / Math.pow(k, i))); DecimalFormat form = new DecimalFormat("0.00"); Map response = new HashMap<>(); - response.put("id", folderNodeId); + response.put("id", nodeId); response.put("size", String.valueOf(form.format(finalSize) + " " + sizes[i])); return response; } - protected long getNodeSize(NodeRef nodeRef){ - + private long getNodeSize(NodeRef nodeRef) + { long size; - // Collecting current node size. + //Collecting current node size. ContentData contentData = (ContentData) nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT); - try { + try + { size = contentData.getSize(); - } catch (Exception e) { + } catch (Exception e) + { size = 0; } List chilAssocsList = nodeService.getChildAssocs(nodeRef); - for (ChildAssociationRef childAssociationRef : chilAssocsList) { + for (ChildAssociationRef childAssociationRef : chilAssocsList) + { NodeRef childNodeRef = childAssociationRef.getChildRef(); size = size + getNodeSize(childNodeRef); } 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 59a4d21a228..fcb8417ea5c 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 @@ -69,7 +69,7 @@ public void afterPropertiesSet() */ @Override @WebApiDescription(title = "Size of folder",description = "Return a size of folder") - public Map readAll(String nodeId) + public Map readById(String nodeId) { return nodes.getFolderSize(nodeId); } diff --git a/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java b/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java index 443038b230c..376fd7466d0 100644 --- a/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java +++ b/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/RelationshipResourceAction.java @@ -170,6 +170,6 @@ interface FolderSize extends ResourceAction * * @param nodeId Entity resource context for this relationship. */ - E readAll(String nodeId); + E readById(String nodeId); } } 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 f0cf1ef9d53..1238f7a11d9 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 @@ -244,8 +244,8 @@ else if (RelationshipResourceAction.FolderSize.class.isAssignableFrom(resource.g { throw new DeletedResourceException("(GET by id) "+resource.getMetaData().getUniqueId()); } - RelationshipResourceAction.FolderSize> relationGetter = (RelationshipResourceAction.FolderSize>) resource.getResource(); - Object result = relationGetter.readAll(params.getEntityId()); + RelationshipResourceAction.FolderSize relationGetter = (RelationshipResourceAction.FolderSize) resource.getResource(); + Object result = relationGetter.readById(params.getEntityId()); return result; } else From 68153fb1be8c227852adec9b0f5c56c620000821 Mon Sep 17 00:00:00 2001 From: Mohit Singh Date: Tue, 12 Mar 2024 18:55:17 +0530 Subject: [PATCH 21/21] [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());