List of usage examples for com.liferay.portal.kernel.portlet PortletIdCodec hasUserId
public static boolean hasUserId(String portletId)
From source file:com.liferay.asset.publisher.web.AssetPublisherPortletLayoutListener.java
License:Open Source License
@Override public void onRemoveFromLayout(String portletId, long plid) throws PortletLayoutListenerException { try {//from ww w . ja v a 2 s . c o m Layout layout = _layoutLocalService.getLayout(plid); if (_assetPublisherWebUtil.isDefaultAssetPublisher(layout, portletId, StringPool.BLANK)) { _journalArticleLocalService.deleteLayoutArticleReferences(layout.getGroupId(), layout.getUuid()); } long ownerId = PortletKeys.PREFS_OWNER_ID_DEFAULT; int ownerType = PortletKeys.PREFS_OWNER_TYPE_LAYOUT; if (PortletIdCodec.hasUserId(portletId)) { ownerType = PortletKeys.PREFS_OWNER_TYPE_USER; ownerId = PortletIdCodec.decodeUserId(portletId); } _subscriptionLocalService.deleteSubscriptions(layout.getCompanyId(), PortletPreferences.class.getName(), _assetPublisherWebUtil.getSubscriptionClassPK(ownerId, ownerType, plid, portletId)); } catch (Exception e) { throw new PortletLayoutListenerException(e); } }
From source file:com.liferay.asset.publisher.web.internal.util.AssetPublisherWebUtil.java
License:Open Source License
public long getSubscriptionClassPK(long ownerId, int ownerType, long plid, String portletId) throws PortalException { if (PortletIdCodec.hasUserId(portletId)) { ownerId = PortletIdCodec.decodeUserId(portletId); ownerType = PortletKeys.PREFS_OWNER_TYPE_USER; }/*from w w w . ja va2s . c o m*/ com.liferay.portal.kernel.model.PortletPreferences portletPreferencesModel = _portletPreferencesLocalService .getPortletPreferences(ownerId, ownerType, plid, portletId); return portletPreferencesModel.getPortletPreferencesId(); }
From source file:com.liferay.asset.publisher.web.util.AssetPublisherUtil.java
License:Open Source License
public static long getSubscriptionClassPK(long ownerId, int ownerType, long plid, String portletId) throws PortalException { if (plid != LayoutConstants.DEFAULT_PLID) { Layout layout = _layoutLocalService.fetchLayout(plid); if (layout != null) { long userId = 0; if (PortletIdCodec.hasUserId(portletId)) { userId = PortletIdCodec.decodeUserId(portletId); }//from ww w. j a v a2 s. c o m PortletPreferencesIds portletPreferencesIds = _portletPreferencesFactory .getPortletPreferencesIds(layout.getGroupId(), userId, layout, portletId, false); ownerId = portletPreferencesIds.getOwnerId(); ownerType = portletPreferencesIds.getOwnerType(); plid = portletPreferencesIds.getPlid(); portletId = portletPreferencesIds.getPortletId(); } } if (PortletIdCodec.hasUserId(portletId)) { ownerId = PortletIdCodec.decodeUserId(portletId); ownerType = PortletKeys.PREFS_OWNER_TYPE_USER; } com.liferay.portal.kernel.model.PortletPreferences portletPreferencesModel = _portletPreferencesLocalService .getPortletPreferences(ownerId, ownerType, plid, portletId); return portletPreferencesModel.getPortletPreferencesId(); }