private Folder importFolders(PageManager pageManager,
PageManager castorPageManager, Folder srcFolder, String userName,
String destination, boolean copyIds) throws JetspeedException
{
Folder dstFolder = lookupFolder(castorPageManager, srcFolder.getPath());
dstFolder = pageManager.copyFolder(srcFolder, destination);
pageManager.updateFolder(dstFolder);
String newPath = "";
Iterator pages = srcFolder.getPages().iterator();
while (pages.hasNext())
{
Page srcPage = (Page) pages.next();
Page dstPage = lookupPage(castorPageManager, srcPage.getPath());
newPath = destination + getRealPath(srcPage.getPath());
dstPage = pageManager.copyPage(srcPage, newPath, copyIds);
pageManager.updatePage(dstPage);
}
Iterator links = srcFolder.getLinks().iterator();
while (links.hasNext())
{
Link srcLink = (Link) links.next();
Link dstLink = lookupLink(castorPageManager, srcLink.getPath());
newPath = destination + getRealPath(srcLink.getPath());
dstLink = pageManager.copyLink(srcLink, newPath);
pageManager.updateLink(dstLink);
}
Iterator folders = srcFolder.getFolders().iterator();
while (folders.hasNext())
{
Folder folder = (Folder) folders.next();
newPath = destination + getRealPath(folder.getPath());
importFolders(pageManager, castorPageManager, folder, userName,
newPath, copyIds);
}
return dstFolder;
}