当前位置: 首页>>代码示例>>Java>>正文


Java GetChildrenCannedQuery.execute方法代码示例

本文整理汇总了Java中org.alfresco.repo.node.getchildren.GetChildrenCannedQuery.execute方法的典型用法代码示例。如果您正苦于以下问题:Java GetChildrenCannedQuery.execute方法的具体用法?Java GetChildrenCannedQuery.execute怎么用?Java GetChildrenCannedQuery.execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.alfresco.repo.node.getchildren.GetChildrenCannedQuery的用法示例。


在下文中一共展示了GetChildrenCannedQuery.execute方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: listComments

import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery; //导入方法依赖的package包/类
@Override
public PagingResults<NodeRef> listComments(NodeRef discussableNode, PagingRequest paging)
{
	NodeRef commentsFolder = getShareCommentsTopic(discussableNode);
	if(commentsFolder != null)
	{
		List<Pair<QName,Boolean>> sort = new ArrayList<Pair<QName,Boolean>>();
		sort.add(new Pair<QName, Boolean>(ContentModel.PROP_CREATED, false));

     // Run the canned query
     GetChildrenCannedQueryFactory getChildrenCannedQueryFactory = (GetChildrenCannedQueryFactory)cannedQueryRegistry.getNamedObject(CANNED_QUERY_GET_CHILDREN);
     GetChildrenCannedQuery cq = (GetChildrenCannedQuery)getChildrenCannedQueryFactory.getCannedQuery(commentsFolder, null, null, null, null, sort, paging);
	
     // Execute the canned query
     CannedQueryResults<NodeRef> results = cq.execute();
     return results;
	}
	else
	{
		return new EmptyPagingResults<NodeRef>();
	}
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:23,代码来源:CommentServiceImpl.java

示例2: listCalendarEntries

import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery; //导入方法依赖的package包/类
@Override
public PagingResults<CalendarEntry> listCalendarEntries(
      String siteShortName, PagingRequest paging) 
{
   NodeRef container = getSiteCalendarContainer(siteShortName, false);
   if (container == null)
   {
      // No events
      return new EmptyPagingResults<CalendarEntry>();
   }
   
   // Build our sorting, by date
   // Sort by start date, then end date, then created at for two events with matching times 
   List<Pair<QName,Boolean>> sort = new ArrayList<Pair<QName, Boolean>>();
   sort.add(new Pair<QName, Boolean>(CalendarModel.PROP_FROM_DATE, true)); 
   sort.add(new Pair<QName, Boolean>(CalendarModel.PROP_TO_DATE, true));
   sort.add(new Pair<QName, Boolean>(ContentModel.PROP_CREATED, true)); 
   
   // We only want calendar entries
   Set<QName> types = new HashSet<QName>();
   types.add(CalendarModel.TYPE_EVENT);
   
   // Run the canned query
   GetChildrenCannedQueryFactory getChildrenCannedQueryFactory = (GetChildrenCannedQueryFactory)cannedQueryRegistry.getNamedObject(CANNED_QUERY_GET_CHILDREN);
   GetChildrenCannedQuery cq = (GetChildrenCannedQuery)getChildrenCannedQueryFactory.getCannedQuery(
         container, null, null, types, null, sort, paging);
   
   // Execute the canned query
   CannedQueryResults<NodeRef> results = cq.execute();
   return wrap(results, container);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:32,代码来源:CalendarServiceImpl.java

示例3: listImpl

import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery; //导入方法依赖的package包/类
private CannedQueryResults<NodeRef> listImpl(NodeRef contextNodeRef, String pattern, Set<QName> assocTypeQNames, Set<QName> searchTypeQNames, Set<QName> ignoreAspectQNames,
                                             List<Pair<QName, Boolean>> sortProps, List<FilterProp> filterProps, PagingRequest pagingRequest)
{
    Long start = (logger.isDebugEnabled() ? System.currentTimeMillis() : null);
    
    // get canned query
    GetChildrenCannedQueryFactory getChildrenCannedQueryFactory = (GetChildrenCannedQueryFactory)cannedQueryRegistry.getNamedObject(CANNED_QUERY_FILEFOLDER_LIST);

    GetChildrenCannedQuery cq = (GetChildrenCannedQuery)getChildrenCannedQueryFactory.getCannedQuery(contextNodeRef, pattern, assocTypeQNames, searchTypeQNames, ignoreAspectQNames, filterProps, sortProps, pagingRequest);

    // execute canned query
    CannedQueryResults<NodeRef> results = cq.execute();
    
    if (start != null)
    {
        int cnt = results.getPagedResultCount();
        int skipCount = pagingRequest.getSkipCount();
        int maxItems = pagingRequest.getMaxItems();
        boolean hasMoreItems = results.hasMoreItems();
        Pair<Integer, Integer> totalCount = (pagingRequest.getRequestTotalCountMax() > 0 ? results.getTotalResultCount() : null);
        int pageNum = (skipCount / maxItems) + 1;
        
        logger.debug("List: "+cnt+" items in "+(System.currentTimeMillis()-start)+" msecs [pageNum="+pageNum+",skip="+skipCount+",max="+maxItems+",hasMorePages="+hasMoreItems+",totalCount="+totalCount+",parentNodeRef="+contextNodeRef+"]");
    }
    
    return results;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:28,代码来源:FileFolderServiceImpl.java

示例4: listSites

import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery; //导入方法依赖的package包/类
/**
 * This method uses {@link CannedQuery canned queries} to retrieve {@link SiteModel#TYPE_SITE st:site} NodeRefs
 * with support for {@link PagingRequest result paging}.
 */
@Override
public PagingResults<SiteInfo> listSites(List<FilterProp> filterProps, List<Pair<QName, Boolean>> sortProps, PagingRequest pagingRequest)
{
    // Only search for "st:site" nodes.
    final Set<QName> searchTypeQNames = new HashSet<QName>(1);
    searchTypeQNames.add(SiteModel.TYPE_SITE);
    // ... and all subtypes of st:site
    searchTypeQNames.addAll(dictionaryService.getSubTypes(SiteModel.TYPE_SITE, true));

    // get canned query
    final String cQBeanName = "siteGetChildrenCannedQueryFactory";
    GetChildrenCannedQueryFactory getChildrenCannedQueryFactory = (GetChildrenCannedQueryFactory)cannedQueryRegistry.getNamedObject(cQBeanName);
    
    GetChildrenCannedQuery cq = (GetChildrenCannedQuery)getChildrenCannedQueryFactory.getCannedQuery(getSiteRoot(), null, null, searchTypeQNames,
                                                                                                     filterProps, sortProps, pagingRequest);
    
    // execute canned query
    final CannedQueryResults<NodeRef> results = cq.execute();
    
    // Now convert the CannedQueryResults<NodeRef> into a more useful PagingResults<SiteInfo>
    List<NodeRef> nodeRefs = Collections.emptyList();
    if (results.getPageCount() > 0)
    {
        nodeRefs = results.getPages().get(0);
    }
    
    // set total count
    final Pair<Integer, Integer> totalCount;
    if (pagingRequest.getRequestTotalCountMax() > 0)
    {
        totalCount = results.getTotalResultCount();
    }
    else
    {
        totalCount = null;
    }
    
    final List<SiteInfo> siteInfos = new ArrayList<SiteInfo>(nodeRefs.size());
    for (NodeRef nodeRef : nodeRefs)
    {
        siteInfos.add(createSiteInfo(nodeRef));
    }
    
    return new PagingResults<SiteInfo>()
    {
        @Override
        public String getQueryExecutionId()
        {
            return results.getQueryExecutionId();
        }

        @Override
        public List<SiteInfo> getPage()
        {
            return siteInfos;
        }

        @Override
        public boolean hasMoreItems()
        {
            return results.hasMoreItems();
        }

        @Override
        public Pair<Integer, Integer> getTotalResultCount()
        {
            return totalCount;
        }
    };
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:75,代码来源:SiteServiceImpl.java

示例5: listComments

import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery; //导入方法依赖的package包/类
@Override
public PagingResults<NodeRef> listComments(NodeRef discussableNode, PagingRequest paging)
{
	NodeRef commentsFolder = getShareCommentsTopic(discussableNode);
	if(commentsFolder != null)
	{
		List<Pair<QName,Boolean>> sort = new ArrayList<Pair<QName,Boolean>>();
		sort.add(new Pair<QName, Boolean>(ContentModel.PROP_CREATED, false));

     // Run the canned query
     GetChildrenCannedQueryFactory getChildrenCannedQueryFactory = (GetChildrenCannedQueryFactory)cannedQueryRegistry.getNamedObject(CANNED_QUERY_GET_CHILDREN);
     GetChildrenCannedQuery cq = (GetChildrenCannedQuery)getChildrenCannedQueryFactory.getCannedQuery(commentsFolder, null, null, null, null, sort, paging);
        
        // Execute the canned query
        final CannedQueryResults<NodeRef> results = cq.execute();

        // Now convert the CannedQueryResults<NodeRef> into a more useful PagingResults<NodeRef>
        List<NodeRef> comments = Collections.emptyList();

        if (results.getPageCount() > 0)
        {
            comments = results.getPages().get(0);
        }

        // set total count
        final Pair<Integer, Integer> totalCount;
        if (paging.getRequestTotalCountMax() > 0)
        {
            totalCount = results.getTotalResultCount();
        }
        else
        {
            totalCount = null;
        }

        final List<NodeRef> page = new ArrayList<NodeRef>(comments.size());
        for (NodeRef comment : comments)
        {
            page.add(comment);
        }

        return new PagingResults<NodeRef>()
        {
            @Override
            public String getQueryExecutionId()
            {
                return results.getQueryExecutionId();
            }

            @Override
            public List<NodeRef> getPage()
            {
                return page;
            }

            @Override
            public boolean hasMoreItems()
            {
                return results.hasMoreItems();
            }

            @Override
            public Pair<Integer, Integer> getTotalResultCount()
            {
                return totalCount;
            }
        };
    }
    else
    {
        return new EmptyPagingResults<NodeRef>();
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:74,代码来源:CommentServiceImpl.java

示例6: listOutlookCalendarEntries

import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery; //导入方法依赖的package包/类
@Override
public PagingResults<CalendarEntry> listOutlookCalendarEntries(String siteShortName, String outlookUID,
        PagingRequest paging)
{
    NodeRef container = getSiteCalendarContainer(siteShortName, false);
    if (container == null)
    {
       // No events
       return new EmptyPagingResults<CalendarEntry>();
    }
    
    // Build our sorting, by date
    // There is a limit on the number of filter and sorts, so we can't
    //  do all that much sorting
    List<Pair<QName,Boolean>> sort = new ArrayList<Pair<QName, Boolean>>();
    sort.add(new Pair<QName, Boolean>(CalendarModel.PROP_FROM_DATE, true)); 
    sort.add(new Pair<QName, Boolean>(CalendarModel.PROP_TO_DATE, true));
    
    // We only want calendar entries
    Set<QName> types = new HashSet<QName>();
    types.add(CalendarModel.TYPE_EVENT);
    
    // Filtering is OR based, so we can't filder on both IS_OUTLOOK and OUTLOOK_UID
    // Luckily, OUTLOOK_UID implies IS_OUTLOOK
    List<FilterProp> filters = new ArrayList<FilterProp>();
    if (outlookUID != null)
    {
        // Filter by the UID, will get only outlook ones implicitly
        filters.add(new FilterPropString(
                CalendarModel.PROP_OUTLOOK_UID, outlookUID, FilterTypeString.EQUALS
        ));
    }
    else
    {
        // Find all Outlook ones
        filters.add(new FilterPropBoolean(CalendarModel.PROP_IS_OUTLOOK, Boolean.TRUE));
    }
    
    // Run the canned query
    GetChildrenCannedQueryFactory getChildrenCannedQueryFactory = (GetChildrenCannedQueryFactory)cannedQueryRegistry.getNamedObject(CANNED_QUERY_GET_CHILDREN);
    GetChildrenCannedQuery cq = (GetChildrenCannedQuery)getChildrenCannedQueryFactory.getCannedQuery(
          container, null, null, types, filters, sort, paging);
    
    // Execute the canned query
    CannedQueryResults<NodeRef> results = cq.execute();
    return wrap(results, container);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:48,代码来源:CalendarServiceImpl.java


注:本文中的org.alfresco.repo.node.getchildren.GetChildrenCannedQuery.execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。