UIPageTemplateOptions uiPageTemplateOptions = uiWizard.findFirstComponentOfType(UIPageTemplateOptions.class);
UIWizardPageSetInfo uiPageInfo = uiWizard.getChild(UIWizardPageSetInfo.class);
UIPageNodeSelector uiNodeSelector = uiPageInfo.getChild(UIPageNodeSelector.class);
UserNavigation pageNavi = uiNodeSelector.getNavigation();
String ownerType = pageNavi.getKey().getTypeName();
String ownerId = pageNavi.getKey().getName();
UIFormStringInput pageName = uiPageInfo.getUIStringInput(UIWizardPageSetInfo.PAGE_NAME);
Page page = uiPageTemplateOptions.createPageFromSelectedOption(ownerType, ownerId);
page.setName("page" + page.hashCode());
String pageId = ownerType + "::" + ownerId + "::" + page.getName();
// check page is exist
PageService pageService = uiWizard.getApplicationComponent(PageService.class);
if (pageService.loadPage(PageKey.parse(pageId)) != null) {
uiPortalApp.addMessage(new ApplicationMessage("UIPageCreationWizard.msg.NameNotSame", null));
uiWizard.viewStep(FIRST_STEP);
uiWizard.updateWizardComponent();
}
page.setModifiable(true);
// Set default permissions on the page
setDefaultPermission(page, pageNavi.getKey());
if (page.getTitle() == null || page.getTitle().trim().length() == 0) {
page.setTitle(pageName.getValue());
}