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)
126550 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2) 124200 jvonka: RA-869: Remove "include" processing from "includeSource" entity for /nodes/nodeId/children endpoint git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126896 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -732,15 +732,23 @@ public class NodesImpl implements Nodes
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Node getFolderOrDocumentFullInfo(NodeRef nodeRef, NodeRef parentNodeRef, QName nodeTypeQName, Parameters parameters)
|
private Node getFolderOrDocumentFullInfo(NodeRef nodeRef, NodeRef parentNodeRef, QName nodeTypeQName, Parameters parameters)
|
||||||
|
{
|
||||||
|
return getFolderOrDocumentFullInfo(nodeRef, parentNodeRef, nodeTypeQName, parameters, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Node getFolderOrDocumentFullInfo(NodeRef nodeRef, NodeRef parentNodeRef, QName nodeTypeQName, Parameters parameters, Map<String,UserInfo> mapUserInfo)
|
||||||
{
|
{
|
||||||
List<String> includeParam = new ArrayList<>();
|
List<String> includeParam = new ArrayList<>();
|
||||||
includeParam.addAll(parameters.getInclude());
|
if (parameters != null)
|
||||||
|
{
|
||||||
|
includeParam.addAll(parameters.getInclude());
|
||||||
|
}
|
||||||
|
|
||||||
// Add basic info for single get (above & beyond minimal that is used for listing collections)
|
// Add basic info for single get (above & beyond minimal that is used for listing collections)
|
||||||
includeParam.add(PARAM_INCLUDE_ASPECTNAMES);
|
includeParam.add(PARAM_INCLUDE_ASPECTNAMES);
|
||||||
includeParam.add(PARAM_INCLUDE_PROPERTIES);
|
includeParam.add(PARAM_INCLUDE_PROPERTIES);
|
||||||
|
|
||||||
return getFolderOrDocument(nodeRef, parentNodeRef, nodeTypeQName, includeParam, null);
|
return getFolderOrDocument(nodeRef, parentNodeRef, nodeTypeQName, includeParam, mapUserInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Node getFolderOrDocument(final NodeRef nodeRef, NodeRef parentNodeRef, QName nodeTypeQName, List<String> includeParam, Map<String,UserInfo> mapUserInfo)
|
private Node getFolderOrDocument(final NodeRef nodeRef, NodeRef parentNodeRef, QName nodeTypeQName, List<String> includeParam, Map<String,UserInfo> mapUserInfo)
|
||||||
@@ -866,7 +874,7 @@ public class NodesImpl implements Nodes
|
|||||||
if (permissionService.hasPermission(childNodeRef, PermissionService.READ) == AccessStatus.ALLOWED)
|
if (permissionService.hasPermission(childNodeRef, PermissionService.READ) == AccessStatus.ALLOWED)
|
||||||
{
|
{
|
||||||
Serializable nameProp = nodeService.getProperty(childNodeRef, ContentModel.PROP_NAME);
|
Serializable nameProp = nodeService.getProperty(childNodeRef, ContentModel.PROP_NAME);
|
||||||
pathElements.add(0, new ElementInfo(childNodeRef, nameProp.toString()));
|
pathElements.add(0, new ElementInfo(childNodeRef.getId(), nameProp.toString()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1169,10 +1177,9 @@ public class NodesImpl implements Nodes
|
|||||||
Node sourceEntity = null;
|
Node sourceEntity = null;
|
||||||
if (parameters.includeSource())
|
if (parameters.includeSource())
|
||||||
{
|
{
|
||||||
sourceEntity = getFolderOrDocument(parentNodeRef, null, null, includeParam, mapUserInfo);
|
sourceEntity = getFolderOrDocumentFullInfo(parentNodeRef, null, null, null, mapUserInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return CollectionWithPagingInfo.asPaged(paging, nodes, pagingResults.hasMoreItems(), pagingResults.getTotalResultCount().getFirst(), sourceEntity);
|
return CollectionWithPagingInfo.asPaged(paging, nodes, pagingResults.hasMoreItems(), pagingResults.getTotalResultCount().getFirst(), sourceEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -73,14 +73,14 @@ public class PathInfo
|
|||||||
public static class ElementInfo
|
public static class ElementInfo
|
||||||
{
|
{
|
||||||
|
|
||||||
private NodeRef id;
|
private String id;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
public ElementInfo()
|
public ElementInfo()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElementInfo(NodeRef id, String name)
|
public ElementInfo(String id, String name)
|
||||||
{
|
{
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@@ -91,7 +91,7 @@ public class PathInfo
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NodeRef getId()
|
public String getId()
|
||||||
{
|
{
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@@ -478,17 +478,29 @@ public class NodeApiTest extends AbstractBaseApiTest
|
|||||||
params = new HashMap<>();
|
params = new HashMap<>();
|
||||||
params.put(Nodes.PARAM_RELATIVE_PATH, "User Homes/" + user1 + "/" + folder2);
|
params.put(Nodes.PARAM_RELATIVE_PATH, "User Homes/" + user1 + "/" + folder2);
|
||||||
params.put("includeSource", "true");
|
params.put("includeSource", "true");
|
||||||
|
params.put("include", "path,isLink");
|
||||||
|
params.put("fields", "id");
|
||||||
response = getAll(rootChildrenUrl, user1, paging, params, 200);
|
response = getAll(rootChildrenUrl, user1, paging, params, 200);
|
||||||
jsonResponse = response.getJsonResponse();
|
jsonResponse = response.getJsonResponse();
|
||||||
nodes = RestApiUtil.parseRestApiEntries(jsonResponse, Document.class);
|
nodes = RestApiUtil.parseRestApiEntries(jsonResponse, Document.class);
|
||||||
assertEquals(1, nodes.size());
|
assertEquals(1, nodes.size());
|
||||||
assertEquals(contentF2_Id, nodes.get(0).getId());
|
Document doc = nodes.get(0);
|
||||||
|
assertEquals(contentF2_Id, doc.getId());
|
||||||
|
assertNotNull(doc.getPath());
|
||||||
|
assertEquals(Boolean.FALSE, doc.getIsLink());
|
||||||
|
assertNull(doc.getName());
|
||||||
|
|
||||||
jsonList = (JSONObject)jsonResponse.get("list");
|
jsonList = (JSONObject)jsonResponse.get("list");
|
||||||
assertNotNull(jsonList);
|
assertNotNull(jsonList);
|
||||||
|
|
||||||
|
// source is not affected by include (or fields for that matter) - returns the default node response
|
||||||
Folder src = RestApiUtil.parsePojo("source", jsonList, Folder.class);
|
Folder src = RestApiUtil.parsePojo("source", jsonList, Folder.class);
|
||||||
assertEquals(folder2_Id, src.getId());
|
assertEquals(folder2_Id, src.getId());
|
||||||
|
assertNull(src.getPath());
|
||||||
|
assertNull(src.getIsLink());
|
||||||
|
assertNotNull(src.getName());
|
||||||
|
assertNotNull(src.getAspectNames());
|
||||||
|
assertNotNull(src.getProperties());
|
||||||
|
|
||||||
// -ve test - Invalid QName (Namespace prefix cm... is not mapped to a namespace URI) for the orderBy parameter.
|
// -ve test - Invalid QName (Namespace prefix cm... is not mapped to a namespace URI) for the orderBy parameter.
|
||||||
params = Collections.singletonMap("orderBy", Nodes.PARAM_ISFOLDER+" DESC,cm" + System.currentTimeMillis() + ":modified DESC");
|
params = Collections.singletonMap("orderBy", Nodes.PARAM_ISFOLDER+" DESC,cm" + System.currentTimeMillis() + ":modified DESC");
|
||||||
@@ -614,7 +626,7 @@ public class NodeApiTest extends AbstractBaseApiTest
|
|||||||
|
|
||||||
HttpResponse response = getSingle(NodesEntityResource.class, user1, Nodes.PATH_ROOT, null, 200);
|
HttpResponse response = getSingle(NodesEntityResource.class, user1, Nodes.PATH_ROOT, null, 200);
|
||||||
Node node = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Node.class);
|
Node node = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Node.class);
|
||||||
NodeRef companyHomeNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, node.getId());
|
String rootNodeId = node.getId();
|
||||||
|
|
||||||
response = getSingle(NodesEntityResource.class, user1, Nodes.PATH_MY, null, 200);
|
response = getSingle(NodesEntityResource.class, user1, Nodes.PATH_MY, null, 200);
|
||||||
node = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Node.class);
|
node = RestApiUtil.parseRestApiEntry(response.getJsonResponse(), Node.class);
|
||||||
@@ -685,11 +697,11 @@ public class NodeApiTest extends AbstractBaseApiTest
|
|||||||
// Expected path ...
|
// Expected path ...
|
||||||
// note: the pathInfo should only include the parents (not the requested node)
|
// note: the pathInfo should only include the parents (not the requested node)
|
||||||
List<ElementInfo> elements = new ArrayList<>(5);
|
List<ElementInfo> elements = new ArrayList<>(5);
|
||||||
elements.add(new ElementInfo(companyHomeNodeRef, "Company Home"));
|
elements.add(new ElementInfo(rootNodeId, "Company Home"));
|
||||||
elements.add(new ElementInfo(new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, userHomesId), "User Homes"));
|
elements.add(new ElementInfo(userHomesId, "User Homes"));
|
||||||
elements.add(new ElementInfo(new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, myFilesNodeId), user1));
|
elements.add(new ElementInfo(myFilesNodeId, user1));
|
||||||
elements.add(new ElementInfo(new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, folderA_Id), folderA));
|
elements.add(new ElementInfo(folderA_Id, folderA));
|
||||||
elements.add(new ElementInfo(new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, folderB_Id), folderB));
|
elements.add(new ElementInfo(folderB_Id, folderB));
|
||||||
PathInfo expectedPath = new PathInfo("/Company Home/User Homes/"+user1+"/"+folderA+"/"+folderB, true, elements);
|
PathInfo expectedPath = new PathInfo("/Company Home/User Homes/"+user1+"/"+folderA+"/"+folderB, true, elements);
|
||||||
d1.setPath(expectedPath);
|
d1.setPath(expectedPath);
|
||||||
|
|
||||||
@@ -1093,7 +1105,7 @@ public class NodeApiTest extends AbstractBaseApiTest
|
|||||||
assertNotNull(elementInfos);
|
assertNotNull(elementInfos);
|
||||||
// /Company Home/Sites/RandomSite<timestamp>/documentLibrary/folder<timestamp>_A/X/Y/Z
|
// /Company Home/Sites/RandomSite<timestamp>/documentLibrary/folder<timestamp>_A/X/Y/Z
|
||||||
assertEquals(8, elementInfos.size());
|
assertEquals(8, elementInfos.size());
|
||||||
assertEquals(document.getParentId(), elementInfos.get(7).getId().getId());
|
assertEquals(document.getParentId(), elementInfos.get(7).getId());
|
||||||
assertEquals("Z", elementInfos.get(7).getName());
|
assertEquals("Z", elementInfos.get(7).getName());
|
||||||
assertEquals("Y", elementInfos.get(6).getName());
|
assertEquals("Y", elementInfos.get(6).getName());
|
||||||
assertEquals("X", elementInfos.get(5).getName());
|
assertEquals("X", elementInfos.get(5).getName());
|
||||||
|
@@ -67,14 +67,14 @@ public class PathInfo
|
|||||||
|
|
||||||
public static class ElementInfo
|
public static class ElementInfo
|
||||||
{
|
{
|
||||||
private NodeRef id;
|
private String id;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
public ElementInfo()
|
public ElementInfo()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElementInfo(NodeRef id, String name)
|
public ElementInfo(String id, String name)
|
||||||
{
|
{
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@@ -85,7 +85,7 @@ public class PathInfo
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NodeRef getId()
|
public String getId()
|
||||||
{
|
{
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user