liferayportletliferay-service-builder

Liferay Service Builder and portlet instance specific data


Does Liferay Service Builder peristence provide mechanism for isolating stored data into separate portlet instance specific (portlet added into two separate pages) tables?

If it is not possible what is the preferred approach to avoid mixing portlet data on two different portal pages?


Solution

  • As this is stackoverflow and related to anything with source code: You can create that single scope yourself - Liferay's scope is just on "group". Any other criteria that you add to the data can be there, but the filtering needs to be handled by you.

    A non-programming way to achieve your goal is to open a subscope for your portlet. This can be inspected with (for example) the MessageBoards portlet: In its configuration you can select if you want the scope to be the "Site" or the "Page". Effectively this creates a new "group" (the API name for the scope) and you can just handle the data as if they were in a completely different site.

    This illustrates one of the reasons why the API calls it groupId and not siteId, because it's not limited to denote a site.