getName() of the HttpServletRequest object, which is the final parameter
to the method and so is provided once again by DWR.
updateArticle() Method
We??™ve jumped around a bit here and skipped the updateArticle() method, the one that??™s
called when a user edits an article and clicks the Save button, so let??™s go back to that now:
public void updateArticle(final Article inArticle,
final boolean inWriteHistory, final HttpServletRequest inRequest)
throws Exception {
log.trace("articleDAO.updateArticle() - Entry");
try {
if (log.isDebugEnabled()) {
log.debug("ArticleDAO.updateArticle() - inArticle = " + inArticle);
}
String originalText =
getArticle(inArticle.getTitle(), null, null, false).getText();
CHAPTER 5 n SHARE YOUR KNOWLEDGE: DWIKI, THE DWR-BASED WIKI 252
HashMap
vals = new HashMap();
vals.put("text", inArticle.getText());
vals.put("title", inArticle.getTitle());
vals.put("lastEditedBy", inRequest.getUserPrincipal().getName());
if (inArticle.getLockedBy() == null) {
vals.put("lockedBy", "");
vals.put("lockTime",
new Timestamp(new java.util.Date().getTime()).toString());
} else {
vals.put("lockedBy", inArticle.getLockedBy());
vals.
Pages:
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456