PageNavigation persistNavigation = dataService.getPageNavigation(editedOwnerType, editedOwnerId);
if (persistNavigation == null)
{
UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
uiApp.addMessage(new ApplicationMessage("UINavigationManagement.msg.NavigationNotExistAnymore", null));
UIPopupWindow uiPopup = uiManagement.getParent();
uiPopup.setShow(false);
UIPortalApplication uiPortalApp = (UIPortalApplication)prContext.getUIApplication();
UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
prContext.setFullRender(true);
return;
}
if(PortalConfig.PORTAL_TYPE.equals(navigation.getOwnerType()))
{
UserPortalConfig portalConfig = portalConfigService.getUserPortalConfig(navigation.getOwnerId(), prContext.getRemoteUser());
if(portalConfig != null)
{
dataService.save(navigation);
}
else
{
UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
uiApp.addMessage(new ApplicationMessage("UIPortalForm.msg.notExistAnymore", null));
UIPopupWindow uiPopup = uiManagement.getParent();
uiPopup.setShow(false);
UIPortalApplication uiPortalApp = (UIPortalApplication)prContext.getUIApplication();
UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
prContext.setFullRender(true);
return;
}
}
else
{
dataService.save(navigation);
}
// Reload navigation here as some navigation could exist in the back end such as system navigations
// that would not be in the current edited UI navigation
navigation = dataService.getPageNavigation(navigation.getOwnerType(), navigation.getOwnerId());
UIPortalApplication uiPortalApp = Util.getUIPortalApplication();
setNavigation(uiPortalApp.getNavigations(), navigation);
// Need to relocalize as it was loaded from storage
uiPortalApp.localizeNavigations();
//Update UIPortal corredponding to edited navigation
UIPortal targetedUIPortal = uiPortalApp.getCachedUIPortal(editedOwnerType, editedOwnerId);
if(targetedUIPortal != null)
{
targetedUIPortal.setNavigation(navigation);
}
UIPopupWindow uiPopup = uiManagement.getParent();
uiPopup.setShow(false);
UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
prContext.addUIComponentToUpdateByAjax(uiWorkingWS);
prContext.setFullRender(true);
}