@Test @FixFor( "MODE-2401" ) public void shouldNotReturnNonQueryableNodeTypes() throws Exception { Node folder1 = session.getRootNode().addNode("folder1", "test:noQueryFolder"); Node folder2 = session.getRootNode().addNode("folder2", "nt:folder"); Node folder3 = session.getRootNode().addNode("folder3", "test:noQueryFolder"); Node folder31 = folder3.addNode("folder3_1", "nt:folder"); Node folder311 = folder31.addNode("folder3_1", "test:noQueryFolder"); folder311.addNode("folder3_1_1", "nt:folder"); session.save(); try { String sql = "SELECT folder.[jcr:name] FROM [nt:folder] AS folder"; Query query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2); NodeIterator nodes = query.execute().getNodes(); assertEquals(3, nodes.getSize()); Set<String> names = new TreeSet<>(); while (nodes.hasNext()) { names.add(nodes.nextNode().getName()); } assertArrayEquals(new String[] { "folder2", "folder3_1", "folder3_1_1" }, names.toArray(new String[0])); } finally { folder1.remove(); folder2.remove(); folder3.remove(); session.save(); } }
@Override public org.modeshape.jcr.api.query.Query createQuery( String statement, String language ) throws InvalidQueryException, RepositoryException { CheckArg.isNotNull(statement, "statement"); CheckArg.isNotNull(language, "language"); return createQuery(statement, language, null, null); }
JcrQueryManager implements QueryManager { @Override public org.modeshape.jcr.api.query.Query createQuery( String statement, String language ) throws InvalidQueryException, RepositoryException { CheckArg.isNotNull(statement, "statement"); CheckArg.isNotNull(language, "language"); return createQuery(statement, language, null, null); } }
JcrQueryManager implements QueryManager { @Override public org.modeshape.jcr.api.query.Query createQuery( String statement, String language ) throws InvalidQueryException, RepositoryException { CheckArg.isNotNull(statement, "statement"); CheckArg.isNotNull(language, "language"); return createQuery(statement, language, null, null); } JcrQueryManager( JcrSession session ); }
JcrQueryManager implements QueryManager { @Override public org.modeshape.jcr.api.query.Query createQuery( String statement, String language ) throws InvalidQueryException, RepositoryException { CheckArg.isNotNull(statement, "statement"); CheckArg.isNotNull(language, "language"); return createQuery(statement, language, null, null); } JcrQueryManager( JcrSession session ); @Override org.modeshape.jcr.api.query.qom.QueryObjectModelFactory getQOMFactory(); @Override org.modeshape.jcr.api.query.Query createQuery( String statement,
                                                          String language ); @Override org.modeshape.jcr.api.query.Query createQuery( String statement, 
                                                          String language,
                                                          Locale locale ); org.modeshape.jcr.api.query.Query createQuery( String expression,
                                                          String language,
                                                          Path storedAtPath, 
                                                          Locale locale ); Query createQuery( QueryCommand command ); @Override org.modeshape.jcr.api.query.Query getQuery( Node node ); @Override String[] getSupportedQueryLanguages(); }
JcrQueryManager implements QueryManager { @Override public org.modeshape.jcr.api.query.Query createQuery( String statement, String language ) throws InvalidQueryException, RepositoryException { CheckArg.isNotNull(statement, "statement"); CheckArg.isNotNull(language, "language"); return createQuery(statement, language, null, null); } JcrQueryManager( JcrSession session ); @Override org.modeshape.jcr.api.query.qom.QueryObjectModelFactory getQOMFactory(); @Override org.modeshape.jcr.api.query.Query createQuery( String statement,
                                                          String language ); @Override org.modeshape.jcr.api.query.Query createQuery( String statement, 
                                                          String language,
                                                          Locale locale ); org.modeshape.jcr.api.query.Query createQuery( String expression,
                                                          String language,
                                                          Path storedAtPath, 
                                                          Locale locale ); Query createQuery( QueryCommand command ); @Override org.modeshape.jcr.api.query.Query getQuery( Node node ); @Override String[] getSupportedQueryLanguages();  }