List of usage examples for com.liferay.portal.kernel.service LayoutSetLocalServiceUtil updateLookAndFeel
public static com.liferay.portal.kernel.model.LayoutSet updateLookAndFeel(long groupId, boolean privateLayout, String themeId, String colorSchemeId, String css) throws com.liferay.portal.kernel.exception.PortalException
From source file:com.liferay.exportimport.lar.ThemeImporter.java
License:Open Source License
public void importTheme(PortletDataContext portletDataContext, LayoutSet layoutSet) throws Exception { boolean importThemeSettings = MapUtil.getBoolean(portletDataContext.getParameterMap(), PortletDataHandlerKeys.THEME_REFERENCE); if (_log.isDebugEnabled()) { _log.debug("Import theme settings " + importThemeSettings); }//from w ww . ja va 2 s . c o m if (!importThemeSettings) { return; } Map<Long, Long> groupIds = (Map<Long, Long>) portletDataContext.getNewPrimaryKeysMap(Group.class); long importGroupId = groupIds.get(layoutSet.getGroupId()); Element importDataRootElement = portletDataContext.getImportDataRootElement(); Element headerElement = importDataRootElement.element("header"); String themeId = layoutSet.getThemeId(); String colorSchemeId = layoutSet.getColorSchemeId(); Attribute themeIdAttribute = headerElement.attribute("theme-id"); if (themeIdAttribute != null) { themeId = themeIdAttribute.getValue(); } Attribute colorSchemeIdAttribute = headerElement.attribute("color-scheme-id"); if (colorSchemeIdAttribute != null) { colorSchemeId = colorSchemeIdAttribute.getValue(); } String css = GetterUtil.getString(headerElement.elementText("css")); LayoutSetLocalServiceUtil.updateLookAndFeel(importGroupId, layoutSet.isPrivateLayout(), themeId, colorSchemeId, css); }