List of usage examples for com.liferay.portal.kernel.util FastDateFormatFactoryUtil getSimpleDateFormat
public static Format getSimpleDateFormat(String pattern, Locale locale, TimeZone timeZone)
From source file:com.liferay.blogs.web.social.BlogsActivityInterpreter.java
License:Open Source License
@Override protected Object[] getTitleArguments(String groupName, SocialActivity activity, String link, String title, ServiceContext serviceContext) throws Exception { String creatorUserName = getUserName(activity.getUserId(), serviceContext); String receiverUserName = getUserName(activity.getReceiverUserId(), serviceContext); BlogsEntry entry = _blogsEntryLocalService.getEntry(activity.getClassPK()); String displayDate = StringPool.BLANK; if ((activity.getType() == BlogsActivityKeys.ADD_ENTRY) && (entry.getStatus() == WorkflowConstants.STATUS_SCHEDULED)) { link = null;//from w w w.jav a 2 s. co m Format dateFormatDate = FastDateFormatFactoryUtil.getSimpleDateFormat("MMMM d", serviceContext.getLocale(), serviceContext.getTimeZone()); displayDate = dateFormatDate.format(entry.getDisplayDate()); } return new Object[] { groupName, creatorUserName, receiverUserName, wrapLink(link, title), displayDate }; }
From source file:org.opencps.notification.utils.UserNotificationEventBean.java
License:Open Source License
public static UserNotificationEventBean getBean(UserNotificationEvent userNotificationEvent, ServiceContext serviceContext, RenderRequest renderRequest, Locale locale, TimeZone timeZone) throws JSONException, WindowStateException { UserNotificationEventBean userBean = new UserNotificationEventBean(); try {/* w w w. j a v a 2 s.com*/ JSONObject jsonObject = JSONFactoryUtil.createJSONObject(userNotificationEvent.getPayload()); userBean.setUserNotificationEventId(userNotificationEvent.getUserNotificationEventId()); userBean.setDossierId(jsonObject.getString("dossierId")); userBean.setReceptionNo(jsonObject.getString("receptionNo")); userBean.setActionName(jsonObject.getString("actionName")); userBean.setNote(jsonObject.getString("note")); userBean.setDelivered(userNotificationEvent.getDelivered()); userBean.setArchived(userNotificationEvent.getArchived()); userBean.setUrl(NotificationUtils.getLink(userNotificationEvent, null, renderRequest)); String timestamp = StringPool.BLANK; String stringDate = "dd/MM/yyyy HH:mm"; Format simpleDateFormat = FastDateFormatFactoryUtil.getSimpleDateFormat(stringDate, locale, timeZone); timestamp = simpleDateFormat.format(userNotificationEvent.getTimestamp()); userBean.setCreateDate(timestamp); } catch (JSONException e) { _log.error(e); } return userBean; }