Examples of TopicVersion


Examples of org.jamwiki.model.TopicVersion

      next.addObject("messageObject", new WikiMessage("move.exception.destinationexists", moveDestination));
      return false;
    }
    String moveComment = request.getParameter("moveComment");
    WikiUser user = ServletUtil.currentWikiUser();
    TopicVersion topicVersion = new TopicVersion(user, ServletUtil.getIpAddress(request), moveComment, fromTopic.getTopicContent(), 0);
    topicVersion.setEditType(TopicVersion.EDIT_MOVE);
    WikiBase.getDataHandler().moveTopic(fromTopic, topicVersion, moveDestination);
    return true;
  }
View Full Code Here

Examples of org.jamwiki.model.TopicVersion

    }
    Long topicVersionId2 = 0L;
    if (!StringUtils.isBlank(request.getParameter("version2"))) {
      topicVersionId2 = Long.valueOf(request.getParameter("version2"));
    }
    TopicVersion version1 = WikiBase.getDataHandler().lookupTopicVersion(topicVersionId1);
    TopicVersion version2 = WikiBase.getDataHandler().lookupTopicVersion(topicVersionId2);
    if (version1 == null && version2 == null) {
      String msg = "Versions " + topicVersionId1 + " and " + topicVersionId2 + " not found for " + topicName;
      logger.severe(msg);
      throw new Exception(msg);
    }
    String contents1 = (version1 != null) ? version1.getVersionContent() : null;
    String contents2 = (version2 != null) ? version2.getVersionContent() : null;
    if (contents1 == null && contents2 == null) {
      String msg = "No versions found for " + topicVersionId1 + " against " + topicVersionId2;
      logger.severe(msg);
      throw new Exception(msg);
    }
View Full Code Here

Examples of org.jamwiki.model.TopicVersion

    int charactersChanged = StringUtils.length(contents) - StringUtils.length(topic.getTopicContent());
    topic.setTopicContent(contents);
    topic.setReadOnly(true);
    topic.setTopicType(Topic.TYPE_SYSTEM_FILE);
    WikiUser user = ServletUtil.currentWikiUser();
    TopicVersion topicVersion = new TopicVersion(user, ServletUtil.getIpAddress(request), null, contents, charactersChanged);
    WikiBase.getDataHandler().writeTopic(topic, topicVersion, null, null);
  }
View Full Code Here

Examples of org.jamwiki.model.TopicVersion

    }
    int charactersChanged = 0 - StringUtils.length(topic.getTopicContent());
    String contents = "";
    topic.setTopicContent(contents);
    WikiUser user = ServletUtil.currentWikiUser();
    TopicVersion topicVersion = new TopicVersion(user, ServletUtil.getIpAddress(request), request.getParameter("deleteComment"), contents, charactersChanged);
    topicVersion.setEditType(TopicVersion.EDIT_DELETE);
    WikiBase.getDataHandler().deleteTopic(topic, topicVersion);
  }
View Full Code Here

Examples of org.jamwiki.model.TopicVersion

      throw new WikiException(new WikiMessage("common.exception.notopic"));
    }
    topic.setReadOnly(request.getParameter("readOnly") != null);
    topic.setAdminOnly(request.getParameter("adminOnly") != null);
    WikiUser user = ServletUtil.currentWikiUser();
    TopicVersion topicVersion = new TopicVersion(user, ServletUtil.getIpAddress(request), null, topic.getTopicContent(), 0);
    topicVersion.setEditType(TopicVersion.EDIT_PERMISSION);
    WikiBase.getDataHandler().writeTopic(topic, topicVersion, null, null);
    next.addObject("message", new WikiMessage("manage.message.updated", topicName));
    view(request, next, pageInfo);
  }
View Full Code Here

Examples of org.jamwiki.model.TopicVersion

    Topic topic = WikiBase.getDataHandler().lookupTopic(virtualWiki, topicName, true, null);
    if (!topic.getDeleted()) {
      logger.warning("Attempt to undelete a topic that is not deleted: " + virtualWiki + " / " + topicName);
      return;
    }
    TopicVersion previousVersion = WikiBase.getDataHandler().lookupTopicVersion(topic.getCurrentVersionId());
    while (previousVersion != null && previousVersion.getPreviousTopicVersionId() != null && previousVersion.getEditType() == TopicVersion.EDIT_DELETE) {
      // loop back to find the last non-delete edit
      previousVersion = WikiBase.getDataHandler().lookupTopicVersion(previousVersion.getPreviousTopicVersionId());
    }
    String contents = previousVersion.getVersionContent();
    topic.setTopicContent(contents);
    WikiUser user = ServletUtil.currentWikiUser();
    int charactersChanged = StringUtils.length(contents);
    TopicVersion topicVersion = new TopicVersion(user, ServletUtil.getIpAddress(request), request.getParameter("undeleteComment"), contents, charactersChanged);
    topicVersion.setEditType(TopicVersion.EDIT_UNDELETE);
    WikiBase.getDataHandler().undeleteTopic(topic, topicVersion);
  }
View Full Code Here

Examples of org.jamwiki.model.TopicVersion

    // topic.setRedirectTo(null);
    // topic.setTopicType(Topic.TYPE_ARTICLE);
    // }
    int charactersChanged = StringUtils.length(contents)
        - StringUtils.length(lastTopicContent);
    TopicVersion topicVersion = new TopicVersion(user, ServletUtil
        .getIpAddress(request), request.getParameter("editComment"), contents,
        charactersChanged);
    if (request.getParameter("minorEdit") != null) {
      topicVersion.setEditType(TopicVersion.EDIT_MINOR);
    }
    WikiBase.getDataHandler().writeTopic(topic, topicVersion,
        parserOutput.getCategories(), parserOutput.getLinks());
    // // update watchlist
    WikiUserDetails userDetails = ServletUtil.currentUserDetails();
View Full Code Here

Examples of org.jamwiki.model.TopicVersion

      String[] sliceResults = ParserUtil.parseSlice(request.getContextPath(),
          request.getLocale(), virtualWiki, topicName, section);
      contents2 = sliceResults[1];
    } else if (lastTopicVersionId != null) {
      // get the full topic version
      TopicVersion lastTopicVersion = WikiBase.getDataHandler()
          .lookupTopicVersion(lastTopicVersionId);
      contents2 = lastTopicVersion.getVersionContent();
    }
    this.loadDiff(request, next, pageInfo, contents1, contents2);
    next.addObject("editShowChanges", "true");
  }
View Full Code Here

Examples of org.jamwiki.model.TopicVersion

    // display an older version
    String virtualWiki = pageInfo.getVirtualWikiName();
    String topicName = WikiUtil.getTopicFromRequest(request);
    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());
    WikiMessage pageTitle = new WikiMessage("topic.title", topicName + " @"
        + versionDate);
    ServletUtil.viewTopic(request, next, pageInfo, pageTitle, topic, false,
        false);
  }
View Full Code Here

Examples of org.jamwiki.model.TopicVersion

    topic.setVirtualWiki(virtualWiki);
    topic.setTopicContent(contents);
    topic.setAdminOnly(adminOnly);
    int charactersChanged = StringUtils.length(contents);
    // FIXME - hard coding
    TopicVersion topicVersion = new TopicVersion(user, user
        .getLastLoginIpAddress(), "Automatically created by system setup",
        contents, charactersChanged);
    // FIXME - it is not connection-safe to parse for metadata since we are
    // already holding a connection
    // ParserOutput parserOutput =
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.