Asset Publisher OSGI Configuration

Mounir Hallab, modified 6 Years ago. Junior Member Posts: 27 Join Date: 3/2/15 Recent Posts

Hi,

Is there a way to configure Asset publisher portlet by OSGI ?

I want to set the default selected asset type to Web Content Article. I found AssetPublisherPortletInstanceConfiguration class in asset-publisher-web module, but it doesnt contain much config attributes.

Thank you,

thumbnail
Minhchau Dang, modified 6 Years ago. Liferay Master Posts: 598 Join Date: 10/22/07 Recent Posts
Mounir Hallab:

I want to set the default selected asset type to Web Content Article. I found AssetPublisherPortletInstanceConfiguration class in asset-publisher-web module, but it doesnt contain much config attributes.

In theory, the way you would do this is to change the default value for the classNameIds preference on the asset publisher portlet, which you would do by overriding the javax.portlet.preferences component property (see David Nebinger's blog on Overriding Component Properties).

You can debug the code PortletTracker to see what it's expecting. At a glance, it either wants a path to some XML file in a bundle fragment for com.liferay.asset.publisher.web, or it wants the property to be set to the full XML string. Coincidentally, you can see an example of the former in a lot of the portlets that extend asset publisher portlet (HighestRatedAssetsPortlet, highest-rated-assets-default-portlet-preferences.xml).

As a warning, because the portlet preference ultimately corresponds to the classNameId for the JournalArticle model, the value you set in the configuration would need to change in every environnment, because that value is probably going to end up different in every environment.