VFSContainer rootContainer = frm.getFileResourceRootImpl(copy);
//reset properties files to default values
VFSContainer wikiCont = (VFSContainer)rootContainer.resolve(WikiManager.WIKI_RESOURCE_FOLDER_NAME);
List leafs = wikiCont.getItems(new VFSItemSuffixFilter(new String[]{WikiManager.WIKI_PROPERTIES_SUFFIX}));
for (Iterator iter = leafs.iterator(); iter.hasNext();) {
VFSLeaf leaf = (VFSLeaf) iter.next();
WikiPage page = Wiki.assignPropertiesToPage(leaf);
//reset the copied pages to a the default values
page.resetCopiedPage();
WikiManager.getInstance().updateWikiPageProperties(copy, page);
}
//create folders
VFSContainer newMediaCont = rootContainer.createChildContainer(WikiContainer.MEDIA_FOLDER_NAME);
rootContainer.createChildContainer(WikiManager.VERSION_FOLDER_NAME);
//copy media files to folders
VFSContainer origRootContainer = frm.getFileResourceRootImpl(res);
VFSContainer origMediaCont = (VFSContainer)origRootContainer.resolve(WikiContainer.MEDIA_FOLDER_NAME);
List mediaFiles = origMediaCont.getItems();
for (Iterator iter = mediaFiles.iterator(); iter.hasNext();) {
VFSLeaf element = (VFSLeaf) iter.next();
newMediaCont.copyFrom(element);
}
return copy;
}