Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)

121928 jvonka: Nodes (File/Folder) API - minor cleanup (remove experimental code)
   - will be replaced by move/copy operations (and also batch/bulk operation in the future)
   RA-684 RA-806, RA-668


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@126441 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jamal Kaabi-Mofrad
2016-05-10 10:55:39 +00:00
parent 6775385f1f
commit 6e89ab1ea3
3 changed files with 6 additions and 50 deletions

View File

@@ -1070,6 +1070,11 @@ public class NodesImpl implements Nodes
// TODO should we able to specify content properties (eg. mimeType ... or use extension for now, or encoding)
public Node createNode(String parentFolderNodeId, Node nodeInfo, Parameters parameters)
{
if (nodeInfo.getNodeRef() != null)
{
throw new InvalidArgumentException("Unexpected id when trying to create a new node: "+nodeInfo.getNodeRef());
}
// check that requested parent node exists and it's type is a (sub-)type of folder
final NodeRef parentNodeRef = validateOrLookupNode(parentFolderNodeId, null);

View File

@@ -292,20 +292,6 @@ public class Node implements Comparable<Node>
}
// TODO experimental (API subject to change) - special property (request-only) to allow move/copy via POST /nodes/{id}/children
protected String action;
public String getAction()
{
return action;
}
public void setAction(String action)
{
this.action = action;
}
// TODO for backwards compat' - set explicitly when needed (ie. favourites) (note: we could choose to have separate old Node/NodeImpl etc)
protected String title;

View File

@@ -25,7 +25,6 @@ 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.core.exceptions.InvalidArgumentException;
import org.alfresco.rest.framework.resource.RelationshipResource;
import org.alfresco.rest.framework.resource.actions.interfaces.MultiPartRelationshipResourceAction;
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
@@ -101,45 +100,11 @@ public class NodeChildrenRelation implements RelationshipResourceAction.Read<Nod
{
List<Node> result = new ArrayList<>(nodeInfos.size());
// TODO experimental (API subject to change) - eg. this may move to a separate endpoint !
for (Node nodeInfo : nodeInfos)
{
String action = nodeInfo.getAction();
if (action != null)
{
String sourceNodeId = nodeInfo.getNodeRef().getId();
String optionalName = nodeInfo.getName();
if (action.equalsIgnoreCase("move"))
{
result.add(nodes.moveNode(sourceNodeId, parentFolderNodeId, optionalName, parameters));
}
else if (action.equalsIgnoreCase("copy"))
{
result.add(nodes.copyNode(sourceNodeId, parentFolderNodeId, optionalName, parameters));
}
else
{
throw new InvalidArgumentException("Unknown action: "+action);
}
}
else
{
if (nodeInfo.getNodeRef() != null)
{
throw new InvalidArgumentException("Unexpected id without action, eg. move/copy: "+nodeInfo.getNodeRef());
}
result.add(nodes.createNode(parentFolderNodeId, nodeInfo, parameters));
}
}
/*
// TODO should we prevent batch create when we introduce new batch/bulk operation API ?
for (Node nodeInfo : nodeInfos)
{
result.add(nodes.createNode(parentFolderNodeId, nodeInfo, parameters));
}
*/
return result;
}