uiPage = (UIPage) uiPageBody.getUIComponent();
}
UIWizardPageSetInfo uiPageInfo = getChild(UIWizardPageSetInfo.class);
UIPageNodeSelector uiNodeSelector = uiPageInfo.getChild(UIPageNodeSelector.class);
UserNode selectedNode = uiNodeSelector.getSelectedNode();
Page page = (Page) PortalDataMapper.buildModelObject(uiPage);
UserNode createdNode = uiPageInfo.createUserNode(selectedNode);
createdNode.setPageRef(page.getPageKey());
//
PageService pageService = getApplicationComponent(PageService.class);
PageState pageState = PageUtils.toPageState(page);
pageService.savePage(new PageContext(page.getPageKey(), pageState));
//
DataStorage dataService = getApplicationComponent(DataStorage.class);
dataService.save(page);
UserPortal userPortal = Util.getPortalRequestContext().getUserPortalConfig().getUserPortal();
userPortal.saveNode(selectedNode, null);
DescriptionService descriptionService = getApplicationComponent(DescriptionService.class);
Map<Locale, Described.State> descriptions = new HashMap<Locale, Described.State>();
Map<String, String> cachedLabels = uiPageInfo.getCachedLabels();
for (String strLocale : cachedLabels.keySet()) {
Locale locale;
if (strLocale.contains("_")) {
String[] arr = strLocale.split("_");
if (arr.length > 2) {
locale = new Locale(arr[0], arr[1], arr[2]);
} else {
locale = new Locale(arr[0], arr[1]);
}
} else {
locale = new Locale(strLocale);
}
descriptions.put(locale, new Described.State(cachedLabels.get(strLocale), null));
}
descriptionService.setDescriptions(createdNode.getId(), descriptions);
return createdNode;
}