/** * {@inheritDoc} */ public long getSize() { return rowIterator.getSize(); }
@Override public long getSize() { return rowIterator.getSize(); }
@Override public long getSize() { return rows.getSize(); }
public long size() { QueryResult result = resultModel.getObject().getQueryResult(); if (result != null) { try { return (int) result.getRows().getSize(); } catch (RepositoryException e) { log.error("Error parsing query results", e); } } return 0; }
@Override public boolean isLast() throws SQLException { this.notClosed(); if (this.row != null && !this.rowIter.hasNext() && this.rowIter.getPosition() == this.rowIter.getSize()) { return true; } return false; }
@Override public boolean exists(String name) { QueryResult r = executeJcrSql2Query(findOneQuery(nodeType, name)); try { return r.getRows().getSize() > 0; } catch (RepositoryException e) { logger.warn(e.getMessage(), e); return false; } }
@Override public boolean isAfterLast() throws SQLException { this.notClosed(); if (this.row == null && !this.rowIter.hasNext() && this.rowIter.getPosition() == this.rowIter.getSize()) { return true; } return false; }
@Override public long count() { QueryResult r = executeJcrSql2Query(findAllQuery(nodeType)); try { return r.getRows().getSize(); } catch (RepositoryException e) { logger.warn(e.getMessage(), e); } return 0; }
@Override public boolean isAfterLast() throws SQLException { this.notClosed(); if (this.row == null && !this.rowIter.hasNext() && this.rowIter.getPosition() == this.rowIter.getSize()) { return true; } return false; }
@Override public boolean isLast() throws SQLException { this.notClosed(); if (this.row != null && !this.rowIter.hasNext() && this.rowIter.getPosition() == this.rowIter.getSize()) { return true; } return false; }
@Override public int getConfiguredConsumerNumber() { try { ChromatticSession session = persister.getSession(); final RowIterator ids = getProducerInfoIds(session); return (int)ids.getSize(); } catch (RepositoryException e) { throw new RuntimeException(e); } finally { persister.closeSession(false); } }
@Override public void run( Session s ) throws RepositoryException { // Count the nodes below the root, excluding the '/jcr:system' branch ... String queryStr = "SELECT [jcr:primaryType] FROM [nt:base]"; Query query = s.getWorkspace().getQueryManager().createQuery(queryStr, Query.JCR_SQL2); numNonSystemNodes += query.execute().getRows().getSize(); if (tools != null) tools.print(" # nodes NOT in '/jcr:system' branch: " + numNonSystemNodes); } }
@Override public void run( Session s ) throws RepositoryException { // Count the nodes below the root, excluding the '/jcr:system' branch ... String queryStr = "SELECT [jcr:primaryType] FROM [nt:base]"; Query query = s.getWorkspace().getQueryManager().createQuery(queryStr, Query.JCR_SQL2); numNonSystemNodes += query.execute().getRows().getSize(); if (tools != null) tools.print(" # nodes NOT in '/jcr:system' branch: " + numNonSystemNodes); } }
@Override public void run( Session s ) throws RepositoryException { // Count the nodes below the root, excluding the '/jcr:system' branch ... String queryStr = "SELECT [jcr:primaryType] FROM [nt:base]"; Query query = s.getWorkspace().getQueryManager().createQuery(queryStr, Query.JCR_SQL2); numNonSystemNodes += query.execute().getRows().getSize(); if (tools != null) tools.print(" # nodes NOT in '/jcr:system' branch: " + numNonSystemNodes); } }
protected int queryForCheckedOutVersionables( Session session, int expected, boolean print ) throws RepositoryException { String queryStr = "SELECT * FROM [mix:versionable] AS versionable WHERE versionable.[jcr:isCheckedOut] = true"; QueryResult result = query(session, queryStr); int actual = (int)result.getRows().getSize(); if (print) { System.out.println("Result = \n" + result); } assertThat(actual, is(expected)); return actual; }
public void testDistinctUnionWithDifferentFacetsOnSubQueries() throws Exception { Node n1 = testRootNode.addNode("node1"); n1.setProperty("text", "t1"); n1.setProperty("name","Node1"); // make sure that facet values from both ends of OR clause are different // the test is essentially that facet columns don't define uniqueness of a row Node n3 = testRootNode.addNode("node3"); n3.setProperty("text", "t1"); n3.setProperty("name","Node3"); superuser.save(); String xpath = "//*[@text = 't1' or @name = 'Node1']/(rep:facet(text))"; Query q = qm.createQuery(xpath, Query.XPATH); QueryResult result = q.execute(); RowIterator rows=result.getRows(); assertEquals(2, rows.getSize()); }
/** * Verifies character encoding on a node property that does not contain any * excerpt info */ public void testEncodeIllegalCharsNoHighlights() throws RepositoryException { String text = "bla <strong>bla</strong> bla"; String excerpt = createExcerpt("bla <strong>bla</strong> bla"); Node n = testRootNode.addNode(nodeName1); n.setProperty("text", text); n.setProperty("other", "foo"); superuser.save(); String stmt = getStatement("foo"); QueryResult result = executeQuery(stmt); RowIterator rows = result.getRows(); assertEquals(1, rows.getSize()); String ex = rows.nextRow().getValue("rep:excerpt(text)").getString(); assertEquals("Expected " + excerpt + ", but got ", excerpt, ex); }
/** * Verifies excerpt generation on a node property that does not contain any * excerpt info for a quoted phrase */ public void testQuotedPhraseNoMatch() throws RepositoryException { String text = "one two three four"; String excerpt = createExcerpt("one two three four"); String terms = "\"five six\""; Node n = testRootNode.addNode(nodeName1); n.setProperty("text", text); n.setProperty("other", terms); superuser.save(); String stmt = getStatement(terms); QueryResult result = executeQuery(stmt); RowIterator rows = result.getRows(); assertEquals(1, rows.getSize()); String ex = rows.nextRow().getValue("rep:excerpt(text)").getString(); assertEquals("Expected " + excerpt + ", but got ", excerpt, ex); }
private void queryContentInWorkspace( JcrRepository newRepository, String workspaceName ) throws RepositoryException { JcrSession session = newRepository.login(); try { String statement = "SELECT [car:model], [car:year], [car:msrp] FROM [car:Car] AS car"; Query query = session.getWorkspace().getQueryManager().createQuery(statement, Query.JCR_SQL2); QueryResult results = query.execute(); assertThat(results.getRows().getSize(), is(13L)); } finally { session.logout(); } }
private void checkExcerpt(String text, String fragmentText, String terms) throws RepositoryException { String excerpt = createExcerpt(fragmentText); createTestData(text); String stmt = getStatement(terms); QueryResult result = executeQuery(stmt); RowIterator rows = result.getRows(); assertEquals(1, rows.getSize()); assertEquals(excerpt, getExcerpt(rows.nextRow())); }