UIWizardPageSetInfo uiPageInfo = getChild(UIWizardPageSetInfo.class);
UIPageNodeSelector uiNodeSelector = uiPageInfo.getChild(UIPageNodeSelector.class);
PageNode selectedNode = uiNodeSelector.getSelectedPageNode();
PageNavigation pageNav = uiNodeSelector.getSelectedNavigation();
if (PortalConfig.USER_TYPE.equals(pageNav.getOwnerType()))
selectedNode = null;
Page page = (Page)PortalDataMapper.buildModelObject(uiPage);
PageNode pageNode = uiPageInfo.getPageNode();
pageNode.setPageReference(page.getPageId());
if (selectedNode != null)
{
List<PageNode> children = selectedNode.getChildren();
if (children == null)
{
children = new ArrayList<PageNode>();
}
children.add(pageNode);
selectedNode.setChildren((ArrayList<PageNode>)children);
}
else
{
pageNav.addNode(pageNode);
}
uiNodeSelector.selectPageNodeByUri(pageNode.getUri());
DataStorage dataService = getApplicationComponent(DataStorage.class);
dataService.create(page);