Prev | Current Page 447 | Next

Frank Zammetti

"Practical DWR 2 Projects"

Likewise, when an
article is being locked, the incoming Article object will contain values in the lockedBy and
lockTime fields; otherwise it won??™t, and when it doesn??™t, which is the case when the updates to
the article are actually being saved, we need to make sure those two fields get cleared in the
database, so the if statement branches to clear them.
lockArticleForEditing() Method
Speaking of locking an article, that??™s accomplished by a call to lockArticleForEditing(),
which is a logical segue from updateArticle() since they play together.
public String lockArticleForEditing(final String inArticleTitle,
final HttpServletRequest inRequest) throws Exception {
log.trace("ArticleDAO.lockArticleForEditing() - Entry");
try {
Article article = getArticle(inArticleTitle, null, null, false);
String retVal = "";
if (article.getLockedBy() == null ||
article.getLockedBy().equals(inRequest.getUserPrincipal().getName())) {
log.debug("Article NOT locked, acquiring lock on behalf of user");
article.setLockedBy(inRequest.getUserPrincipal().getName());
article.setLockTime(new Timestamp(new java.util.Date().getTime()));
updateArticle(article, false, inRequest);
retVal = "ok=" + Config.


Pages:
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459