mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-21 18:09:20 +00:00
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:
@@ -190,10 +190,10 @@ public interface Nodes
|
||||
String PARAM_AUTO_RENAME = "autoRename";
|
||||
String PARAM_PERMANENT = "permanent";
|
||||
|
||||
String PARAM_SELECT_PROPERTIES = "properties";
|
||||
String PARAM_SELECT_PATH = "path";
|
||||
String PARAM_SELECT_ASPECTNAMES = "aspectNames";
|
||||
String PARAM_SELECT_ISLINK = "isLink";
|
||||
String PARAM_INCLUDE_PROPERTIES = "properties";
|
||||
String PARAM_INCLUDE_PATH = "path";
|
||||
String PARAM_INCLUDE_ASPECTNAMES = "aspectNames";
|
||||
String PARAM_INCLUDE_ISLINK = "isLink";
|
||||
|
||||
String PARAM_ISFOLDER = "isFolder";
|
||||
String PARAM_ISFILE = "isFile";
|
||||
|
@@ -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)
|
||||
|
@@ -78,9 +78,7 @@ import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
import org.springframework.extensions.webscripts.WebScriptException;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -184,7 +182,7 @@ public class QuickShareLinksImpl implements QuickShareLinks, InitializingBean
|
||||
{
|
||||
public QuickShareLink doWork() throws Exception
|
||||
{
|
||||
return getQuickShareInfo(sharedId, noAuth, parameters.getSelectedProperties());
|
||||
return getQuickShareInfo(sharedId, noAuth, parameters.getInclude());
|
||||
}
|
||||
}, networkTenantDomain);
|
||||
}
|
||||
@@ -309,7 +307,7 @@ public class QuickShareLinksImpl implements QuickShareLinks, InitializingBean
|
||||
|
||||
boolean noAuth = (AuthenticationUtil.getRunAsUser() == null);
|
||||
|
||||
List<String> selectParam = parameters.getSelectedProperties();
|
||||
List<String> includeParam = parameters.getInclude();
|
||||
|
||||
for (QuickShareLink qs : nodeIds)
|
||||
{
|
||||
@@ -336,7 +334,7 @@ public class QuickShareLinksImpl implements QuickShareLinks, InitializingBean
|
||||
try
|
||||
{
|
||||
QuickShareDTO qsDto = quickShareService.shareContent(nodeRef);
|
||||
result.add(getQuickShareInfo(qsDto.getId(), noAuth, selectParam));
|
||||
result.add(getQuickShareInfo(qsDto.getId(), noAuth, includeParam));
|
||||
}
|
||||
catch (InvalidNodeRefException inre)
|
||||
{
|
||||
@@ -444,12 +442,12 @@ public class QuickShareLinksImpl implements QuickShareLinks, InitializingBean
|
||||
|
||||
List<QuickShareLink> qsLinks = new ArrayList<>(results.length());
|
||||
|
||||
List<String> selectParam = parameters.getSelectedProperties();
|
||||
List<String> includeParam = parameters.getInclude();
|
||||
|
||||
for (ResultSetRow row : results)
|
||||
{
|
||||
NodeRef nodeRef = row.getNodeRef();
|
||||
qsLinks.add(getQuickShareInfo(nodeRef, false, selectParam));
|
||||
qsLinks.add(getQuickShareInfo(nodeRef, false, includeParam));
|
||||
}
|
||||
|
||||
results.close();
|
||||
|
Reference in New Issue
Block a user