public UserPortal getUserPortal() { UserPortalConfig upc = getUserPortalConfig(); if (upc != null) { return upc.getUserPortal(); } else { return null; } }
public void execute(Event<UISpaceNavigationManagement> event) throws Exception { PortalRequestContext prContext = Util.getPortalRequestContext(); UISpaceNavigationManagement uiManagement = event.getSource(); UISpaceNavigationNodeSelector uiNodeSelector = uiManagement.getChild(UISpaceNavigationNodeSelector.class); UserPortalConfigService portalConfigService = uiManagement.getApplicationComponent(UserPortalConfigService.class); UIPortalApplication uiPortalApp = (UIPortalApplication) prContext.getUIApplication(); UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID); prContext.addUIComponentToUpdateByAjax(uiWorkingWS); prContext.ignoreAJAXUpdateOnPortlets(true); UserNavigation navigation = uiNodeSelector.getEdittedNavigation(); SiteKey siteKey = navigation.getKey(); String editedOwnerId = siteKey.getName(); // Check existed UserPortalConfig userPortalConfig; if (SiteType.PORTAL.equals(siteKey.getType())) { userPortalConfig = portalConfigService.getUserPortalConfig( editedOwnerId, event.getRequestContext().getRemoteUser()); if (userPortalConfig == null) { prContext .getUIApplication() .addMessage( new ApplicationMessage( "UIPortalForm.msg.notExistAnymore", null, ApplicationMessage.ERROR)); return; } } else { userPortalConfig = portalConfigService.getUserPortalConfig( prContext.getPortalOwner(), event.getRequestContext().getRemoteUser()); } UserNavigation persistNavigation = userPortalConfig.getUserPortal().getNavigation(siteKey); if (persistNavigation == null) { prContext .getUIApplication() .addMessage( new ApplicationMessage( "UINavigationManagement.msg.NavigationNotExistAnymore", null, ApplicationMessage.ERROR)); return; } uiNodeSelector.save(); }
public static UserPortal getUserPortal() { UserPortalConfig portalConfig = Util.getPortalRequestContext().getUserPortalConfig(); return portalConfig.getUserPortal(); }