mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
ALF-7167: RINF 11: Canned queries
- ALF-9322: RINF 11: AbstractCannedQueryPermissions enhancements - Pulled in logic around hasMore() so that subclasses just have to obey - Added in cut-off size estimates - ALF-9337: RINF 11: Consolidate interceptor wrappers - Permissions respect PermissionCheckedValue - Added last-in-chain "afterAclMarking" to "afterInvocationManager": marks collections as checked - Added 'mixin' interfaces to handle input and output for permission checking of collections git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28734 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -48,9 +48,9 @@ import org.alfresco.repo.domain.node.ReferenceablePropertiesEntity;
|
||||
import org.alfresco.repo.domain.qname.QNameDAO;
|
||||
import org.alfresco.repo.domain.query.CannedQueryDAO;
|
||||
import org.alfresco.repo.node.getchildren.FilterPropString.FilterTypeString;
|
||||
import org.alfresco.repo.security.permissions.PermissionCheckedValue.PermissionCheckedValueMixin;
|
||||
import org.alfresco.repo.security.permissions.impl.acegi.AbstractCannedQueryPermissions;
|
||||
import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityBean;
|
||||
import org.alfresco.repo.security.permissions.impl.acegi.WrappedList;
|
||||
import org.alfresco.repo.tenant.TenantService;
|
||||
import org.alfresco.service.cmr.repository.ContentData;
|
||||
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
||||
@@ -156,7 +156,7 @@ public class GetChildrenCannedQuery extends AbstractCannedQueryPermissions<NodeR
|
||||
|
||||
// Get sort details
|
||||
CannedQuerySortDetails sortDetails = parameters.getSortDetails();
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
final List<Pair<QName, SortOrder>> sortPairs = (List)sortDetails.getSortPairs();
|
||||
|
||||
// Set sort / filter params
|
||||
@@ -234,21 +234,9 @@ public class GetChildrenCannedQuery extends AbstractCannedQueryPermissions<NodeR
|
||||
{
|
||||
// unsorted (apart from any implicit order) - note: permissions are applied during result handling to allow early cutoff
|
||||
|
||||
int requestedCount = parameters.getPageDetails().getResultsRequiredForPaging();
|
||||
int requestTotalCountMax = getParameters().requestTotalResultCountMax();
|
||||
|
||||
if ((requestTotalCountMax > 0) && (requestTotalCountMax > requestedCount))
|
||||
{
|
||||
requestedCount = requestTotalCountMax;
|
||||
}
|
||||
|
||||
if (requestedCount != Integer.MAX_VALUE)
|
||||
{
|
||||
requestedCount++; // add one for "hasMoreItems"
|
||||
}
|
||||
|
||||
final WrappedList<NodeRef> rawResult = new WrappedList<NodeRef>(new ArrayList<NodeRef>(100), requestedCount);
|
||||
final int requestedCount = parameters.getResultsRequired();
|
||||
|
||||
final List<NodeRef> rawResult = new ArrayList<NodeRef>(Math.min(1000, requestedCount));
|
||||
UnsortedChildQueryCallback callback = new UnsortedChildQueryCallback()
|
||||
{
|
||||
public boolean handle(NodeRef nodeRef)
|
||||
@@ -256,7 +244,7 @@ public class GetChildrenCannedQuery extends AbstractCannedQueryPermissions<NodeR
|
||||
rawResult.add(tenantService.getBaseName(nodeRef));
|
||||
|
||||
// More results ?
|
||||
return (rawResult.size() < rawResult.getMaxChecks());
|
||||
return (rawResult.size() < requestedCount);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -265,7 +253,7 @@ public class GetChildrenCannedQuery extends AbstractCannedQueryPermissions<NodeR
|
||||
resultHandler.done();
|
||||
|
||||
// permissions have been applied
|
||||
result = new WrappedList<NodeRef>(rawResult.getWrapped(), true, (rawResult.size() == requestedCount));
|
||||
result = PermissionCheckedValueMixin.create(rawResult);
|
||||
}
|
||||
|
||||
if (start != null)
|
||||
@@ -482,7 +470,7 @@ public class GetChildrenCannedQuery extends AbstractCannedQueryPermissions<NodeR
|
||||
{
|
||||
Long start = (logger.isDebugEnabled() ? System.currentTimeMillis() : null);
|
||||
|
||||
int requestTotalCountMax = getParameters().requestTotalResultCountMax();
|
||||
int requestTotalCountMax = getParameters().getTotalResultCountMax();
|
||||
int maxChecks = (((requestTotalCountMax > 0) && (requestTotalCountMax > requestedCount)) ? requestTotalCountMax : requestedCount);
|
||||
int cnt = results.size();
|
||||
|
||||
@@ -693,7 +681,7 @@ public class GetChildrenCannedQuery extends AbstractCannedQueryPermissions<NodeR
|
||||
preload(nodeRefs);
|
||||
|
||||
// TODO track total time for incremental permission checks ... and cutoff (eg. based on some config)
|
||||
List<NodeRef> results = applyPermissions(nodeRefs, nodeRefs.size());
|
||||
List<NodeRef> results = applyPostQueryPermissions(nodeRefs, nodeRefs.size());
|
||||
|
||||
for (NodeRef nodeRef : results)
|
||||
{
|
||||
|
Reference in New Issue
Block a user