ownerId = URLDecoder.decode(ownerId);
UIPortalApplication uiPortalApp = Util.getUIPortal().getAncestorOfType(UIPortalApplication.class);
// ensure this navigation does not exist
NavigationService navigationService = uicomp.getApplicationComponent(NavigationService.class);
NavigationContext navigation = navigationService.loadNavigation(SiteKey.group(ownerId));
if (navigation != null && navigation.getState() != null) {
uiPortalApp.addMessage(new ApplicationMessage("UIPageNavigationForm.msg.existPageNavigation",
new String[] { ownerId }));
} else {
// Create portal config of the group when it does not exist
DataStorage dataService = uicomp.getApplicationComponent(DataStorage.class);
if (dataService.getPortalConfig("group", ownerId) == null) {
UserPortalConfigService configService = uicomp.getApplicationComponent(UserPortalConfigService.class);
configService.createGroupSite(ownerId);
}
// create navigation for group
SiteKey key = SiteKey.group(ownerId);
NavigationContext existing = navigationService.loadNavigation(key);
if (existing == null) {
navigationService.saveNavigation(new NavigationContext(key, new NavigationState(0)));
}
}
// Update group navigation list
ctx.addUIComponentToUpdateByAjax(uicomp);