// 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);
}