本文整理汇总了Java中org.alfresco.query.CannedQuery类的典型用法代码示例。如果您正苦于以下问题:Java CannedQuery类的具体用法?Java CannedQuery怎么用?Java CannedQuery使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CannedQuery类属于org.alfresco.query包,在下文中一共展示了CannedQuery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listMembersPaged
import org.alfresco.query.CannedQuery; //导入依赖的package包/类
public PagingResults<SiteMembership> listMembersPaged(String shortName, boolean collapseGroups, List<Pair<SiteService.SortFields, Boolean>> sortProps, PagingRequest pagingRequest)
{
CannedQueryPageDetails pageDetails = new CannedQueryPageDetails(pagingRequest.getSkipCount(), pagingRequest.getMaxItems());
// sort details
CannedQuerySortDetails sortDetails = null;
if(sortProps != null)
{
List<Pair<? extends Object, SortOrder>> sortPairs = new ArrayList<Pair<? extends Object, SortOrder>>(sortProps.size());
for (Pair<SiteService.SortFields, Boolean> sortProp : sortProps)
{
sortPairs.add(new Pair<SiteService.SortFields, SortOrder>(sortProp.getFirst(), (sortProp.getSecond() ? SortOrder.ASCENDING : SortOrder.DESCENDING)));
}
sortDetails = new CannedQuerySortDetails(sortPairs);
}
SiteMembersCannedQueryParams parameterBean = new SiteMembersCannedQueryParams(shortName, collapseGroups);
CannedQueryParameters params = new CannedQueryParameters(parameterBean, pageDetails, sortDetails, pagingRequest.getRequestTotalCountMax(), pagingRequest.getQueryExecutionId());
CannedQuery<SiteMembership> query = new SiteMembersCannedQuery(this, personService, nodeService, params);
CannedQueryResults<SiteMembership> results = query.execute();
return getPagingResults(pagingRequest, results);
}
示例2: listContainers
import org.alfresco.query.CannedQuery; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public PagingResults<FileInfo> listContainers(String shortName, PagingRequest pagingRequest)
{
SiteContainersCannedQueryFactory sitesContainersCannedQueryFactory = (SiteContainersCannedQueryFactory)cannedQueryRegistry.getNamedObject("siteContainersCannedQueryFactory");
CannedQueryPageDetails pageDetails = new CannedQueryPageDetails(pagingRequest.getSkipCount(), pagingRequest.getMaxItems());
CannedQuerySortDetails sortDetails = new CannedQuerySortDetails(new Pair<Object, SortOrder>(SiteContainersCannedQueryParams.SortFields.ContainerName, SortOrder.ASCENDING));
SiteContainersCannedQueryParams parameterBean = new SiteContainersCannedQueryParams(getSiteNodeRef(shortName));
CannedQueryParameters params = new CannedQueryParameters(parameterBean, pageDetails, sortDetails, pagingRequest.getRequestTotalCountMax(), pagingRequest.getQueryExecutionId());
CannedQuery<FileInfo> query = sitesContainersCannedQueryFactory.getCannedQuery(params);
CannedQueryResults<FileInfo> results = query.execute();
return getPagingResults(pagingRequest, results);
}
示例3: getDownloadsCannedQuery
import org.alfresco.query.CannedQuery; //导入依赖的package包/类
public CannedQuery<DownloadEntity> getDownloadsCannedQuery(NodeRef containerNode, Date before)
{
ParameterCheck.mandatory("before", before);
GetDownloadsCannedQueryParams parameterBean = new GetDownloadsCannedQueryParams
(
getNodeId(containerNode),
getQNameId(ContentModel.PROP_NAME),
getQNameId(DownloadModel.TYPE_DOWNLOAD),
before
);
CannedQueryParameters params = new CannedQueryParameters(parameterBean);
final GetDownloadsCannedQuery cq = new GetDownloadsCannedQuery(
cannedQueryDAO, methodSecurity, params
);
return cq;
}
示例4: getGetPublishedCannedQuery
import org.alfresco.query.CannedQuery; //导入依赖的package包/类
public CannedQuery<BlogEntity> getGetPublishedCannedQuery(NodeRef blogContainerNode, Date fromDate, Date toDate, String byUser, PagingRequest pagingReq)
{
ParameterCheck.mandatory("blogContainerNode", blogContainerNode);
ParameterCheck.mandatory("pagingReq", pagingReq);
int requestTotalCountMax = pagingReq.getRequestTotalCountMax();
boolean isPublished = true;
GetBlogPostsCannedQueryParams paramBean = new GetBlogPostsCannedQueryParams(getNodeId(blogContainerNode),
getQNameId(ContentModel.PROP_NAME),
getQNameId(ContentModel.PROP_PUBLISHED),
getQNameId(ContentModel.TYPE_CONTENT),
byUser,
isPublished,
fromDate, toDate,
null, null);
CannedQueryPageDetails cqpd = createCQPageDetails(pagingReq);
CannedQuerySortDetails cqsd = createCQSortDetails(ContentModel.PROP_PUBLISHED, SortOrder.DESCENDING);
// create query params holder
CannedQueryParameters params = new CannedQueryParameters(paramBean, cqpd, cqsd, requestTotalCountMax, pagingReq.getQueryExecutionId());
// return canned query instance
return getCannedQuery(params);
}
示例5: getCannedQuery
import org.alfresco.query.CannedQuery; //导入依赖的package包/类
/**
* 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);
}
示例6: getAuthoritiesImpl
import org.alfresco.query.CannedQuery; //导入依赖的package包/类
private <T> PagingResults<T> getAuthoritiesImpl(AuthorityType type, NodeRef containerRef, String displayNameFilter, String sortBy, boolean sortAscending, PagingRequest pagingRequest, AbstractPagingResults<T> finalResults)
{
Long start = (logger.isDebugEnabled() ? System.currentTimeMillis() : null);
if (type != null)
{
switch (type)
{
case GROUP:
case ROLE:
case USER:
// drop through
break;
default:
throw new UnsupportedOperationException("Unexpected authority type: "+type);
}
}
// get canned query
GetAuthoritiesCannedQueryFactory getAuthoritiesCannedQueryFactory = (GetAuthoritiesCannedQueryFactory)cannedQueryRegistry.getNamedObject(CANNED_QUERY_AUTHS_LIST);
CannedQuery<AuthorityInfo> cq = getAuthoritiesCannedQueryFactory.getCannedQuery(type, containerRef, displayNameFilter, sortBy, sortAscending, pagingRequest);
// execute canned query
final CannedQueryResults<AuthorityInfo> results = cq.execute();
finalResults.setResults(results);
if (start != null)
{
int cnt = finalResults.getPage().size();
int skipCount = pagingRequest.getSkipCount();
int maxItems = pagingRequest.getMaxItems();
boolean hasMoreItems = finalResults.hasMoreItems();
int pageNum = (skipCount / maxItems) + 1;
logger.debug("getAuthoritiesByType: "+cnt+" items in "+(System.currentTimeMillis()-start)+" msecs [type="+type+",pageNum="+pageNum+",skip="+skipCount+",max="+maxItems+",hasMorePages="+hasMoreItems+",filter="+displayNameFilter+"]");
}
return finalResults;
}
示例7: getCannedQuery
import org.alfresco.query.CannedQuery; //导入依赖的package包/类
/**
* Retrieve an optionally filtered/sorted instance of a {@link CannedQuery} based on parameters including request for a total count (up to a given max)
*
* Note: if both filtering and sorting is required then the combined total of unique QName properties should be the 0 to 3.
*
* @param parentRef parent node ref
* @param pattern the pattern to use to filter children (wildcard character is '*')
* @param filterProps filter props
* @param inclusiveAspects If not null, only child nodes with any aspect in this collection will be included in the results.
* @param exclusiveAspects If not null, any child nodes with any aspect in this collection will be excluded in the results.
* @param includeAdministrators include administrators in the returned results
* @param sortProps sort property pairs (QName and Boolean - true if ascending)
* @param pagingRequest skipCount, maxItems - optionally queryExecutionId and requestTotalCountMax
*
* @return an implementation that will execute the query
*/
public CannedQuery<NodeRef> getCannedQuery(NodeRef parentRef, String pattern, List<QName> filterProps, Set<QName> inclusiveAspects, Set<QName> exclusiveAspects, boolean includeAdministrators, List<Pair<QName, Boolean>> sortProps, PagingRequest pagingRequest)
{
ParameterCheck.mandatory("parentRef", parentRef);
ParameterCheck.mandatory("pagingRequest", pagingRequest);
int requestTotalCountMax = pagingRequest.getRequestTotalCountMax();
// specific query params - context (parent) and inclusive filters (property values)
GetPeopleCannedQueryParams paramBean = new GetPeopleCannedQueryParams(tenantService.getName(parentRef), filterProps, pattern, inclusiveAspects, exclusiveAspects, includeAdministrators);
// page details
CannedQueryPageDetails cqpd = new CannedQueryPageDetails(pagingRequest.getSkipCount(), pagingRequest.getMaxItems(), CannedQueryPageDetails.DEFAULT_PAGE_NUMBER, CannedQueryPageDetails.DEFAULT_PAGE_COUNT);
// sort details
CannedQuerySortDetails cqsd = null;
if (sortProps != null)
{
List<Pair<? extends Object, SortOrder>> sortPairs = new ArrayList<Pair<? extends Object, SortOrder>>(sortProps.size());
for (Pair<QName, Boolean> sortProp : sortProps)
{
boolean sortAsc = ((sortProp.getSecond() == null) || sortProp.getSecond());
sortPairs.add(new Pair<QName, SortOrder>(sortProp.getFirst(), (sortAsc ? SortOrder.ASCENDING : SortOrder.DESCENDING)));
}
cqsd = new CannedQuerySortDetails(sortPairs);
}
// create query params holder
CannedQueryParameters params = new CannedQueryParameters(paramBean, cqpd, cqsd, requestTotalCountMax, pagingRequest.getQueryExecutionId());
// return canned query instance
return getCannedQuery(params);
}
示例8: getCannedQuery
import org.alfresco.query.CannedQuery; //导入依赖的package包/类
@Override
public CannedQuery<FileInfo> getCannedQuery(CannedQueryParameters parameters)
{
Object parameterBean = parameters.getParameterBean();
CannedQuery<FileInfo> cq = null;
if(parameterBean instanceof SiteContainersCannedQueryParams)
{
cq = new SiteContainersCannedQuery(fileFolderService, nodeService, parameters, methodSecurity);
}
return (CannedQuery<FileInfo>)cq;
}
示例9: getCannedQuery
import org.alfresco.query.CannedQuery; //导入依赖的package包/类
@Override
public CannedQuery<CalendarEntry> getCannedQuery(CannedQueryParameters parameters)
{
final GetCalendarEntriesCannedQuery cq = new GetCalendarEntriesCannedQuery(
cannedQueryDAO, nodeService, taggingService, methodSecurity, parameters
);
return (CannedQuery<CalendarEntry>) cq;
}
示例10: getCannedQuery
import org.alfresco.query.CannedQuery; //导入依赖的package包/类
@Override
public CannedQuery<NodeRef> getCannedQuery(CannedQueryParameters parameters)
{
NodePropertyHelper nodePropertyHelper = new NodePropertyHelper(dictionaryService, qnameDAO, localeDAO, contentDataDAO);
return (CannedQuery<NodeRef>) new GetChildrenCannedQuery(nodeDAO, qnameDAO, cannedQueryDAO, nodePropertyHelper, tenantService, nodeService, methodSecurity, parameters, hiddenAspect, dictionaryService, ignoreAspectQNames);
}
示例11: getNodeLinksIds
import org.alfresco.query.CannedQuery; //导入依赖的package包/类
@Override
public List<Long> getNodeLinksIds(NodeRef nodeRef)
{
/* Validate input */
PropertyCheck.mandatory(this, "nodeRef", nodeRef);
/* Get all links of the given nodeRef */
PagingRequest pagingRequest = new PagingRequest(0, 100000);
List<Long> nodeLinks = new ArrayList<Long>();
Pair<Long, QName> nameQName = qnameDAO.getQName(ContentModel.PROP_LINK_DESTINATION);
if (nameQName != null)
{
// Execute the canned query if there are links in the database
GetDoclinkNodesCannedQueryParams parameterBean = new GetDoclinkNodesCannedQueryParams(nodeRef.toString(),
nameQName.getFirst(),
pagingRequest.getMaxItems());
CannedQueryParameters params = new CannedQueryParameters(parameterBean,
null,
null,
pagingRequest.getRequestTotalCountMax(),
pagingRequest.getQueryExecutionId());
CannedQuery<Long> query = new GetDoclinkNodesCannedQuery(cannedQueryDAO,
params);
CannedQueryResults<Long> results = query.execute();
for (Long nodeId : results.getPage())
{
nodeLinks.add(nodeId);
}
}
return nodeLinks;
}
示例12: getCannedQuery
import org.alfresco.query.CannedQuery; //导入依赖的package包/类
@Override
public CannedQuery<BlogEntity> getCannedQuery(CannedQueryParameters parameters)
{
final DraftsAndPublishedBlogPostsCannedQuery cq = new DraftsAndPublishedBlogPostsCannedQuery(
cannedQueryDAO,
methodSecurity,
parameters);
return (CannedQuery<BlogEntity>) cq;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:10,代码来源:DraftsAndPublishedBlogPostsCannedQueryFactory.java
示例13: getCannedQuery
import org.alfresco.query.CannedQuery; //导入依赖的package包/类
@Override
public CannedQuery<BlogEntity> getCannedQuery(CannedQueryParameters parameters)
{
final GetBlogPostsCannedQuery cq = new GetBlogPostsCannedQuery(cannedQueryDAO, methodSecurity, parameters);
return (CannedQuery<BlogEntity>) cq;
}
示例14: getGetDraftsCannedQuery
import org.alfresco.query.CannedQuery; //导入依赖的package包/类
public CannedQuery<BlogEntity> getGetDraftsCannedQuery(NodeRef blogContainerNode, String username, PagingRequest pagingReq)
{
ParameterCheck.mandatory("blogContainerNode", blogContainerNode);
ParameterCheck.mandatory("pagingReq", pagingReq);
int requestTotalCountMax = pagingReq.getRequestTotalCountMax();
//FIXME Need tenant service like for GetChildren?
boolean isPublished = false;
GetBlogPostsCannedQueryParams paramBean = new GetBlogPostsCannedQueryParams(getNodeId(blogContainerNode),
getQNameId(ContentModel.PROP_NAME),
getQNameId(ContentModel.PROP_PUBLISHED),
getQNameId(ContentModel.TYPE_CONTENT),
username,
isPublished,
null, null,
null, null);
CannedQueryPageDetails cqpd = createCQPageDetails(pagingReq);
CannedQuerySortDetails cqsd = createCQSortDetails(ContentModel.PROP_CREATED, SortOrder.DESCENDING);
// create query params holder
CannedQueryParameters params = new CannedQueryParameters(paramBean, cqpd, cqsd, requestTotalCountMax, pagingReq.getQueryExecutionId());
// return canned query instance
return getCannedQuery(params);
}
示例15: getGetPublishedExternallyCannedQuery
import org.alfresco.query.CannedQuery; //导入依赖的package包/类
public CannedQuery<BlogEntity> getGetPublishedExternallyCannedQuery(NodeRef blogContainerNode, PagingRequest pagingReq)
{
ParameterCheck.mandatory("blogContainerNode", blogContainerNode);
ParameterCheck.mandatory("pagingReq", pagingReq);
int requestTotalCountMax = pagingReq.getRequestTotalCountMax();
boolean isPublished = true;
Long blogIntAspectQNameId = getQNameId(BlogIntegrationModel.ASPECT_BLOG_POST);
if (blogIntAspectQNameId == null)
{
// possible if no blogs have ever been published externally
blogIntAspectQNameId = -1L; // run the query but should return empty results
}
// published externally if it has the BLOG_POST aspect
GetBlogPostsCannedQueryParams paramBean = new GetBlogPostsCannedQueryParams(getNodeId(blogContainerNode),
getQNameId(ContentModel.PROP_NAME),
getQNameId(ContentModel.PROP_PUBLISHED),
getQNameId(ContentModel.TYPE_CONTENT),
null,
isPublished,
null, null,
blogIntAspectQNameId,
getQNameId(BlogIntegrationModel.PROP_POSTED));
CannedQueryPageDetails cqpd = createCQPageDetails(pagingReq);
CannedQuerySortDetails cqsd = createCQSortDetails(BlogIntegrationModel.PROP_POSTED, SortOrder.DESCENDING);
// create query params holder
CannedQueryParameters params = new CannedQueryParameters(paramBean, cqpd, cqsd, requestTotalCountMax, pagingReq.getQueryExecutionId());
// return canned query instance
return getCannedQuery(params);
}