Example usage for com.liferay.portal.kernel.portlet PortletIdCodec encode

List of usage examples for com.liferay.portal.kernel.portlet PortletIdCodec encode

Introduction

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

Prototype

public static String encode(String portletName, String instanceId) 

Source Link

Usage

From source file:com.liferay.asset.publisher.lar.test.AssetPublisherExportImportTest.java

License:Open Source License

@Override
public String getPortletId() throws Exception {
    return PortletIdCodec.encode(AssetPublisherPortletKeys.ASSET_PUBLISHER, RandomTestUtil.randomString());
}

From source file:com.liferay.asset.publisher.web.internal.messaging.AssetEntriesCheckerUtil.java

License:Open Source License

public void checkAssetEntries() throws Exception {
    ActionableDynamicQuery actionableDynamicQuery = _portletPreferencesLocalService.getActionableDynamicQuery();

    actionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() {

        @Override/* ww w . j av a  2s.c o m*/
        public void addCriteria(DynamicQuery dynamicQuery) {
            Property property = PropertyFactoryUtil.forName("portletId");

            dynamicQuery.add(property.like(
                    PortletIdCodec.encode(AssetPublisherPortletKeys.ASSET_PUBLISHER, StringPool.PERCENT)));
        }

    });
    actionableDynamicQuery.setPerformActionMethod(
            new ActionableDynamicQuery.PerformActionMethod<com.liferay.portal.kernel.model.PortletPreferences>() {

                @Override
                public void performAction(com.liferay.portal.kernel.model.PortletPreferences portletPreferences)
                        throws PortalException {

                    _checkAssetEntries(portletPreferences);
                }

            });

    actionableDynamicQuery.performActions();
}

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));
}