UIPortal editPortal = (UIPortal)uiEditWS.getUIComponent();
UIPortal uiPortal = Util.getUIPortal();
String remoteUser = prContext.getRemoteUser();
String ownerUser = prContext.getPortalOwner();
PortalConfig portalConfig = (PortalConfig)PortalDataMapper.buildModelObject(editPortal);
UserPortalConfigService configService = getApplicationComponent(UserPortalConfigService.class);
DataStorage dataStorage = getApplicationComponent(DataStorage.class);
if (!isPortalExist(editPortal))
{
return;
}
SkinService skinService = getApplicationComponent(SkinService.class);
skinService.invalidatePortalSkinCache(editPortal.getName(), editPortal.getSkin());
try
{
dataStorage.save(portalConfig);
}
catch (StaleModelException ex)
{
//Temporary solution for concurrency-related issue. The StaleModelException should be
//caught in the ApplicationLifecycle
rebuildUIPortal(uiPortalApp, editPortal, dataStorage);
}
uiPortalApp.getUserPortalConfig().setPortal(portalConfig);
UserPortalConfig userPortalConfig = configService.getUserPortalConfig(ownerUser, remoteUser);
if (userPortalConfig != null)
{
editPortal.setModifiable(userPortalConfig.getPortalConfig().isModifiable());
}
else
{
editPortal.setModifiable(false);
}
LocaleConfigService localeConfigService = uiPortalApp.getApplicationComponent(LocaleConfigService.class);
LocaleConfig localeConfig = localeConfigService.getLocaleConfig(portalConfig.getLocale());
if (localeConfig == null)
{
localeConfig = localeConfigService.getDefaultLocaleConfig();
}
// TODO dang.tung - change layout when portal get language from UIPortal