mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged HEAD (5.2) to 5.2.N (5.2.1)
126441 jkaabimofrad: 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/BRANCHES/DEV/5.2.N/root@126787 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1077,6 +1077,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);
|
||||
|
||||
|
@@ -299,20 +299,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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user