private String getText(CalendarItem calItem, Invite invite, Locale locale, TimeZone tz) throws ServiceException { DateFormat dateTimeFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, locale); dateTimeFormat.setTimeZone(tz); DateFormat onlyDateFormat = DateFormat.getDateInstance(DateFormat.SHORT, locale); onlyDateFormat.setTimeZone(tz); String formattedStart; String formattedEnd; if (calItem.getType() == MailItem.Type.APPOINTMENT) { Date start = new Date(new Long(getProperty(NEXT_INST_START_PROP_NAME))); formattedStart = dateTimeFormat.format(start); Date end = invite.getEffectiveDuration().addToDate(start); formattedEnd = dateTimeFormat.format(end); } else { // start date and due date is optional for tasks formattedStart = invite.getStartTime() == null ? "" : onlyDateFormat.format(invite.getStartTime().getDate()); formattedEnd = invite.getEndTime() == null ? "" : onlyDateFormat.format(invite.getEndTime().getDate()); } String location = invite.getLocation(); if (StringUtil.isNullOrEmpty(location)) location = L10nUtil.getMessage(L10nUtil.MsgKey.noLocation); String organizer = null; ZOrganizer zOrganizer = invite.getOrganizer(); if (zOrganizer != null) organizer = zOrganizer.hasCn() ? zOrganizer.getCn() : zOrganizer.getAddress(); if (organizer == null) organizer = ""; String folder = calItem.getMailbox().getFolderById(null, calItem.getFolderId()).getName(); return L10nUtil.getMessage( calItem.getType() == MailItem.Type.APPOINTMENT ? L10nUtil.MsgKey.apptReminderSmsText : L10nUtil.MsgKey.taskReminderSmsText, locale, calItem.getSubject(), formattedStart, formattedEnd, location, organizer, folder); }