public synchronized void execute(Event<UIPortalForm> event) throws Exception {
UIPortalForm uiForm = event.getSource();
PortalRequestContext pcontext = (PortalRequestContext) event.getRequestContext();
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(SiteType.PORTAL.getName(), portalName, template);
PortalConfig pconfig = dataService.getPortalConfig(portalName);
uiForm.invokeSetBindingBean(pconfig);
dataService.save(pconfig);
UIPortalApplication uiPortalApp = event.getSource().getAncestorOfType(UIPortalApplication.class);
UIMaskWorkspace uiMaskWS = uiPortalApp.getChildById(UIPortalApplication.UI_MASK_WS_ID);
uiMaskWS.createEvent("Close", Phase.DECODE, pcontext).broadcast();
UIWorkingWorkspace uiWorkingWS = uiPortalApp.getChild(UIWorkingWorkspace.class);