Example usage for com.liferay.portal.kernel.portlet PortletPreferencesFactoryUtil getLayoutPortletSetup

List of usage examples for com.liferay.portal.kernel.portlet PortletPreferencesFactoryUtil getLayoutPortletSetup

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.portlet PortletPreferencesFactoryUtil getLayoutPortletSetup.

Prototype

public static PortletPreferences getLayoutPortletSetup(long companyId, long ownerId, int ownerType, long plid,
            String portletId, String defaultPreferences) 

Source Link

Usage

From source file:com.liferay.exportimport.test.PortletPreferencesExportImportTest.java

License:Open Source License

@Test
public void testExportImportGroupEmbeddedPortletPreferences() throws Exception {

    String portletInstanceId = PortletIdCodec.encode(JournalContentPortletKeys.JOURNAL_CONTENT, "1234");

    Portlet portlet = PortletLocalServiceUtil.getPortletById(JournalContentPortletKeys.JOURNAL_CONTENT);

    String portletPreferencesXML = _getPortletPreferencesXML("name", new String[] { "value" });

    _addGroupEmbeddedPortlet(portletInstanceId, portlet, portletPreferencesXML);

    exportImportLayouts(new long[] { layout.getLayoutId() }, getImportParameterMap());

    PortletPreferences portletPreferences = PortletPreferencesFactoryUtil.getLayoutPortletSetup(
            importedGroup.getCompanyId(), importedGroup.getGroupId(), PortletKeys.PREFS_OWNER_TYPE_LAYOUT,
            PortletKeys.PREFS_PLID_SHARED, portletInstanceId, PortletConstants.DEFAULT_PREFERENCES);

    Assert.assertEquals("value", portletPreferences.getValue("name", StringPool.BLANK));
}