diff --git a/remote-api/src/main/java/org/alfresco/rest/api/nodes/NodesEntityResource.java b/remote-api/src/main/java/org/alfresco/rest/api/nodes/NodesEntityResource.java index 21d426f7f2..6298abc252 100644 --- a/remote-api/src/main/java/org/alfresco/rest/api/nodes/NodesEntityResource.java +++ b/remote-api/src/main/java/org/alfresco/rest/api/nodes/NodesEntityResource.java @@ -78,7 +78,7 @@ import org.springframework.extensions.webscripts.Status; @EntityResource(name="nodes", title = "Nodes") public class NodesEntityResource implements EntityResourceAction.ReadById, EntityResourceAction.Delete, EntityResourceAction.Update, - BinaryResourceAction.Read, BinaryResourceAction.Update, InitializingBean + BinaryResourceAction.Read, BinaryResourceAction.Update, EntityResourceAction.RetrieveFolderSize>, InitializingBean { private static final Logger LOG = LoggerFactory.getLogger(NodesEntityResource.class); @@ -88,6 +88,7 @@ public class NodesEntityResource implements private static final String STATUS = "status"; private static final String COMPLETED = "Completed"; private static final String FOLDER = "folder"; + private Nodes nodes; private DirectAccessUrlHelper directAccessUrlHelper; private SearchService searchService; @@ -317,11 +318,13 @@ public class NodesEntityResource implements throw new AlfrescoRuntimeException("Exception occurred in NodesEntityResource:createById",alfrescoRuntimeError); } } - @Operation("get-folder-size") + @Override + @BinaryProperties({"get-folder-size"}) @WebApiDescription(title = "Returns Folder Node Size", description = "Returning a Folder Node Size") @WebApiParameters({@WebApiParam(name = "nodeId", title = "The unique id of Execution Job", description = "A single nodeId")}) - public Map getFolderSize(String nodeId, Void ignore, Parameters parameters, WithResponse withResponse) + public Map getFolderSize(String nodeId, Parameters parameters) throws EntityNotFoundException { + try { LOG.debug("Retrieving OUTPUT from NodeSizeActionExecutor - NodesEntityResource:readById"); 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 7fec9ef5b3..3cbc45e1b6 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 @@ -110,6 +110,8 @@ public class ResourceInspector ALL_ENTITY_RESOURCE_INTERFACES.add(MultiPartResourceAction.Create.class); + ALL_ENTITY_RESOURCE_INTERFACES.add(EntityResourceAction.RetrieveFolderSize.class); + ALL_RELATIONSHIP_RESOURCE_INTERFACES.add(RelationshipResourceAction.Create.class); ALL_RELATIONSHIP_RESOURCE_INTERFACES.add(RelationshipResourceAction.Read.class); ALL_RELATIONSHIP_RESOURCE_INTERFACES.add(RelationshipResourceAction.ReadById.class); @@ -163,6 +165,7 @@ public class ResourceInspector findOperation(EntityResourceAction.UpdateWithResponse.class, PUT, helper); findOperation(EntityResourceAction.DeleteWithResponse.class, DELETE, helper); findOperation(EntityResourceAction.DeleteSetWithResponse.class, DELETE, helper); + findOperation(EntityResourceAction.RetrieveFolderSize.class, GET, helper); findOperation(MultiPartResourceAction.Create.class, POST, helper); @@ -725,15 +728,7 @@ public class ResourceInspector Map annotAttribs = AnnotationUtils.getAnnotationAttributes(annot); String actionName = String.valueOf(annotAttribs.get("value")); String actionPath = ResourceDictionary.propertyResourceKey(entityPath, actionName); - ResourceOperation ro; - if("/nodes/{id}/get-folder-size".equals(actionPath)) - { - ro = inspectOperation(anyClass, annotatedMethod, GET); - } - else - { - ro = inspectOperation(anyClass, annotatedMethod, POST); - } + ResourceOperation ro = inspectOperation(anyClass, annotatedMethod, POST); embeds.put(actionPath, new Pair(ro, annotatedMethod)); } } diff --git a/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/EntityResourceAction.java b/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/EntityResourceAction.java index 029b2b75e3..a3a692baf8 100644 --- a/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/EntityResourceAction.java +++ b/remote-api/src/main/java/org/alfresco/rest/framework/resource/actions/interfaces/EntityResourceAction.java @@ -161,4 +161,14 @@ public interface EntityResourceAction */ public void deleteSet(Parameters params, WithResponse withResponse); } + public static interface RetrieveFolderSize extends ResourceAction + { + /** + * get the size of Folder Node. + * + * @param nodeId Entity resource context for this relationship. + * @param params implementation may choose to restrict the set to be deleted based on params (ie. not necessarily "all") + */ + public E getFolderSize (String nodeId, Parameters parameters); + } }