Package org.jamwiki.model

Examples of org.jamwiki.model.Watchlist


   */
  private boolean isWatchedTopic() throws JspException {
    HttpServletRequest request = (HttpServletRequest)this.pageContext.getRequest();
    String virtualWiki = WikiUtil.getVirtualWikiFromRequest(request);
    try {
      Watchlist watchlist = ServletUtil.currentWatchlist(request, virtualWiki);
      return (watchlist.containsTopic(this.topic));
    } catch (WikiException e) {
      logger.severe("Failure processing watchlist item " + this.topic, e);
      throw new JspException(e);
    }
  }
View Full Code Here


    if (userDetails.hasRole(RoleImpl.ROLE_ANONYMOUS)) {
      throw new WikiException(new WikiMessage("watchlist.error.loginrequired"));
    }
    String topicName = WikiUtil.getTopicFromRequest(request);
    String virtualWiki = pageInfo.getVirtualWikiName();
    Watchlist watchlist = ServletUtil.currentWatchlist(request, virtualWiki);
    WikiUser user = ServletUtil.currentWikiUser();
    WikiBase.getDataHandler().writeWatchlistEntry(watchlist, virtualWiki, topicName, user.getUserId());
    String article = WikiUtil.extractTopicLink(topicName);
    if (watchlist.containsTopic(topicName)) {
      // added to watchlist
      next.addObject("message", new WikiMessage("watchlist.caption.added", article));
    } else {
      // removed from watchlist
      next.addObject("message", new WikiMessage("watchlist.caption.removed", article));
View Full Code Here

   *           Thrown if any error occurs during processing.
   */
  public static Watchlist currentWatchlist(HttpServletRequest request, String virtualWiki) throws WikiException {
    // try to get watchlist stored in session
    if (request.getSession(false) != null) {
      Watchlist watchlist = (Watchlist) request.getSession(false).getAttribute(WikiUtil.PARAMETER_WATCHLIST);
      if (watchlist != null) {
        return watchlist;
      }
    }
    // no watchlist in session, retrieve from database
    WikiUserDetails userDetails = ServletUtil.currentUserDetails();
    Watchlist watchlist = new Watchlist();
    if (userDetails.hasRole(RoleImpl.ROLE_ANONYMOUS)) {
      return watchlist;
    }
    WikiUser user = ServletUtil.currentWikiUser();
    try {
View Full Code Here

TOP

Related Classes of org.jamwiki.model.Watchlist

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.