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


Java QueryObjectModelFactory.selector方法代码示例

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


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

示例1: retrievePlanNodes

import javax.jcr.query.qom.QueryObjectModelFactory; //导入方法依赖的package包/类
private NodeIterator retrievePlanNodes(long limit, long offset) throws RepositoryException {
    this.session.getWorkspace().getQueryManager();
    final QueryManager queryManager = this.session.getWorkspace().getQueryManager();
    final QueryObjectModelFactory factory = queryManager.getQOMFactory();

    final Source selector = factory.selector("scape:plan", "resourcesSelector");
    final Constraint constraints = factory.fullTextSearch("resourcesSelector", null, factory.literal(session.getValueFactory().createValue("*")));

    final Query query = factory.createQuery(selector, constraints, null, null);

    if (limit > 0) {
        query.setLimit(limit);
    }
    if (offset > 0) {
        query.setOffset(offset);
    }
    return query.execute().getNodes();
}
 
开发者ID:fasseg,项目名称:fcrepo4-scape,代码行数:19,代码来源:PlanList.java

示例2: searchObjectOfType

import javax.jcr.query.qom.QueryObjectModelFactory; //导入方法依赖的package包/类
/**
 * Search objects in Fedora with a given JCR Mixin Type using a simple term
 *
 * @param session
 *            the {@link Session} to use for the operation
 * @param mixinType
 *            the mixin type to look for
 * @param terms
 *            the search term to match objects against
 * @param offset
 *            the offset of the search results
 * @param limit
 *            the maximum number of search results
 * @return a {@link java.util.List} containing the paths of the found objects in
 *         Fedora
 * @throws RepositoryException
 *             if an error occurred searching in Fedora
 */
public List<String> searchObjectOfType(final Session session, final String mixinType, final String terms, final int offset, final int limit)
        throws RepositoryException {
    final QueryManager queryManager = session.getWorkspace().getQueryManager();

    final QueryObjectModelFactory factory = queryManager.getQOMFactory();

    final Source selector = factory.selector(mixinType, "resourcesSelector");
    final Constraint constraints = factory.fullTextSearch("resourcesSelector", null, factory.literal(session.getValueFactory().createValue(terms)));

    final Query query = factory.createQuery(selector, constraints, null, null);

    query.setLimit(limit);
    query.setOffset(offset);
    final QueryResult result = query.execute();
    final NodeIterator it = result.getNodes();
    final List<String> uris = new ArrayList<>();
    while (it.hasNext()) {
        Node n = it.nextNode();
        uris.add(n.getPath());
    }
    return uris;
}
 
开发者ID:fasseg,项目名称:fcrepo4-scape,代码行数:41,代码来源:ConnectorService.java


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