本文整理汇总了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();
}
示例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;
}