if (RollerSession.getRollerSession(request).isUserAuthorizedToAuthor(website))
{
try
{
BookmarkManager bmgr = roller.getBookmarkManager();
BookmarksForm form = (BookmarksForm)actionForm;
mLogger.debug("Moving folders and bookmarks to folder, id="
+ form.getMoveToFolderId());
// Move subfolders to new folder.
String folders[] = form.getSelectedFolders();
FolderData parent = bmgr.getFolder(form.getMoveToFolderId());
if (null != folders)
{
for (int i = 0; i < folders.length; i++)
{
FolderData fd = bmgr.getFolder(folders[i]);
// Don't move folder into itself.
if ( !fd.getId().equals(parent.getId())
&& !parent.descendentOf(fd))
{
fd.setParent(parent);
bmgr.saveFolder(fd);
}
else
{
messages.add(null, new ActionMessage(
"bookmarksForm.warn.notMoving",fd.getName()));
}
}
}
// Move bookmarks.
String bookmarks[] = form.getSelectedBookmarks();
if (null != bookmarks)
{
for (int j = 0; j < bookmarks.length; j++)
{
// maybe we should be using folder.addBookmark()?