*/
private boolean movePage(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo, String moveFrom, String moveDestination) throws Exception {
String virtualWiki = pageInfo.getVirtualWikiName();
Topic fromTopic = WikiBase.getDataHandler().lookupTopic(virtualWiki, moveFrom, false, null);
if (fromTopic == null) {
throw new WikiException(new WikiMessage("common.exception.notopic"));
}
if (StringUtils.isBlank(moveDestination)) {
next.addObject("messageObject", new WikiMessage("move.exception.nodestination"));
this.view(request, next, pageInfo);
return false;
}
WikiLink fromWikiLink = LinkUtil.parseWikiLink(moveFrom);
WikiLink destinationWikiLink = LinkUtil.parseWikiLink(moveDestination);
if (!StringUtils.equals(fromWikiLink.getNamespace(), destinationWikiLink.getNamespace())) {
// do not allow moving into or out of image & category namespace
if (StringUtils.equals(fromWikiLink.getNamespace(), NamespaceHandler.NAMESPACE_CATEGORY)
|| StringUtils.equals(fromWikiLink.getNamespace(), NamespaceHandler.NAMESPACE_CATEGORY_COMMENTS)
|| StringUtils.equals(destinationWikiLink.getNamespace(), NamespaceHandler.NAMESPACE_CATEGORY)
|| StringUtils.equals(destinationWikiLink.getNamespace(), NamespaceHandler.NAMESPACE_CATEGORY_COMMENTS)
) {
next.addObject("messageObject", new WikiMessage("move.exception.namespacecategory"));
this.view(request, next, pageInfo);
return false;
} else if (StringUtils.equals(fromWikiLink.getNamespace(), NamespaceHandler.NAMESPACE_IMAGE)
|| StringUtils.equals(fromWikiLink.getNamespace(), NamespaceHandler.NAMESPACE_IMAGE_COMMENTS)
|| StringUtils.equals(destinationWikiLink.getNamespace(), NamespaceHandler.NAMESPACE_IMAGE)
|| StringUtils.equals(destinationWikiLink.getNamespace(), NamespaceHandler.NAMESPACE_IMAGE_COMMENTS)
) {
next.addObject("messageObject", new WikiMessage("move.exception.namespaceimage"));
this.view(request, next, pageInfo);
return false;
}
}
WikiUserDetails userDetails = ServletUtil.currentUserDetails();
if (!ServletUtil.isMoveable(virtualWiki, moveFrom, userDetails)) {
this.view(request, next, pageInfo);
next.addObject("messageObject", new WikiMessage("move.exception.permission", moveFrom));
return false;
}
if (!WikiBase.getDataHandler().canMoveTopic(fromTopic, moveDestination)) {
this.view(request, next, pageInfo);
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);