本文整理汇总了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;
}
示例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>();
}
}
示例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);
}
示例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;
}
示例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;
}
};
}
示例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>();
}
}
示例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);
}
示例8: getMappedProperty
import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery; //导入依赖的package包/类
public QName getMappedProperty()
{
// spoof
return GetChildrenCannedQuery.SORT_QNAME_CONTENT_SIZE;
}
示例9: getMappedProperty
import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery; //导入依赖的package包/类
public QName getMappedProperty()
{
// spoof
return GetChildrenCannedQuery.SORT_QNAME_CONTENT_MIMETYPE;
}
示例10: getListChildrenSortPropsDefault
import org.alfresco.repo.node.getchildren.GetChildrenCannedQuery; //导入依赖的package包/类
/**
* <p>
* Returns the default sort order.
* </p>
*
* @return The list of <code>Pair<QName, Boolean></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;
}