PortalRequestContext pcontext = (PortalRequestContext)event.getRequestContext();
String template = "classic";
// String template = uiForm.getChild(UIFormInputItemSelector.class).getSelectedItemOption().getValue().toString();
String portalName = uiForm.getUIStringInput(FIELD_NAME).getValue();
DataStorage dataService = uiForm.getApplicationComponent(DataStorage.class);
PortalConfig config = dataService.getPortalConfig(portalName);
if (config != null)
{
UIApplication uiApp = Util.getPortalRequestContext().getUIApplication();
uiApp.addMessage(new ApplicationMessage("UIPortalForm.msg.sameName", null));
return;
}
UserPortalConfigService service = uiForm.getApplicationComponent(UserPortalConfigService.class);
service.createUserPortalConfig(PortalConfig.PORTAL_TYPE, portalName, template);
UserPortalConfig userPortalConfig = service.getUserPortalConfig(portalName, pcontext.getRemoteUser());
PortalConfig pconfig = userPortalConfig.getPortalConfig();
uiForm.invokeSetBindingBean(pconfig);
PageNavigation navigation = dataService.getPageNavigation(PortalConfig.PORTAL_TYPE, portalName);
dataService.save(pconfig);
dataService.save(navigation);
UIPortalApplication uiPortalApp = event.getSource().getAncestorOfType(UIPortalApplication.class);