* @return list of Page
*/
private List<Page> convertPages(List<PageTemplate> pageTemplates, Page page){
List<Page> pages = new ArrayList<Page>();
for(PageTemplate pt : pageTemplates){
Page lPage = new PageImpl();
lPage.setName(pt.getName());
lPage.setPageType(pt.getPageType());
lPage.setOwnerId(page.getOwnerId());
lPage.setPageLayout(pt.getPageLayout());
lPage.setParentPage(page);
lPage.setRegions(convertRegions(pt.getPageTemplateRegions(), lPage));
// create new pageUser tuple
PageUser pageUser = new PageUserImpl(lPage.getOwnerId(), lPage, pt.getRenderSequence());
pageUser.setPageStatus(PageInvitationStatus.OWNER);
pageUser.setEditor(true);
List<PageUser> members = new ArrayList<PageUser>();
members.add(pageUser);
lPage.setMembers(members);
// recursive call
lPage.setSubPages((pt.getSubPageTemplates() == null || pt.getSubPageTemplates().isEmpty()) ? null : convertPages(pt.getSubPageTemplates(), lPage));
pages.add(lPage);
}
return pages;
}