Hi JV, On Feb 22, 2008, at 12:07 PM, jvdrean (SVN) wrote:
Author: jvdrean Date: 2008-02-22 12:07:00 +0100 (Fri, 22 Feb 2008) New Revision: 7914
Modified: xwiki-platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/ xwiki/plugin/watchlist/WatchListJob.java xwiki-platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/ xwiki/plugin/watchlist/WatchListPlugin.java xwiki-platform/xwiki-plugins/trunk/watchlist/src/main/java/com/xpn/ xwiki/plugin/watchlist/WatchListPluginApi.java Log: XPWATCHLIST-12 : Global user can't watch sub-wiki's documents
[snip]
+ /** + * @return the full list of all database names of all defined virtual wikis. The database names + * are computed from the names of documents having a XWiki.XWikiServerClass object + * attached to them by removing the "XWiki.XWikiServer" prefix and making it lower case. + * For example a page named "XWiki.XWikiServerMyDatabase" would return "mydatabase" as + * the database name. + */ + public List getVirtualWikisDatabaseNames(Context context, XWiki xwiki) throws XWikiException + { + List databaseNames = new ArrayList(); + + String database = context.getDatabase(); + try { + context.setDatabase(context.getMainWikiName()); + + String hql = + ", BaseObject as obj, StringProperty as prop where obj.name=doc.fullName" + + + " and obj.name <> 'XWiki.XWikiServerClassTemplate' and obj.className='XWiki.XWikiServerClass' " + + "and prop.id.id = obj.id "; + List list = xwiki.searchDocuments(hql); + + for (Iterator it = list.iterator(); it.hasNext();) { + String docname = (String) it.next(); + if (docname.startsWith("XWiki.XWikiServer")) { + databaseNames.add(docname.substring("XWiki.XWikiServer".length()) + .toLowerCase()); + } + } + } finally { + context.setDatabase(database); + } + + return databaseNames; + }
This method looks like a duplicate of the code in the XWiki class. Why is that? Thanks -Vincent