UIPortalToolPanel uiToolPanel = uiWorkingWS.findFirstComponentOfType(UIPortalToolPanel.class);
UIPortalComposer composer = uiWorkingWS.findFirstComponentOfType(UIPortalComposer.class);
UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
UIPortal uiPortal = uiPortalApp.getCurrentSite();
DataStorage dataService = uiWorkingWS.getApplicationComponent(DataStorage.class);
PageService pageService = uiWorkingWS.getApplicationComponent(PageService.class);
UIPage uiPage;
if (!UIPage.isFullPreview()) {
uiPage = uiToolPanel.findFirstComponentOfType(UIPage.class);
} else {
uiPage = uiWorkingWS.findFirstComponentOfType(UIPage.class);
}
Page page = (Page) PortalDataMapper.buildModelObject(uiPage);
String pageId = page.getPageId();
PageKey pageKey = PageKey.parse(pageId);
PageState pageState = PageUtils.toPageState(page);
PageContext pageContext = new PageContext(pageKey, pageState);
pageService.savePage(pageContext);
dataService.save(page);
composer.setEditted(false);
//
uiToolPanel.setUIComponent(null);