If it is, we
set the nextWord variable to the token, starting with the next character, so for instance, ~Dog
will cause nextWord to be Dog, which will then be inserted into the text.
Now, if we figure out that the word should be an article link, nextWord is set to the markup
for such a link, which you can see. Ultimately, whatever the outcome of all that logic was, the
value of nextWord is appended to our StringBuffer that is building up (which is why we
needed to keep whitespace, by the way; otherwise, ???Who??™s more foolish, the fool or the fool
who follows him???? would wind up being ???Who??™smorefoolishthefoolorthefoolwhofollowshim????),
the net result of which is that the StringBuffer winds up containing the text of the
article, with all article links expanded into actual clickable links, and that??™s what the method
ultimately returns.
getAllArticles() Method
Following the expandLinks() method is getAllArticles(), which you??™ll recall is called from
getArticle() when the list of all articles is requested.
private Article getAllArticles() throws Exception {
log.trace("ArticleDAO.getAllArticles() - Entry");
try {
List articles = databaseWorker.executeQuery(
SQL_GET_ARTICLES, new HashMap());
if (log.
Pages:
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450