JorgeFerrer/liferay-portal — pull request #220 by zsigmondrab (2013-07-23 15:56:07+00:00)
Title: [TECHNICAL REQUEST] LPS-37951 PortletSetup wont be enforced when portlet is added to a page

Hi Jorge,

the problem is here, in the render_portlet.jsp the portletSetup variable will contain no preferences at every first render phase right after adding the portlet to a page, because the portlet preferences will be create only during the initialization of the portletPreferences variable, where the PortletPreferencesLocalServiceUtil.getPreferences method will create one with the defaults if there isn't any yet.

Because of this, the preferences from the descriptor xml won't be read in the PortletPreferencesLocalServiceImpl.doGetPreferences method; this will return before from the conditional block.

However, I have ideas, I'm not certain completely why the PortletPreferencesFactoryUtil.getStrictLayoutPortletSetup is used for portletSetup, what the strict means, and so there might be better solution than simply change the lines in the render_portlet.jsp. I guess, this is for getting only those preferences which pertain only for the specific layout to which the portlet is being added and so it would be better to fix somehow in the PortletPreferencesLocalServiceImpl.doGetPreferences method.

Zsigmond