@Override public QueryObjectModelFactory getQOMFactory() { return delegate.getQOMFactory(); }
public QueryObjectModelFactory getQOMFactory() { return getDelegate().getQOMFactory(); }
public QueryObjectModelFactory execute() throws Exception { return getDelegate().getQOMFactory(); } });
/** * @return the query object model factory. * @throws RepositoryException if an error occurs. */ protected QueryObjectModelFactory getQOMFactory() throws RepositoryException { Workspace workspace = sessionContext.getSessionImpl().getWorkspace(); return workspace.getQueryManager().getQOMFactory(); }
/** * @return the query object model factory. * @throws RepositoryException if an error occurs. */ protected QueryObjectModelFactory getQOMFactory() throws RepositoryException { Workspace workspace = sessionContext.getSessionImpl().getWorkspace(); return workspace.getQueryManager().getQOMFactory(); }
public QueryEngine(Session session, LuceneQueryFactory lqf, Map<String, Value> variables) throws RepositoryException { this.session = session; this.lqf = lqf; Workspace workspace = session.getWorkspace(); this.ntManager = workspace.getNodeTypeManager(); this.qomFactory = workspace.getQueryManager().getQOMFactory(); this.valueFactory = session.getValueFactory(); this.evaluator = new OperandEvaluator(valueFactory, variables); }
public QueryEngine(Session session, LuceneQueryFactory lqf, Map<String, Value> variables) throws RepositoryException { this.session = session; this.lqf = lqf; Workspace workspace = session.getWorkspace(); this.ntManager = workspace.getNodeTypeManager(); this.qomFactory = workspace.getQueryManager().getQOMFactory(); this.valueFactory = session.getValueFactory(); this.evaluator = new OperandEvaluator(valueFactory, variables); }
protected void setUp() throws Exception { super.setUp(); qm = superuser.getWorkspace().getQueryManager(); qomFactory = qm.getQOMFactory(); }
/** * 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); } }
/** * Returns a column for the given property name and the default selector * name. * * @param propertyName the name of the property as well as the column. * @return a column. * @throws RepositoryException if an error occurs while creating the column. */ protected ColumnImpl columnForName(Name propertyName) throws RepositoryException { Workspace workspace = sessionContext.getSessionImpl().getWorkspace(); QueryObjectModelFactory qomFactory = workspace.getQueryManager().getQOMFactory(); String name = sessionContext.getJCRName(propertyName); return (ColumnImpl) qomFactory.column( sessionContext.getJCRName(DEFAULT_SELECTOR_NAME), name, name); } }
/** * Set-up the configuration values used for the test. Per default retrieves * a session, configures testRoot, and nodetype and checks if the query * language for the current language is available.<br> */ protected void setUp() throws Exception { super.setUp(); jcrScore = superuser.getNamespacePrefix(NS_JCR_URI) + ":score"; jcrPath = superuser.getNamespacePrefix(NS_JCR_URI) + ":path"; jcrRoot = superuser.getNamespacePrefix(NS_JCR_URI) + ":root"; jcrContains = superuser.getNamespacePrefix(NS_JCR_URI) + ":contains"; jcrDeref = superuser.getNamespacePrefix(NS_JCR_URI) + ":deref"; xpathRoot = "/" + jcrRoot + ISO9075.encodePath(testRoot); qm = superuser.getWorkspace().getQueryManager(); qf = qm.getQOMFactory(); vf = superuser.getValueFactory(); }
@Before public void before() throws RepositoryException { Session session = getAdminSession(); vf = session.getValueFactory(); QueryManager qm = session.getWorkspace().getQueryManager(); f = qm.getQOMFactory(); }
/** * Returns a column for the given property name and the default selector * name. * * @param propertyName the name of the property as well as the column. * @return a column. * @throws RepositoryException if an error occurs while creating the column. */ protected ColumnImpl columnForName(Name propertyName) throws RepositoryException { Workspace workspace = sessionContext.getSessionImpl().getWorkspace(); QueryObjectModelFactory qomFactory = workspace.getQueryManager().getQOMFactory(); String name = sessionContext.getJCRName(propertyName); return (ColumnImpl) qomFactory.column( sessionContext.getJCRName(DEFAULT_SELECTOR_NAME), name, name); } }
SessionImpl session = sessionContext.getSessionImpl(); QueryObjectModelFactory qomFactory = session.getWorkspace().getQueryManager().getQOMFactory();
when( queryManager.getQOMFactory() ).thenReturn( qomFactory ); when( queryManager.createQuery( anyString(), anyString() ) ).thenReturn( query );
SessionImpl session = sessionContext.getSessionImpl(); QueryObjectModelFactory qomFactory = session.getWorkspace().getQueryManager().getQOMFactory();
QueryObjectModelFactory fac = session.getWorkspace().getQueryManager().getQOMFactory(); final String selectorName = "selector"; //$NON-NLS-1$
/** * will build a query directly via the api using a spaced path * * @throws Exception */ public void testGetChildrenApiDirect() throws Exception { QueryObjectModelFactory qomf = qm.getQOMFactory(); Source source1 = qomf.selector(NodeType.NT_BASE, "selector"); Column[] columns = new Column[] { qomf.column("selector", null, null) }; Constraint constraint2 = qomf.childNode("selector", n1.getPath()); QueryObjectModel qom = qomf.createQuery(source1, constraint2, null, columns); checkResult(qom.execute(), 2); }
@Test public void testJQOM() throws InvalidQueryException, RepositoryException { Session session = MgnlContext.getJCRSession("website"); QueryObjectModelFactory factory = session.getWorkspace().getQueryManager().getQOMFactory(); QueryObjectModelBuilder qom = new SQL2QOMBuilder(); String statement = "select * from [nt:base] where [jcr:uuid] = 'c1fcda79-1f81-412d-a748-b9ea34ea97f7'"; QueryObjectModel model = qom.createQueryObjectModel(statement, factory, session.getValueFactory()); NodeIterator result = QueryUtil.search(model, NodeTypes.Page.NAME); Collection<Node> collection = NodeUtil.getCollectionFromNodeIterator(result); assertEquals(1, collection.size()); }
/** * the statement behind the api should be consistent, and return a similar * query. in our case it should escape the paths that have spaces in them by * enclosing them in single quotes * * @throws Exception */ public void testGetChildrenApiStatement() throws Exception { QueryObjectModelFactory qomf = qm.getQOMFactory(); Source source1 = qomf.selector(NodeType.NT_BASE, "selector"); Column[] columns = new Column[] { qomf.column("selector", null, null) }; Constraint constraint2 = qomf.childNode("selector", n1.getPath()); QueryObjectModel qom = qomf.createQuery(source1, constraint2, null, columns); checkResult(executeSQL2Query(qom.getStatement()), 2); }