List of usage examples for com.liferay.portal.kernel.util ResourceBundleUtil getString
public static String getString(ResourceBundle resourceBundle, String key, Object... arguments)
From source file:com.liferay.journal.web.internal.notifications.JournalUserNotificationHandler.java
License:Open Source License
@Override protected String getTitle(JSONObject jsonObject, AssetRenderer<?> assetRenderer, ServiceContext serviceContext) { String title = StringPool.BLANK; ResourceBundle resourceBundle = ResourceBundleUtil.getBundle("content.Language", getClass()); JournalArticleAssetRenderer journalArticleAssetRenderer = (JournalArticleAssetRenderer) assetRenderer; JournalArticle journalArticle = journalArticleAssetRenderer.getArticle(); String userFullName = HtmlUtil.escape(_portal.getUserName(journalArticle.getUserId(), StringPool.BLANK)); int notificationType = jsonObject.getInt("notificationType"); if (notificationType == UserNotificationDefinition.NOTIFICATION_TYPE_ADD_ENTRY) { title = ResourceBundleUtil.getString(resourceBundle, "x-added-a-new-web-content-article", userFullName); } else if (notificationType == UserNotificationDefinition.NOTIFICATION_TYPE_UPDATE_ENTRY) { title = ResourceBundleUtil.getString(resourceBundle, "x-updated-a-web-content-article", userFullName); } else if (notificationType == JournalArticleConstants.NOTIFICATION_TYPE_MOVE_ENTRY_FROM_FOLDER) { title = ResourceBundleUtil.getString(resourceBundle, "x-moved-a-web-content-from-a-folder", userFullName);/*w ww. j av a 2 s .c om*/ } else if (notificationType == JournalArticleConstants.NOTIFICATION_TYPE_MOVE_ENTRY_TO_FOLDER) { title = ResourceBundleUtil.getString(resourceBundle, "x-moved-a-web-content-to-a-folder", userFullName); } return title; }
From source file:com.liferay.microblogs.web.internal.notifications.MicroblogsUserNotificationHandler.java
License:Open Source License
@Override protected String getTitle(JSONObject jsonObject, AssetRenderer<?> assetRenderer, ServiceContext serviceContext) { String title = StringPool.BLANK; ResourceBundle resourceBundle = _resourceBundleLoader.loadResourceBundle(serviceContext.getLocale()); MicroblogsEntry microblogsEntry = _microblogsEntryLocalService .fetchMicroblogsEntry(assetRenderer.getClassPK()); String userFullName = HtmlUtil.escape(_portal.getUserName(microblogsEntry.getUserId(), StringPool.BLANK)); int notificationType = jsonObject.getInt("notificationType"); if (notificationType == MicroblogsEntryConstants.NOTIFICATION_TYPE_REPLY) { title = ResourceBundleUtil.getString(resourceBundle, "x-commented-on-your-post", userFullName); } else if (notificationType == MicroblogsEntryConstants.NOTIFICATION_TYPE_REPLY_TO_REPLIED) { long parentMicroblogsEntryUserId = microblogsEntry.fetchParentMicroblogsEntryUserId(); User user = _userLocalService.fetchUser(parentMicroblogsEntryUserId); if (user != null) { title = ResourceBundleUtil.getString(resourceBundle, "x-also-commented-on-x's-post", userFullName, user.getFullName()); }//from w w w . j a v a 2s. com } else if (notificationType == MicroblogsEntryConstants.NOTIFICATION_TYPE_REPLY_TO_TAGGED) { title = ResourceBundleUtil.getString(resourceBundle, "x-commented-on-a-post-you-are-tagged-in", userFullName); } else if (notificationType == MicroblogsEntryConstants.NOTIFICATION_TYPE_TAG) { title = ResourceBundleUtil.getString(resourceBundle, "x-tagged-you-in-a-post", userFullName); } return title; }