@Test public void filterStatementNonHQL() { String statement = "select doc.fullName from XWikiDocument doc ..."; assertSame(statement, this.queryFilter.filterStatement(statement, Query.XWQL)); }
@Override public String filterStatement(String statement, String language) { if (Query.HQL.equals(language)) { int selectEnd = statement.indexOf(" from "); if (selectEnd > 0) { StringBuilder filteredStatement = new StringBuilder(statement); filteredStatement.insert(selectEnd, ", attachment.filename"); int fromDocTable = filteredStatement.indexOf(FROM_DOC_TABLE); if (fromDocTable > 0) { filteredStatement.insert(fromDocTable + FROM_DOC_TABLE.length(), ", XWikiAttachment attachment"); return insertWhereClause("doc.id = attachment.docId", filteredStatement.toString(), language); } } } return statement; }
AttachmentQueryFilter extends AbstractWhereQueryFilter { @Override public String filterStatement(String statement, String language) { if (Query.HQL.equals(language)) { int selectEnd = statement.indexOf(" from "); if (selectEnd > 0) { StringBuilder filteredStatement = new StringBuilder(statement); filteredStatement.insert(selectEnd, ", attachment.filename"); int fromDocTable = filteredStatement.indexOf(FROM_DOC_TABLE); if (fromDocTable > 0) { filteredStatement.insert(fromDocTable + FROM_DOC_TABLE.length(), ", XWikiAttachment attachment"); return insertWhereClause("doc.id = attachment.docId", filteredStatement.toString(), language); } } } return statement; } }
AttachmentQueryFilter extends AbstractWhereQueryFilter { @Override public String filterStatement(String statement, String language) { if (Query.HQL.equals(language)) { int selectEnd = statement.indexOf(" from "); if (selectEnd > 0) { StringBuilder filteredStatement = new StringBuilder(statement); filteredStatement.insert(selectEnd, ", attachment.filename"); int fromDocTable = filteredStatement.indexOf(FROM_DOC_TABLE); if (fromDocTable > 0) { filteredStatement.insert(fromDocTable + FROM_DOC_TABLE.length(), ", XWikiAttachment attachment"); return insertWhereClause("doc.id = attachment.docId", filteredStatement.toString(), language); } } } return statement; }  }
AttachmentQueryFilter extends AbstractWhereQueryFilter { @Override public String filterStatement(String statement, String language) { if (Query.HQL.equals(language)) { int selectEnd = statement.indexOf(" from "); if (selectEnd > 0) { StringBuilder filteredStatement = new StringBuilder(statement); filteredStatement.insert(selectEnd, ", attachment.filename"); int fromDocTable = filteredStatement.indexOf(FROM_DOC_TABLE); if (fromDocTable > 0) { filteredStatement.insert(fromDocTable + FROM_DOC_TABLE.length(), ", XWikiAttachment attachment"); return insertWhereClause("doc.id = attachment.docId", filteredStatement.toString(), language); } } } return statement; }  @Override String filterStatement(String statement, String language); @Override List filterResults(List results); }
AttachmentQueryFilter extends AbstractWhereQueryFilter { @Override public String filterStatement(String statement, String language) { if (Query.HQL.equals(language)) { int selectEnd = statement.indexOf(" from "); if (selectEnd > 0) { StringBuilder filteredStatement = new StringBuilder(statement); filteredStatement.insert(selectEnd, ", attachment.filename"); int fromDocTable = filteredStatement.indexOf(FROM_DOC_TABLE); if (fromDocTable > 0) { filteredStatement.insert(fromDocTable + FROM_DOC_TABLE.length(), ", XWikiAttachment attachment"); return insertWhereClause("doc.id = attachment.docId", filteredStatement.toString(), language); } } } return statement; }  @Override String filterStatement(String statement, String language); @Override List filterResults(List results);  }