當前位置: 首頁>>代碼示例>>Java>>正文


Java GetChildrenCannedQuery類代碼示例

本文整理匯總了Java中org.alfresco.repo.node.getchildren.GetChildrenCannedQuery的典型用法代碼示例。如果您正苦於以下問題:Java GetChildrenCannedQuery類的具體用法?Java GetChildrenCannedQuery怎麽用?Java GetChildrenCannedQuery使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


GetChildrenCannedQuery類屬於org.alfresco.repo.node.getchildren包,在下文中一共展示了GetChildrenCannedQuery類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getListChildrenFilterProps

import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery; //導入依賴的package包/類
/**
 * <p>Returns a List of filter properties specified by request parameters.</p>
 *
 * @param parameters The {@link Parameters} object to get the parameters passed into the request
 *        including:
 *        - filter, sort & paging params (where, orderBy, skipCount, maxItems)
 *        - incFiles, incFolders (both true by default)
 * @return The list of {@link FilterProp}. Can be null.
 */
protected List<FilterProp> getListChildrenFilterProps(final Parameters parameters)
{
    List<FilterProp> filterProps = null;
    Query q = parameters.getQuery();
    if (q != null)
    {
        MapBasedQueryWalker propertyWalker = createListChildrenQueryWalker();
        QueryHelper.walk(q, propertyWalker);

        Boolean isPrimary = propertyWalker.getProperty(PARAM_ISPRIMARY, WhereClauseParser.EQUALS, Boolean.class);

        if (isPrimary != null)
        {
            filterProps = new ArrayList<>(1);
            filterProps.add(new FilterPropBoolean(GetChildrenCannedQuery.FILTER_QNAME_NODE_IS_PRIMARY, isPrimary));
        }
    }
    return filterProps;
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:29,代碼來源:NodesImpl.java

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: getMappedProperty

import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery; //導入依賴的package包/類
public QName getMappedProperty()
{
    // spoof
    return GetChildrenCannedQuery.SORT_QNAME_CONTENT_SIZE;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:6,代碼來源:ContentStreamLengthProperty.java

示例9: getMappedProperty

import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery; //導入依賴的package包/類
public QName getMappedProperty()
{
    // spoof
    return GetChildrenCannedQuery.SORT_QNAME_CONTENT_MIMETYPE;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:6,代碼來源:ContentStreamMimetypeProperty.java

示例10: getListChildrenSortPropsDefault

import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery; //導入依賴的package包/類
/**
 * <p>
 * Returns the default sort order.
 * </p>
 *
 * @return The list of <code>Pair&lt;QName, Boolean&gt;</code> sort
 *         properties.
 */
protected List<Pair<QName, Boolean>> getListChildrenSortPropsDefault()
{
    List<Pair<QName, Boolean>> sortProps = new ArrayList<>(
            Arrays.asList(new Pair<>(GetChildrenCannedQuery.SORT_QNAME_NODE_IS_FOLDER, Boolean.FALSE), new Pair<>(ContentModel.PROP_NAME, true)));
    return sortProps;
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:15,代碼來源:NodesImpl.java


注:本文中的org.alfresco.repo.node.getchildren.GetChildrenCannedQuery類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。