本文整理汇总了Java中javax.jcr.query.qom.QueryObjectModelFactory类的典型用法代码示例。如果您正苦于以下问题:Java QueryObjectModelFactory类的具体用法?Java QueryObjectModelFactory怎么用?Java QueryObjectModelFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QueryObjectModelFactory类属于javax.jcr.query.qom包,在下文中一共展示了QueryObjectModelFactory类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例3: evalComparison
import javax.jcr.query.qom.QueryObjectModelFactory; //导入依赖的package包/类
public static boolean evalComparison(Value value1, Value value2, String operator) throws RepositoryException {
int c = compareValues(value1, value2);
if (operator.equals(QueryObjectModelFactory.JCR_OPERATOR_EQUAL_TO)) {
return c == 0;
} else if (operator == QueryObjectModelFactory.JCR_OPERATOR_NOT_EQUAL_TO) {
return c != 0;
} else if (operator == QueryObjectModelFactory.JCR_OPERATOR_LESS_THAN) {
return c < 0;
} else if (operator == QueryObjectModelFactory.JCR_OPERATOR_GREATER_THAN) {
return c > 0;
} else if (operator == QueryObjectModelFactory.JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO) {
return c >= 0;
} else if (operator == QueryObjectModelFactory.JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO) {
return c <= 0;
} else {
throw new UnsupportedOperationException(
"Unsupported comparison operator: " + operator);
}
}
示例4: findByQOM
import javax.jcr.query.qom.QueryObjectModelFactory; //导入依赖的package包/类
/**
* Find JCR nodes with one or more selectors, and map to objects.
*
* @param source the node-tuple source; non-null
* @param constraint the constraint, or null if none
* @param orderings zero or more orderings; null is equivalent to a zero-length array
* @param columns the columns; null is equivalent to a zero-length array
* @param nodeFilter the NodeFilter to apply when updating child nodes and references
* @return a list of objects mapped from the nodes
*/
protected List<T> findByQOM(Source source, Constraint constraint, Ordering orderings[], Column columns[], NodeFilter nodeFilter) {
try {
QueryObjectModelFactory factory = getSession().getWorkspace().getQueryManager().getQOMFactory();
Query query = factory.createQuery(source, constraint, orderings, columns);
QueryResult result = query.execute();
return toList(result.getNodes(), nodeFilter);
} catch (RepositoryException e) {
throw new JcrMappingException("Could not find nodes by QOM", e);
}
}
示例5: getQOMFactory
import javax.jcr.query.qom.QueryObjectModelFactory; //导入依赖的package包/类
@Override
public QueryObjectModelFactory getQOMFactory() {
return null;
}
示例6: getQOMFactory
import javax.jcr.query.qom.QueryObjectModelFactory; //导入依赖的package包/类
public QueryObjectModelFactory getQOMFactory() {
return new RegistryQueryObjectModelFactory(session);
}