@Test @FixFor( "MODE-1727" ) public void shouldPerformOrderByUsingCustomLocale() throws Exception { Node testRoot = session.getRootNode().addNode("words", "nt:unstructured"); Node word1 = testRoot.addNode("word1", "modetest:simpleType"); word1.setProperty("fieldA", "peach"); Node word2 = testRoot.addNode("word2", "modetest:simpleType"); word2.setProperty("fieldA", "péché"); Node word3 = testRoot.addNode("word3", "modetest:simpleType"); word3.setProperty("fieldA", "pêche"); Node word4 = testRoot.addNode("word4", "modetest:simpleType"); word4.setProperty("fieldA", "sin"); session.save(); String sql = "SELECT word.[jcr:path] FROM [modetest:simpleType] as word ORDER BY word.fieldA ASC"; try { Query query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2); QueryResult result = query.execute(); validateQuery() .rowCount(4) .hasNodesAtPaths("/words/word1", "/words/word2", "/words/word3", "/words/word4").validate(query, result); query = session.getWorkspace().getQueryManager().createQuery(sql, Query.JCR_SQL2, Locale.FRENCH); result = query.execute(); validateQuery() .rowCount(4) .hasNodesAtPaths("/words/word1", "/words/word3", "/words/word2", "/words/word4").validate(query, result); } finally { session.getNode("/words").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();  }