Merged HEAD (5.2) to 5.2.N (5.2.1)

126348 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)
      118663 jvonka: Merge from DEV/SABRE_JANV1 (part 1)
      File Folder API (PoC - experimental WIP)
      - relates to RA-613
      - initial file folder CRUD including
      - * list folder children (minimal info by default) 
          with sorting, paging & optional isFolder=true/false
      - * create folders or (empty) files
      - * get node info
          with id, name, nodeType, auditable props, properties (not sys:referencable), aspectNames, ...
      - * put node info
      - * put content (upload file)
      - * get content (download file)
      - * delete node (cascade for folder)
      - * support for well-known folder alias, -root-, -my-, -shared-
      - TODO add tests


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126693 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ancuta Morarasu
2016-05-11 10:43:04 +00:00
parent 5e22caad6d
commit 3a5a22da8d
9 changed files with 623 additions and 42 deletions

View File

@@ -1,14 +1,14 @@
/*
* #%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:
*
* #%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
@@ -26,7 +26,12 @@
package org.alfresco.rest.api.nodes;
import org.alfresco.rest.api.Nodes;
import org.alfresco.rest.api.model.Node;
import org.alfresco.rest.framework.WebApiDescription;
import org.alfresco.rest.framework.WebApiParam;
import org.alfresco.rest.framework.resource.EntityResource;
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction;
import org.alfresco.rest.framework.resource.parameters.Parameters;
import org.alfresco.util.ParameterCheck;
import org.springframework.beans.factory.InitializingBean;
@@ -35,9 +40,10 @@ import org.springframework.beans.factory.InitializingBean;
*
* @author sglover
* @author Gethin James
* @author janv
*/
@EntityResource(name="nodes", title = "Nodes")
public class NodesEntityResource implements InitializingBean
public class NodesEntityResource implements EntityResourceAction.ReadById<Node>, EntityResourceAction.Delete, EntityResourceAction.Update<Node>, InitializingBean
{
private Nodes nodes;
@@ -51,4 +57,53 @@ public class NodesEntityResource implements InitializingBean
{
ParameterCheck.mandatory("nodes", this.nodes);
}
/**
* Returns information regarding the node 'nodeId' - folder or document
*
* TODO other metadata/properties & permissions etc ...
*
* @param nodeId String id of node (folder or document) - will also accept well-known aliases, eg. "-root-" or "-my-"
*
* Optional parameters:
* - path
* - incPrimaryPath
*/
@WebApiDescription(title = "Get Node Information", description = "Get information for the node with id 'nodeId'")
@WebApiParam(name = "nodeId", title = "The node id")
public Node readById(String nodeId, Parameters parameters)
{
return nodes.getFolderOrDocument(nodeId, parameters);
}
/**
* Update info on the node 'nodeId' - folder or document
*
* Initially, name, title &/or description. Note: changing name is a "rename" (and must be unique within the current parent folder).
*
* TODO other metadata/properties & permissions etc ...
*
* @param nodeId String nodeId of node (folder or document)
* @param nodeInfo node entity with info to update (eg. name, title, description ...)
* @param parameters
* @return
*/
@Override
@WebApiDescription(title="Updates a node (file or folder) with id 'nodeId'")
public Node update(String nodeId, Node nodeInfo, Parameters parameters)
{
return nodes.updateNode(nodeId, nodeInfo, parameters);
}
/**
* Delete the given node. Note: will cascade delete for a folder.
*
* @param nodeId String id of node (folder or document)
*/
@Override
@WebApiDescription(title = "Delete Node", description="Delete the file or folder with id 'nodeId'. Folder will cascade delete")
public void delete(String nodeId, Parameters parameters)
{
nodes.deleteNode(nodeId);
}
}