Examples of WikiException


Examples of org.jamwiki.WikiException

  private void view(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception {
    String virtualWiki = pageInfo.getVirtualWikiName();
    Pagination pagination = ServletUtil.loadPagination(request, next);
    WikiUserDetails userDetails = ServletUtil.currentUserDetails();
    if (userDetails.hasRole(RoleImpl.ROLE_ANONYMOUS)) {
      throw new WikiException(new WikiMessage("watchlist.error.loginrequired"));
    }
    WikiUser user = ServletUtil.currentWikiUser();
    List<RecentChange> changes = WikiBase.getDataHandler().getWatchlist(virtualWiki, user.getUserId(), pagination);
    next.addObject("numChanges", changes.size());
    next.addObject("changes", changes);
View Full Code Here

Examples of org.jamwiki.WikiException

    String newPassword = request.getParameter("passwordPassword");
    String confirmPassword = request.getParameter("passwordPasswordConfirm");
    try {
      WikiUser user = WikiBase.getDataHandler().lookupWikiUser(userLogin);
      if (user == null) {
        throw new WikiException(new WikiMessage(
            "admin.password.message.invalidlogin", userLogin));
      }
      WikiUtil.validatePassword(newPassword, confirmPassword);
      String encryptedPassword = Encryption.encrypt(newPassword);
      WikiBase.getDataHandler().writeWikiUser(user, userLogin,
View Full Code Here

Examples of org.jamwiki.WikiException

  private void history(HttpServletRequest request, ModelAndView next,
      WikiPageInfo pageInfo) throws Exception {
    String virtualWiki = pageInfo.getVirtualWikiName();
    String topicName = WikiUtil.getTopicFromRequest(request);
    if (StringUtils.isBlank(topicName)) {
      throw new WikiException(new WikiMessage("common.exception.notopic"));
    }
    pageInfo.setContentJsp(JSP_HISTORY);
    pageInfo.setTopicName(topicName);
    pageInfo.setPageTitle(new WikiMessage("history.title", topicName));
    Pagination pagination = ServletUtil.loadPagination(request, next);
View Full Code Here

Examples of org.jamwiki.WikiException

    Long topicVersionId = Long
        .parseLong(request.getParameter("topicVersionId"));
    TopicVersion topicVersion = WikiBase.getDataHandler().lookupTopicVersion(
        topicVersionId);
    if (topicVersion == null) {
      throw new WikiException(new WikiMessage("common.exception.notopic"));
    }
    Topic topic = WikiBase.getDataHandler().lookupTopic(virtualWiki, topicName,
        false, null);
    if (topic == null) {
      // the topic may have been deleted
      throw new WikiException(new WikiMessage("history.message.notopic",
          topicName));
    }
    topic.setTopicContent(topicVersion.getVersionContent());
    String versionDate = DateFormat.getDateTimeInstance().format(
        topicVersion.getEditDate());
View Full Code Here

Examples of org.jamwiki.WikiException

    }
    WikiUser user = ServletUtil.currentWikiUser();
    try {
      watchlist = WikiBase.getDataHandler().getWatchlist(virtualWiki, user.getUserId());
    } catch (DataAccessException e) {
      throw new WikiException(new WikiMessage("error.unknown", e.getMessage()), e);
    }
    if (request.getSession(false) != null) {
      // add watchlist to session
      request.getSession(false).setAttribute(WikiUtil.PARAMETER_WATCHLIST, watchlist);
    }
View Full Code Here

Examples of org.jamwiki.WikiException

    next.addObject("categoryName", categoryName);
    List<Category> categoryTopics = null;
    try {
      categoryTopics = WikiBase.getDataHandler().lookupCategoryTopics(virtualWiki, topicName);
    } catch (DataAccessException e) {
      throw new WikiException(new WikiMessage("error.unknown", e.getMessage()), e);
    }
    List<Category> categoryImages = new ArrayList<Category>();
    LinkedHashMap<String, String> subCategories = new LinkedHashMap<String, String>();
    int i = 0;
    // loop through the results and split out images and sub-categories
View Full Code Here

Examples of org.jamwiki.WikiException

        // user does not have appropriate permissions
        return false;
      }
      topic = WikiBase.getDataHandler().lookupTopic(virtualWiki, topicName, false, null);
    } catch (Exception e) {
      throw new WikiException(new WikiMessage("error.unknown", e.getMessage()), e);
    }
    if (topic == null) {
      // new topic, edit away...
      return true;
    }
View Full Code Here

Examples of org.jamwiki.WikiException

  protected static void redirect(ModelAndView next, String virtualWiki, String destination) throws WikiException {
    String target = null;
    try {
      target = LinkUtil.buildTopicUrl(null, virtualWiki, destination, true);
    } catch (DataAccessException e) {
      throw new WikiException(new WikiMessage("error.unknown", e.getMessage()), e);
    }
    String view = ServletUtil.SPRING_REDIRECT_PREFIX + target;
    next.clear();
    next.setViewName(view);
  }
View Full Code Here

Examples of org.jamwiki.WikiException

      if (StringUtils.isBlank(topic)) {
        VirtualWiki virtualWiki = null;
        try {
          virtualWiki = WikiBase.getDataHandler().lookupVirtualWiki(virtualWikiName);
        } catch (DataAccessException e) {
          throw new WikiException(new WikiMessage("error.unknown", e.getMessage()), e);
        }
        topic = virtualWiki.getDefaultTopicName();
      }
      target = "/" + virtualWikiName + "/" + topic;
      if (!StringUtils.isBlank(request.getQueryString())) {
View Full Code Here

Examples of org.jamwiki.WikiException

   */
  protected static void viewTopic(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo, WikiMessage pageTitle,
      Topic topic, boolean sectionEdit, boolean allowRedirect) throws WikiException {
    // FIXME - what should the default be for topics that don't exist?
    if (topic == null) {
      throw new WikiException(new WikiMessage("common.exception.notopic"));
    }
    // WikiUtil.validateTopicName(topic.getName());
    // if (allowRedirect
    // && topic.getTopicType() == Topic.TYPE_REDIRECT
    // && (request.getParameter("redirect") == null || !request.getParameter(
    // "redirect").equalsIgnoreCase("no"))) {
    // Topic child = null;
    // try {
    // child = WikiUtil.findRedirectedTopic(topic, 0);
    // } catch (DataAccessException e) {
    // throw new WikiException(
    // new WikiMessage("error.unknown", e.getMessage()), e);
    // }
    // if (!child.getName().equals(topic.getName())) {
    // String redirectUrl = null;
    // try {
    // redirectUrl = LinkUtil.buildTopicUrl(request.getContextPath(), topic
    // .getVirtualWiki(), topic.getName(), true);
    // } catch (DataAccessException e) {
    // throw new WikiException(new WikiMessage("error.unknown", e
    // .getMessage()), e);
    // }
    // // FIXME - hard coding
    // redirectUrl += LinkUtil.appendQueryParam("", "redirect", "no");
    // String redirectName = topic.getName();
    // pageInfo.setRedirectInfo(redirectUrl, redirectName);
    // pageTitle = new WikiMessage("topic.title", child.getName());
    // topic = child;
    // // update the page info's virtual wiki in case this redirect is to
    // // another virtual wiki
    // pageInfo.setVirtualWikiName(topic.getVirtualWiki());
    // }
    // }
    String virtualWiki = topic.getVirtualWiki();
    String topicName = topic.getName();
    // WikiUserDetails userDetails = ServletUtil.currentUserDetails();
    // if (sectionEdit
    // && !ServletUtil.isEditable(virtualWiki, topicName, userDetails)) {
    // sectionEdit = false;
    // }
    WikiUser user = ServletUtil.currentWikiUser();
    ParserInput parserInput = new ParserInput();
    parserInput.setContext(request.getContextPath());
    parserInput.setLocale(request.getLocale());
    parserInput.setWikiUser(user);
    parserInput.setTopicName(topicName);
    parserInput.setUserDisplay(ServletUtil.getIpAddress(request));
    parserInput.setVirtualWiki(virtualWiki);
    parserInput.setAllowSectionEdit(sectionEdit);
    ParserOutput parserOutput = new ParserOutput();
    String content = null;
    try {
      content = ParserUtil.parse(parserInput, parserOutput, topic.getTopicContent());
    } catch (ParserException e) {
      throw new WikiException(new WikiMessage("error.unknown", e.getMessage()), e);
    }
    if (parserOutput.getCategories().size() > 0) {
      LinkedHashMap<String, String> categories = new LinkedHashMap<String, String>();
      for (String key : parserOutput.getCategories().keySet()) {
        String value = key.substring(NamespaceHandler.NAMESPACE_CATEGORY.length() + NamespaceHandler.NAMESPACE_SEPARATOR.length());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.