// Construct a list of authors
// As we want the tag cloud to render differences between the authors, we give
// as different weight to each author by adding it a random # of times in the list
// We read the author names from the database
ArrayList<String> users = new ArrayList<String>();
View authorView = db.getView("AllContacts");
authorView.refresh();
int maxAuthors = 15;
int nAuthor = 0;
ViewEntryCollection ec = authorView.getAllEntries();
for (ViewEntry e : ec) {
Vector<?> values = e.getColumnValues();
String name = (String) values.get(7);
// Add it a random number of times to the list
int n = ((int) (Math.random() * maxAuthors)) + 1;
for (int jj = 0; jj < n; jj++) {
users.add(name);
}
nAuthor++;
if (nAuthor > maxAuthors) {
break;
}
}
if (users.size() == 0) {
// Just in case they were not created...
users.add("John Doe");
}
View w = db.getView("AllThreads");
w.getAllEntries().removeAll(true);
createDiscussionDocument(db, null, users, new int[] { 0 }, disc_rootDocs);
}