ApplicationMessage.WARNING));
uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
Util.getPortalRequestContext().ignoreAJAXUpdateOnPortlets(true);
UserNode currentNode = uiPortal.getSelectedUserNode();
SiteKey siteKey = currentNode.getNavigation().getKey();
PageNodeEvent<UIPortalApplication> pnevent = new PageNodeEvent<UIPortalApplication>(uiPortalApp,
PageNodeEvent.CHANGE_NODE, siteKey, currentNode.getURI());
uiPortalApp.broadcast(pnevent, Event.Phase.PROCESS);
JavascriptManager jsManager = event.getRequestContext().getJavascriptManager();
jsManager.require("SHARED/portal", "portal").addScripts(
"eXo.portal.portalMode=" + UIPortalApplication.NORMAL_MODE + ";");
return;
}
UIPortalComposer composer = uiWorkingWS.findFirstComponentOfType(UIPortalComposer.class).setRendered(false);
composer.setEditted(false);
// If it is a page creation wizard
if (composer.isUsedInWizard()) {
UIWizard wizard = (UIWizard) uiToolPanel.getUIComponent();
int step = wizard.getCurrentStep();
step++;
Event<UIComponent> uiEvent = wizard.createEvent("ViewStep" + step, Phase.PROCESS, event.getRequestContext());
uiEvent.broadcast();
return;
}
// Perform model update
UserPortalConfigService configService = uiWorkingWS.getApplicationComponent(UserPortalConfigService.class);
DataStorage dataService = uiWorkingWS.getApplicationComponent(DataStorage.class);
PageService pageService = uiWorkingWS.getApplicationComponent(PageService.class);
try {
PageState pageState = new PageState(page.getTitle(), page.getDescription(), page.isShowMaxWindow(),
page.getFactoryId(), page.getAccessPermissions() != null ? Arrays.asList(page.getAccessPermissions())
: null, page.getEditPermission());
pageService.savePage(new PageContext(pageKey, pageState));
dataService.save(page);
} catch (StaleModelException ex) {
// Temporary solution to concurrency-related issue
// This catch block should be put in an appropriate ApplicationLifecyclec
}
uiToolPanel.setUIComponent(null);
// Synchronize model object with UIPage object, that seems redundant but in fact
// mandatory to have consequent edit actions (on the same page) work properly
uiPage.getChildren().clear();
page = dataService.getPage(page.getPageId());
PageContext pageContext = configService.getPage(pageKey);
pageContext.update(page);
PortalDataMapper.toUIPage(uiPage, page);
// Invalidate UIPage cache on UIPortal
uiPortalApp.invalidateUIPage(pageId);
if (PortalProperties.SESSION_ALWAYS.equals(uiPortal.getSessionAlive())) {
uiPortalApp.setSessionOpen(true);
} else {
uiPortalApp.setSessionOpen(false);
}
uiPortalApp.setModeState(UIPortalApplication.NORMAL_MODE);
uiWorkingWS.setRenderedChild(UIPortalApplication.UI_VIEWING_WS_ID);
Util.getPortalRequestContext().ignoreAJAXUpdateOnPortlets(true);
UserNode currentNode = uiPortal.getSelectedUserNode();
SiteKey siteKey = currentNode.getNavigation().getKey();
PageNodeEvent<UIPortalApplication> pnevent = new PageNodeEvent<UIPortalApplication>(uiPortalApp,
PageNodeEvent.CHANGE_NODE, siteKey, currentNode.getURI());
uiPortalApp.broadcast(pnevent, Event.Phase.PROCESS);
JavascriptManager jsManager = event.getRequestContext().getJavascriptManager();
jsManager.require("SHARED/portal", "portal").addScripts(
"eXo.portal.portalMode=" + UIPortalApplication.NORMAL_MODE + ";");