mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
125603 rmunteanu: Merged 5.1.1 (5.1.1) to 5.1.N (5.1.2) 125484 slanglois: MNT-16155 Update source headers - remove old Copyrights from Java and JSP dource files git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@125781 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
96 lines
3.7 KiB
Java
96 lines
3.7 KiB
Java
package org.alfresco.repo.node;
|
|
|
|
import java.util.Set;
|
|
|
|
import org.alfresco.query.AbstractCannedQueryFactory;
|
|
import org.alfresco.query.CannedQuery;
|
|
import org.alfresco.query.CannedQueryPageDetails;
|
|
import org.alfresco.query.CannedQueryParameters;
|
|
import org.alfresco.query.PagingRequest;
|
|
import org.alfresco.repo.domain.node.NodeDAO;
|
|
import org.alfresco.repo.security.permissions.impl.acegi.MethodSecurityBean;
|
|
import org.alfresco.repo.tenant.TenantService;
|
|
import org.alfresco.service.cmr.repository.NodeRef;
|
|
import org.alfresco.service.cmr.repository.StoreRef;
|
|
import org.alfresco.service.namespace.QName;
|
|
import org.alfresco.util.ParameterCheck;
|
|
import org.alfresco.util.PropertyCheck;
|
|
|
|
/**
|
|
* GetNodesWithAspectCannedQuery canned query factory - to get paged list of
|
|
* Nodes with a given Aspect
|
|
*
|
|
* @author Nick Burch
|
|
* @since 4.1
|
|
*/
|
|
public class GetNodesWithAspectCannedQueryFactory extends AbstractCannedQueryFactory<NodeRef>
|
|
{
|
|
private NodeDAO nodeDAO;
|
|
private TenantService tenantService;
|
|
|
|
private MethodSecurityBean<NodeRef> methodSecurity;
|
|
|
|
public void setNodeDAO(NodeDAO nodeDAO)
|
|
{
|
|
this.nodeDAO = nodeDAO;
|
|
}
|
|
|
|
public void setTenantService(TenantService tenantService)
|
|
{
|
|
this.tenantService = tenantService;
|
|
}
|
|
|
|
public void setMethodSecurity(MethodSecurityBean<NodeRef> methodSecurity)
|
|
{
|
|
this.methodSecurity = methodSecurity;
|
|
}
|
|
|
|
@Override
|
|
public CannedQuery<NodeRef> getCannedQuery(CannedQueryParameters parameters)
|
|
{
|
|
return (CannedQuery<NodeRef>) new GetNodesWithAspectCannedQuery(nodeDAO, tenantService, methodSecurity, parameters);
|
|
}
|
|
|
|
/**
|
|
* Retrieve an unsorted instance of a {@link CannedQuery} based on parameters including
|
|
* request for a total count (up to a given max)
|
|
*
|
|
* @param storeRef the store to search in, if requested
|
|
* @param aspectQNames qnames of aspects to search for
|
|
* @param pagingRequest skipCount, maxItems - optionally queryExecutionId and requestTotalCountMax
|
|
*
|
|
* @return an implementation that will execute the query
|
|
*/
|
|
public CannedQuery<NodeRef> getCannedQuery(StoreRef storeRef, Set<QName> aspectQNames, PagingRequest pagingRequest)
|
|
{
|
|
ParameterCheck.mandatory("aspectQNames", aspectQNames);
|
|
ParameterCheck.mandatory("pagingRequest", pagingRequest);
|
|
|
|
int requestTotalCountMax = pagingRequest.getRequestTotalCountMax();
|
|
|
|
// specific query params - context (parent) and inclusive filters (child types, property values)
|
|
GetNodesWithAspectCannedQueryParams paramBean = new GetNodesWithAspectCannedQueryParams(storeRef, aspectQNames);
|
|
|
|
// page details
|
|
CannedQueryPageDetails cqpd = new CannedQueryPageDetails(pagingRequest.getSkipCount(), pagingRequest.getMaxItems(), CannedQueryPageDetails.DEFAULT_PAGE_NUMBER, CannedQueryPageDetails.DEFAULT_PAGE_COUNT);
|
|
|
|
// no sort details - no sorting done
|
|
|
|
// create query params holder
|
|
CannedQueryParameters params = new CannedQueryParameters(paramBean, cqpd, null, requestTotalCountMax, pagingRequest.getQueryExecutionId());
|
|
|
|
// return canned query instance
|
|
return getCannedQuery(params);
|
|
}
|
|
|
|
@Override
|
|
public void afterPropertiesSet() throws Exception
|
|
{
|
|
super.afterPropertiesSet();
|
|
|
|
PropertyCheck.mandatory(this, "tenantService", tenantService);
|
|
PropertyCheck.mandatory(this, "nodeDAO", nodeDAO);
|
|
PropertyCheck.mandatory(this, "methodSecurityInterceptor", methodSecurity);
|
|
}
|
|
}
|