Example usage for com.liferay.portal.kernel.model LayoutSetBranch getTheme

List of usage examples for com.liferay.portal.kernel.model LayoutSetBranch getTheme

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.model LayoutSetBranch getTheme.

Prototype

public Theme getTheme();

Source Link

Usage

From source file:com.liferay.exportimport.lar.ThemeExporter.java

License:Open Source License

public void exportTheme(PortletDataContext portletDataContext, LayoutSetBranch layoutSetBranch)
        throws Exception {

    boolean exportThemeSettings = MapUtil.getBoolean(portletDataContext.getParameterMap(),
            PortletDataHandlerKeys.THEME_REFERENCE);

    if (_log.isDebugEnabled()) {
        _log.debug("Export theme settings " + exportThemeSettings);
    }/*  w w w  . j  av  a 2s .  c  o  m*/

    if (!exportThemeSettings) {
        return;
    }

    StagedTheme stagedTheme = ModelAdapterUtil.adapt(layoutSetBranch.getTheme(), Theme.class,
            StagedTheme.class);

    if (!portletDataContext.isPerformDirectBinaryImport()) {
        Element layoutSetBranchElement = portletDataContext.getExportDataElement(layoutSetBranch);

        portletDataContext.addReferenceElement(layoutSetBranch, layoutSetBranchElement, stagedTheme,
                PortletDataContext.REFERENCE_TYPE_DEPENDENCY, true);
    }

    exportThemeSettings(portletDataContext, stagedTheme.getThemeId(), layoutSetBranch.getColorSchemeId(),
            layoutSetBranch.getCss());
}