juliocamarero/liferay-portal — pull request #776 by KocsisDaniel (2012-11-20 16:04:11+00:00)
Title: LPS-30387 [TECH SUPPORT]

Hi Julio,

as you requested we checked the simplified logic. We added a null pointer handling logic, because when we call the method from the PortletImporter it always has a valid portlet attribute (and layout) but when we call it from LayoutImporter we pass null's because we want the method to use the passed portlet xml element to fetch these values. I think it is not a good pattern to have one method and we control the logic by passing null arguments, but this is on our list with staging re-factoring so I don't want to change this now.

I changed the signature to pass portletId instead of portlet because I felt the conditions to check null value is much simpler in this case, but feel free to change if you find to pass a portlet object better.

We also need to check isPreferencesUniquePerLayout in 2 more places because when we import a portlet directly we have always pass a valid layout to the method and without the check it would create an unnecessary portlet preference for the instance.

thanks,
Daniel