}
}
public void createHomeDirectory(User user) {
WikiNodeDAO nodeDAO = (WikiNodeDAO)Component.getInstance(WikiNodeDAO.class);
WikiURLRenderer urlRenderer = (WikiURLRenderer)Component.getInstance(WikiURLRenderer.class);
// Create home directory
WikiDirectory memberArea = (WikiDirectory)Component.getInstance("memberArea");
WikiDirectory homeDirectory = new WikiDirectory();
homeDirectory.setName(user.getUsername());
homeDirectory.setWikiname(WikiUtil.convertToWikiName(homeDirectory.getName()));
homeDirectory.setAreaNumber(memberArea.getAreaNumber());
homeDirectory.setCreatedBy(user);
homeDirectory.setWriteAccessLevel(Role.ADMINROLE_ACCESSLEVEL);
homeDirectory.setReadAccessLevel(Role.GUESTROLE_ACCESSLEVEL);
homeDirectory.setParent(memberArea);
user.setMemberHome(homeDirectory);
// Create feed for home directory
WikiFeed feed = new WikiFeed();
feed.setLink(urlRenderer.renderURL(homeDirectory));
feed.setDirectory(homeDirectory);
feed.setAuthor(homeDirectory.getCreatedBy().getFullname());
feed.setTitle(homeDirectory.getName());
homeDirectory.setFeed(feed);
nodeDAO.makePersistent(homeDirectory);
// Create home page
WikiDocument homePage = new WikiDocument();
homePage.setName("Home of " + user.getUsername());
homePage.setWikiname(WikiUtil.convertToWikiName(homePage.getName()));
homePage.setCreatedBy(user);
homePage.setAreaNumber(homeDirectory.getAreaNumber());
homePage.setContent(Preferences.instance().get(UserManagementPreferences.class).getHomepageDefaultContent());
homePage.setWriteAccessLevel(Role.ADMINROLE_ACCESSLEVEL);
homePage.setReadAccessLevel(Role.GUESTROLE_ACCESSLEVEL);
MacroWikiTextRenderer renderer = MacroWikiTextRenderer.renderMacros(homePage.getContent());
homePage.setContentMacros(renderer.getMacros());
homePage.setParent(homeDirectory);
homeDirectory.setDefaultFile(homePage);
nodeDAO.makePersistent(homePage);
}