@Test public void filterStatement() throws Exception { Execution execution = this.mocker.getInstance(Execution.class); ExecutionContext executionContext = mock(ExecutionContext.class); when(execution.getContext()).thenReturn(executionContext); XWikiContext xwikiContext = mock(XWikiContext.class); when(executionContext.getProperty("xwikicontext")).thenReturn(xwikiContext); com.xpn.xwiki.XWiki xwiki = mock(com.xpn.xwiki.XWiki.class); when(xwikiContext.getWiki()).thenReturn(xwiki); when(xwiki.getDefaultLocale(any(XWikiContext.class))).thenReturn(Locale.FRANCE); String result = this.mocker.getComponentUnderTest().filterStatement( "select doc.fullName from XWikiDocument doc where 1=1", Query.HQL); assertEquals("select doc.fullName from XWikiDocument doc where (doc.language is null or doc.language = '' or " + "doc.language = 'fr_FR') and (1=1)", result); }
@Override public String filterStatement(String statement, String language) { return insertWhereClause(String.format("(doc.language is null or doc.language = '' or doc.language = '%s')", getCurrentLanguage().toString()), statement, language); }
CurrentLanguageQueryFilter extends AbstractWhereQueryFilter { @Override public String filterStatement(String statement, String language) { return insertWhereClause(String.format("(doc.language is null or doc.language = '' or doc.language = '%s')", getCurrentLanguage().toString()), statement, language); } }
CurrentLanguageQueryFilter extends AbstractWhereQueryFilter { @Override public String filterStatement(String statement, String language) { return insertWhereClause(String.format("(doc.language is null or doc.language = '' or doc.language = '%s')", getCurrentLanguage().toString()), statement, language); }  }
CurrentLanguageQueryFilter extends AbstractWhereQueryFilter { @Override public String filterStatement(String statement, String language) { return insertWhereClause(String.format("(doc.language is null or doc.language = '' or doc.language = '%s')", getCurrentLanguage().toString()), statement, language); }  @Override String filterStatement(String statement, String language); @Override List filterResults(List results); }
CurrentLanguageQueryFilter extends AbstractWhereQueryFilter { @Override public String filterStatement(String statement, String language) { return insertWhereClause(String.format("(doc.language is null or doc.language = '' or doc.language = '%s')", getCurrentLanguage().toString()), statement, language); }  @Override String filterStatement(String statement, String language); @Override List filterResults(List results);  }