mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)
121926 jvonka: Nodes (File/Folder) API - prevent move via PUT (change of parentId) - will be replaced shortly by POST /nodes/{nodeId}/move (RA-806) RA-683 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@126440 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1236,8 +1236,8 @@ public class NodesImpl implements Nodes
|
|||||||
|
|
||||||
if (! currentParentNodeRef.equals(parentNodeRef))
|
if (! currentParentNodeRef.equals(parentNodeRef))
|
||||||
{
|
{
|
||||||
// move/rename - with exception mapping
|
//moveOrCopy(nodeRef, parentNodeRef, name, false); // not currently supported - client should use explicit POST /move operation instead
|
||||||
moveOrCopy(nodeRef, parentNodeRef, name, false);
|
throw new InvalidArgumentException("Cannot update parentId of "+nodeId+" via PUT /nodes/{nodeId}. Please use explicit POST /nodes/{nodeId}/move operation instead");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1066,6 +1066,10 @@ public class NodeApiTest extends AbstractBaseApiTest
|
|||||||
* <p>PUT:</p>
|
* <p>PUT:</p>
|
||||||
* {@literal <host>:<port>/alfresco/api/-default-/public/alfresco/versions/1/nodes/<nodeId>}
|
* {@literal <host>:<port>/alfresco/api/-default-/public/alfresco/versions/1/nodes/<nodeId>}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// TODO update these tests for RA-806 (ie. use "POST /nodes/{nodeId}/move" instead of "PUT /nodes/{nodeId}")
|
||||||
|
|
||||||
|
/*
|
||||||
@Test
|
@Test
|
||||||
public void testMove() throws Exception
|
public void testMove() throws Exception
|
||||||
{
|
{
|
||||||
@@ -1165,6 +1169,7 @@ public class NodeApiTest extends AbstractBaseApiTest
|
|||||||
put("nodes", user2, f1Id, toJsonAsStringNonNull(dUpdate), null, 403);
|
put("nodes", user2, f1Id, toJsonAsStringNonNull(dUpdate), null, 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests copy (file or folder)
|
* Tests copy (file or folder)
|
||||||
* <p>PUT:</p>
|
* <p>PUT:</p>
|
||||||
@@ -1772,6 +1777,20 @@ public class NodeApiTest extends AbstractBaseApiTest
|
|||||||
fUpdate = new Folder();
|
fUpdate = new Folder();
|
||||||
fUpdate.setNodeType("cm:folder");
|
fUpdate.setNodeType("cm:folder");
|
||||||
put("nodes", user1, fId, toJsonAsStringNonNull(fUpdate), null, 400);
|
put("nodes", user1, fId, toJsonAsStringNonNull(fUpdate), null, 400);
|
||||||
|
|
||||||
|
// -ve test - try to move to a different parent using PUT (note: should use new POST /nodes/{nodeId}/move operation instead)
|
||||||
|
|
||||||
|
folderResp = createFolder(user1, myNodeId, "folder 2");
|
||||||
|
String f2Id = folderResp.getId();
|
||||||
|
|
||||||
|
fUpdate = new Folder();
|
||||||
|
fUpdate.setParentId(f2Id);
|
||||||
|
put("nodes", user1, fId, toJsonAsStringNonNull(fUpdate), null, 400);
|
||||||
|
|
||||||
|
// ok - if parent does not change
|
||||||
|
fUpdate = new Folder();
|
||||||
|
fUpdate.setParentId(myNodeId);
|
||||||
|
put("nodes", user1, fId, toJsonAsStringNonNull(fUpdate), null, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1895,8 +1914,6 @@ public class NodeApiTest extends AbstractBaseApiTest
|
|||||||
assertNotNull(content, response.getResponse());
|
assertNotNull(content, response.getResponse());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO add test to create multiple folders & empty files (within same parent folder)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests download of file/content.
|
* Tests download of file/content.
|
||||||
* <p>GET:</p>
|
* <p>GET:</p>
|
||||||
|
Reference in New Issue
Block a user