Merged HEAD (5.2) to 5.2.N (5.2.1)

127589 jkaabimofrad: Merged API-STRIKES-BACK (5.2.0) to HEAD (5.2)
      127094 jvonka: Node Associations - child assocs - isPrimary filter (for /parents and /children)
      - RA-1053


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@127681 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2016-06-03 14:16:16 +00:00
parent 8ccacdd032
commit 9ebd44552d
5 changed files with 139 additions and 12 deletions

View File

@@ -36,6 +36,8 @@ import org.alfresco.repo.content.ContentLimitViolationException;
import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.model.Repository;
import org.alfresco.repo.model.filefolder.FileFolderServiceImpl;
import org.alfresco.repo.node.getchildren.FilterProp;
import org.alfresco.repo.node.getchildren.FilterPropBoolean;
import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery;
import org.alfresco.repo.policy.BehaviourFilter;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
@@ -334,7 +336,7 @@ public class NodesImpl implements Nodes
// list children filtering (via where clause)
private final static Set<String> LIST_FOLDER_CHILDREN_EQUALS_QUERY_PROPERTIES =
new HashSet<>(Arrays.asList(new String[] {PARAM_ISFOLDER, PARAM_ISFILE, PARAM_NODETYPE}));
new HashSet<>(Arrays.asList(new String[] {PARAM_ISFOLDER, PARAM_ISFILE, PARAM_NODETYPE, PARAM_ISPRIMARY}));
/*
* Validates that node exists.
@@ -1158,9 +1160,10 @@ public class NodesImpl implements Nodes
final List<String> includeParam = parameters.getInclude();
// filters
Boolean includeFolders = null;
Boolean includeFiles = null;
Boolean isPrimary = null;
QName filterNodeTypeQName = null;
// note: for files/folders, include subtypes by default (unless filtering by a specific nodeType - see below)
@@ -1174,6 +1177,8 @@ public class NodesImpl implements Nodes
MapBasedQueryWalker propertyWalker = new MapBasedQueryWalker(LIST_FOLDER_CHILDREN_EQUALS_QUERY_PROPERTIES, null);
QueryHelper.walk(q, propertyWalker);
isPrimary = propertyWalker.getProperty(PARAM_ISPRIMARY, WhereClauseParser.EQUALS, Boolean.class);
Boolean isFolder = propertyWalker.getProperty(PARAM_ISFOLDER, WhereClauseParser.EQUALS, Boolean.class);
Boolean isFile = propertyWalker.getProperty(PARAM_ISFILE, WhereClauseParser.EQUALS, Boolean.class);
@@ -1234,6 +1239,13 @@ public class NodesImpl implements Nodes
new Pair<>(ContentModel.PROP_NAME, true)));
}
List<FilterProp> filterProps = null;
if (isPrimary != null)
{
filterProps = new ArrayList<>(1);
filterProps.add(new FilterPropBoolean(GetChildrenCannedQuery.FILTER_QNAME_NODE_IS_PRIMARY, isPrimary));
}
Paging paging = parameters.getPaging();
PagingRequest pagingRequest = Util.getPagingRequest(paging);
@@ -1279,7 +1291,7 @@ public class NodesImpl implements Nodes
Set<QName> searchTypeQNames = pair.getFirst();
Set<QName> ignoreAspectQNames = pair.getSecond();
pagingResults = fileFolderService.list(parentNodeRef, searchTypeQNames, ignoreAspectQNames, sortProps, pagingRequest);
pagingResults = fileFolderService.list(parentNodeRef, searchTypeQNames, ignoreAspectQNames, sortProps, filterProps, pagingRequest);
final Map<String, UserInfo> mapUserInfo = new HashMap<>(10);