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


Java QueryObjectModelFactory类代码示例

本文整理汇总了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();
}
 
开发者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

示例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);
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:20,代码来源:QOMUtil.java

示例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);
    }
}
 
开发者ID:dooApp,项目名称:jcromfx,代码行数:21,代码来源:AbstractJcrDAO.java

示例5: getQOMFactory

import javax.jcr.query.qom.QueryObjectModelFactory; //导入依赖的package包/类
@Override
public QueryObjectModelFactory getQOMFactory() {
    return null;
}
 
开发者ID:TWCable,项目名称:jackalope,代码行数:5,代码来源:QueryManagerImpl.java

示例6: getQOMFactory

import javax.jcr.query.qom.QueryObjectModelFactory; //导入依赖的package包/类
public QueryObjectModelFactory getQOMFactory() {

        return new RegistryQueryObjectModelFactory(session);
    }
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:5,代码来源:RegistryQueryManager.java


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