Message Boards
Portlet table returning 0 for companyId
Portlet table returning 0 for companyId
Regular Member Posts: 105 Join Date: 2/2/18 Recent PostsI'm currently running Liferay 7.3.6 GA7 and I'm having issues getting data from the Portal.Portlet table. Using the following code
List<Portlet> searchPortlets = PortletLocalServiceUtil.getPortlets();
for (Portlet p : searchPortlets) {
System. out.println(
"\n -- Portlet Cols --- \nMccVersion: " + p.getMvccVersion() + "\nID: " + p.getId() + "\nCompany: "
+ p.getCompanyId() + "\nPortletId: "
+ p.getPortletId() + "\nRoles: " + p.getRoles() + "\nActive: " + p.getActive() + "\n");
}
I can only get data for portletId, roles and active_ flag. Printing out each column from that table able yeilds the following output
-- Portlet Cols ---
MccVersion: 0
ID: 0
Company: 0
PortletId: com_liferay_asset_tags_navigation_web_portlet_AssetTagsCloudPortlet
Roles: Guest,Power User,User
Active: true
-- Portlet Cols ---
MccVersion: 0
ID: 0
Company: 0
PortletId: com_liferay_commerce_wish_list_web_internal_portlet_CommerceWishListContentPortlet
Roles: Power User,User
Active: true
-- Portlet Cols ---
MccVersion: 0
ID: 0
Company: 0
PortletId: com_healthmap_compass_practices_CompassPracticesPortlet
Roles: Power User,User
Active: true
What's strange here is when I do a SELECT * from lportal.Portlet I see data for all columns except the Roles column... I'm completely stumped here.. I need the companyId in order to build a redirect link for a specific portlet to another portlet, but it returns 0 for ALL rows. I was able to access this data in Liferay 6.2. Is there something wrong with the persistence for the Portal DB schema?? Am I using the incorrect service builder persistence Util class??