mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-01 14:41:46 +00:00
[feature/MNT-24127-EndpointToCalculateFolderSize] Added Endpoint to calculate folder size
This commit is contained in:
@@ -45,6 +45,18 @@ public class FolderSizeImpl {
|
||||
private static final String IN_PROGRESS = "IN-PROGRESS";
|
||||
|
||||
public Map<String, Object> executingAsynchronousFolderAction(final NodeRef nodeRef, final int maxItems, final Map<String, Object> result, final SimpleCache<Serializable, Object> simpleCache)
|
||||
{
|
||||
if(simpleCache.get(nodeRef.getId()) == null)
|
||||
{
|
||||
executeAction(nodeRef, maxItems, simpleCache);
|
||||
}
|
||||
LOG.debug("Executing NodeSizeActionExecuter from executingAsynchronousFolderAction method");
|
||||
|
||||
result.putIfAbsent("nodeId",nodeRef.getId());
|
||||
return result;
|
||||
}
|
||||
|
||||
protected void executeAction(NodeRef nodeRef, int maxItems, SimpleCache<Serializable, Object> simpleCache)
|
||||
{
|
||||
Action folderSizeAction = actionService.createAction(NodeSizeActionExecuter.NAME);
|
||||
folderSizeAction.setTrackStatus(true);
|
||||
@@ -52,10 +64,5 @@ public class FolderSizeImpl {
|
||||
folderSizeAction.setParameterValue(NodeSizeActionExecuter.PAGE_SIZE, maxItems);
|
||||
simpleCache.put(nodeRef.getId(),IN_PROGRESS);
|
||||
actionService.executeAction(folderSizeAction, nodeRef, false, true);
|
||||
|
||||
LOG.debug("Executing NodeSizeActionExecuter from executingAsynchronousFolderAction method");
|
||||
|
||||
result.putIfAbsent("executionId",folderSizeAction.getId());
|
||||
return result;
|
||||
}
|
||||
}
|
@@ -282,7 +282,7 @@ public class ResourceWebScriptGet extends AbstractResourceWebScript implements P
|
||||
if (StringUtils.isNotBlank(params.getEntityId()))
|
||||
{
|
||||
if (EntityResourceAction.RetrieveFolderSize.class.isAssignableFrom(resource.getResource().getClass())
|
||||
&& (GET_FOLDERSIZE.equals(resource.getMetaData().getUniqueId()) || params.getBinaryProperty().equals("get-folder-size")))
|
||||
&& (GET_FOLDERSIZE.equals(resource.getMetaData().getUniqueId())))
|
||||
{
|
||||
if (resource.getMetaData().isDeleted(EntityResourceAction.RetrieveFolderSize.class))
|
||||
{
|
||||
|
@@ -100,9 +100,9 @@ public class NodeFolderSizeApiTest extends AbstractBaseApiTest
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for POST/calculateSize, which calculates Folder Size.
|
||||
* Test case for POST/calculate-folder-size, which calculates Folder Size.
|
||||
* <p>POST:</p>
|
||||
* {@literal <host>:<port>/alfresco/api/<networkId>/public/alfresco/versions/1/nodes/<nodeId>/calculateSize}
|
||||
* {@literal <host>:<port>/alfresco/api/<networkId>/public/alfresco/versions/1/nodes/<nodeId>/calculate-folder-size}
|
||||
*/
|
||||
@Test
|
||||
public void testAPostCalculateFolderSize() throws Exception {
|
||||
@@ -129,9 +129,9 @@ public class NodeFolderSizeApiTest extends AbstractBaseApiTest
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for GET/calculateSize, to retrieve FolderSize.
|
||||
* Test case for GET/get-folder-size, to retrieve FolderSize.
|
||||
* <p>GET:</p>
|
||||
* {@literal <host>:<port>/alfresco/api/<networkId>/public/alfresco/versions/1/nodes/<nodeId>/calculateSize}
|
||||
* {@literal <host>:<port>/alfresco/api/-default-/public/alfresco/versions/1/nodes/<nodeId>/get-folder-size}
|
||||
*/
|
||||
@Test
|
||||
public void testBGetCalculateFolderSize() throws Exception
|
||||
|
@@ -305,6 +305,7 @@ public class PublicApiHttpClient
|
||||
{
|
||||
RestApiEndpoint endpoint = new RestApiEndpoint(c, rq.getNetworkId(), entityId, relationshipEntityId, params);
|
||||
String url = endpoint.getUrl();
|
||||
System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&& "+url+" :: "+entityId);
|
||||
|
||||
GetMethod req = new GetMethod(url);
|
||||
return submitRequest(req, rq);
|
||||
@@ -762,6 +763,7 @@ public class PublicApiHttpClient
|
||||
}
|
||||
|
||||
addParams(sb, params);
|
||||
System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&& 2 "+sb.toString());
|
||||
|
||||
this.url = sb.toString();
|
||||
}
|
||||
|
Reference in New Issue
Block a user