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

122978 jvonka: RA-766: Update REST fwk - implement "include" query param (used by nodes & shared-links) and deprecate "select" (still used by tasks & cmm).


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@126520 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jamal Kaabi-Mofrad
2016-05-10 11:19:16 +00:00
parent f5212b0c8c
commit a2541568a8
13 changed files with 282 additions and 158 deletions

View File

@@ -648,14 +648,14 @@ public class NodesImpl implements Nodes
private Node getFolderOrDocumentFullInfo(NodeRef nodeRef, NodeRef parentNodeRef, QName nodeTypeQName, Parameters parameters)
{
List<String> selectParam = new ArrayList<>();
selectParam.addAll(parameters.getSelectedProperties());
List<String> includeParam = new ArrayList<>();
includeParam.addAll(parameters.getInclude());
// Add basic info for single get (above & beyond minimal that is used for listing collections)
selectParam.add(PARAM_SELECT_ASPECTNAMES);
selectParam.add(PARAM_SELECT_PROPERTIES);
includeParam.add(PARAM_INCLUDE_ASPECTNAMES);
includeParam.add(PARAM_INCLUDE_PROPERTIES);
return getFolderOrDocument(nodeRef, parentNodeRef, nodeTypeQName, selectParam, null);
return getFolderOrDocument(nodeRef, parentNodeRef, nodeTypeQName, includeParam, null);
}
private Node getFolderOrDocument(final NodeRef nodeRef, NodeRef parentNodeRef, QName nodeTypeQName, List<String> selectParam, Map<String,UserInfo> mapUserInfo)
@@ -666,7 +666,7 @@ public class NodesImpl implements Nodes
}
PathInfo pathInfo = null;
if (selectParam.contains(PARAM_SELECT_PATH))
if (selectParam.contains(PARAM_INCLUDE_PATH))
{
pathInfo = lookupPathInfo(nodeRef);
}
@@ -712,12 +712,12 @@ public class NodesImpl implements Nodes
node.setProperties(mapFromNodeProperties(properties, selectParam, mapUserInfo));
}
if (selectParam.contains(PARAM_SELECT_ASPECTNAMES))
if (selectParam.contains(PARAM_INCLUDE_ASPECTNAMES))
{
node.setAspectNames(mapFromNodeAspects(nodeService.getAspects(nodeRef)));
}
if (selectParam.contains(PARAM_SELECT_ISLINK))
if (selectParam.contains(PARAM_INCLUDE_ISLINK))
{
boolean isLink = isSubClass(nodeTypeQName, ContentModel.TYPE_LINK);
node.setIsLink(isLink);
@@ -845,7 +845,7 @@ public class NodesImpl implements Nodes
{
List<QName> selectedProperties;
if ((selectParam.size() == 0) || selectParam.contains(PARAM_SELECT_PROPERTIES))
if ((selectParam.size() == 0) || selectParam.contains(PARAM_INCLUDE_PROPERTIES))
{
// return all properties
selectedProperties = new ArrayList<>(nodeProps.size());
@@ -922,7 +922,7 @@ public class NodesImpl implements Nodes
throw new InvalidArgumentException("NodeId of folder is expected: " + parentNodeRef.getId());
}
final List<String> selectParam = parameters.getSelectedProperties();
final List<String> includeParam = parameters.getInclude();
boolean includeFolders = true;
boolean includeFiles = true;
@@ -1031,7 +1031,7 @@ public class NodesImpl implements Nodes
FileInfo fInfo = page.get(index);
// minimal info by default (unless "select"ed otherwise)
return getFolderOrDocument(fInfo.getNodeRef(), parentNodeRef, fInfo.getType(), selectParam, mapUserInfo);
return getFolderOrDocument(fInfo.getNodeRef(), parentNodeRef, fInfo.getType(), includeParam, mapUserInfo);
}
@Override
@@ -1044,7 +1044,7 @@ public class NodesImpl implements Nodes
Node sourceEntity = null;
if (parameters.includeSource())
{
sourceEntity = getFolderOrDocument(parentNodeRef, null, null, selectParam, mapUserInfo);
sourceEntity = getFolderOrDocument(parentNodeRef, null, null, includeParam, mapUserInfo);
}
@@ -1906,7 +1906,7 @@ public class NodesImpl implements Nodes
*/
protected List<QName> createQNames(List<String> qnameStrList)
{
String PREFIX = PARAM_SELECT_PROPERTIES+"/";
String PREFIX = PARAM_INCLUDE_PROPERTIES +"/";
List<QName> result = new ArrayList<>(qnameStrList.size());
for (String str : qnameStrList)