List of usage examples for com.liferay.portal.kernel.util DateUtil getDate
public static String getDate(Date date, String pattern, Locale locale)
From source file:com.liferay.meeting.webex.request.BaseMeetingRequestTranslator.java
License:Open Source License
protected ScheduleType getScheduleType(Meeting meeting, MeetingContext meetingContext) { ScheduleType scheduleType = ScheduleType.Factory.newInstance(); scheduleType.setDuration(meeting.getDuration()); scheduleType.setHostWebExID(meetingContext.getLogin()); scheduleType.setOpenTime(meeting.getOpenTime()); String startDate = DateUtil.getDate(meeting.getStartCalendar().getTime(), WebExConstants.DATE_PATTERN, meeting.getLocale());/*from w ww .j a v a2 s. co m*/ scheduleType.setStartDate(startDate); TimeZoneType.Enum timeZoneTypeEnum = TimeZoneUtil.convert(meeting.getTimeZone()); scheduleType.setTimeZone(timeZoneTypeEnum); return scheduleType; }
From source file:com.rivetlogic.ecommerce.portlet.ShoppingCartPortlet.java
License:Open Source License
private Message getNotificationMessage(ThemeDisplay themeDisplay, ShoppingOrder shoppingOrder, List<String> cartItemsProductIdList, ShoppingCartPrefsBean cartPrefsBean, String notificationType) throws Exception { Message message = new Message(); message.put(NotificationConstants.CMD, notificationType); message.put(NotificationConstants.STORE_EMAIL, cartPrefsBean.getStoreEmail()); message.put(NotificationConstants.STORE_NAME, cartPrefsBean.getStoreName()); message.put(NotificationConstants.CUSTOMER_EMAIL, shoppingOrder.getCustomerEmail()); message.put(NotificationConstants.CUSTOMER_NAME, shoppingOrder.getCustomerName()); message.put(NotificationConstants.SHOPPING_ORDER, shoppingOrder); message.put(NotificationConstants.PORTAL_URL, themeDisplay.getPortalURL()); message.put(NotificationConstants.PORTAL_LOGO, getPortalLogo(themeDisplay)); message.put(NotificationConstants.DATE, DateUtil.getDate(new Date(), DATE_FORMAT, Locale.US)); List<ShoppingCartItem> shoppingCartItems = (themeDisplay.isSignedIn() ? getCartItems(shoppingOrder.getOrderId(), themeDisplay) : getCartItemsByProductId(cartItemsProductIdList, themeDisplay)); if (null != shoppingCartItems) { message.put(NotificationConstants.SHOPPING_ORDER_ITEMS, shoppingCartItems); double orderTotal = 0l; for (ShoppingCartItem shoppingCartItem : shoppingCartItems) { orderTotal += Float.valueOf(shoppingCartItem.getPrice()) * (float) shoppingCartItem.getCount(); }//from w ww. ja v a2 s .c o m message.put(NotificationConstants.ORDER_TOTAL, new DecimalFormat(ShoppingCartPortletConstants.DECIMAL_FORMAT).format(orderTotal)); } if (NotificationConstants.STORE_NOTIFICATION.equals(notificationType)) { message.put(NotificationConstants.BODY_TEMPLATE, cartPrefsBean.getStoreNotifBodyTemplate()); message.put(NotificationConstants.SUBJECT_TEMPLATE, cartPrefsBean.getStoreNotifSubjectTemplate()); } else { message.put(NotificationConstants.BODY_TEMPLATE, cartPrefsBean.getCustomerNotifBodyTemplate()); message.put(NotificationConstants.SUBJECT_TEMPLATE, cartPrefsBean.getCustomerNotifSubjectTemplate()); } return message; }