@Override public String getPortletId() { AssetRendererFactory<MBCategory> assetRendererFactory = AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClass(MBCategory.class); return assetRendererFactory.getPortletId(); }
protected void sendNotificationEvent( final MicroblogsEntry microblogsEntry, ServiceContext serviceContext) throws PortalException { final JSONObject notificationEventJSONObject = JSONFactoryUtil.createJSONObject(); notificationEventJSONObject.put("className", MicroblogsEntry.class.getName()); notificationEventJSONObject.put("classPK", microblogsEntry.getMicroblogsEntryId()); notificationEventJSONObject.put( "entryTitle", MicroblogsUtil.getProcessedContent( StringUtil.shorten(microblogsEntry.getContent(), 50), serviceContext)); AssetRendererFactory<MicroblogsEntry> assetRendererFactory = AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClass(MicroblogsEntry.class); AssetRenderer<MicroblogsEntry> assetRenderer = assetRendererFactory.getAssetRenderer(microblogsEntry.getMicroblogsEntryId()); String entryURL = StringPool.BLANK; try { entryURL = assetRenderer.getURLViewInContext( serviceContext.getLiferayPortletRequest(), serviceContext.getLiferayPortletResponse(), null); } catch (Exception e) { if (_log.isDebugEnabled()) { _log.debug(e, e); } } notificationEventJSONObject.put("entryURL", entryURL); notificationEventJSONObject.put("userId", microblogsEntry.getUserId()); final List<Long> receiverUserIds = MicroblogsUtil.getSubscriberUserIds(microblogsEntry); Callable<Void> callable = new Callable<Void>() { @Override public Void call() throws Exception { MessageBusUtil.sendMessage( DestinationNames.ASYNC_SERVICE, new NotificationProcessCallable( receiverUserIds, microblogsEntry, notificationEventJSONObject)); return null; } }; TransactionCommitCallbackUtil.registerCallback(callable); }