List of usage examples for com.liferay.portal.kernel.util StringPool SPACE
String SPACE
To view the source code for com.liferay.portal.kernel.util StringPool SPACE.
Click Source Link
From source file:com.liferay.calendar.notification.NotificationTemplateContextFactory.java
License:Open Source License
public static NotificationTemplateContext getInstance(NotificationType notificationType, NotificationTemplateType notificationTemplateType, CalendarBooking calendarBooking, User user) throws Exception { CalendarBooking parentCalendarBooking = calendarBooking.getParentCalendarBooking(); Calendar calendar = parentCalendarBooking.getCalendar(); NotificationTemplateContext notificationTemplateContext = new NotificationTemplateContext(); CalendarNotificationTemplate calendarNotificationTemplate = CalendarNotificationTemplateLocalServiceUtil .fetchCalendarNotificationTemplate(calendar.getCalendarId(), notificationType, notificationTemplateType); notificationTemplateContext.setCalendarNotificationTemplate(calendarNotificationTemplate); notificationTemplateContext.setCompanyId(calendarBooking.getCompanyId()); notificationTemplateContext.setGroupId(calendarBooking.getGroupId()); notificationTemplateContext.setCalendarId(calendar.getCalendarId()); notificationTemplateContext.setNotificationTemplateType(notificationTemplateType); notificationTemplateContext.setNotificationType(notificationType); // Attributes Map<String, Serializable> attributes = new HashMap<String, Serializable>(); TimeZone userTimezone = user.getTimeZone(); Format dateFormatDateTime = FastDateFormatFactoryUtil.getDateTime(user.getLocale(), userTimezone); String userTimezoneDisplayName = userTimezone.getDisplayName(false, TimeZone.SHORT, user.getLocale()); String endTime = dateFormatDateTime.format(calendarBooking.getEndTime()) + StringPool.SPACE + userTimezoneDisplayName;//from ww w . j a va2 s . co m attributes.put("endTime", endTime); attributes.put("location", calendarBooking.getLocation()); Group group = user.getGroup(); String portalURL = _getPortalURL(group.getCompanyId(), group.getGroupId()); attributes.put("portalURL", portalURL); PortletConfig portletConfig = getPortletConfig(); ResourceBundle resourceBundle = portletConfig.getResourceBundle(user.getLocale()); attributes.put("portletName", LanguageUtil.get(resourceBundle, "javax.portlet.title.".concat(PortletKeys.CALENDAR))); String startTime = dateFormatDateTime.format(calendarBooking.getStartTime()) + StringPool.SPACE + userTimezoneDisplayName; attributes.put("startTime", startTime); attributes.put("title", calendarBooking.getTitle(user.getLocale())); String calendarBookingURL = _getCalendarBookingURL(user, calendarBooking.getCalendarBookingId()); attributes.put("url", calendarBookingURL); notificationTemplateContext.setAttributes(attributes); return notificationTemplateContext; }
From source file:com.liferay.calendar.service.test.CalendarResourceServiceTest.java
License:Open Source License
protected Map<Locale, String> createNameMap() { Map<Locale, String> nameMap = new HashMap<>(); String name = RandomTestUtil.randomString() + StringPool.SPACE + RandomTestUtil.randomString(); nameMap.put(LocaleUtil.getDefault(), name); return nameMap; }
From source file:com.liferay.calendarimporter.source.LotusNotesImportSource.java
License:Open Source License
protected long getTime(JSONObject eventJSON, String key) throws ParseException { DateFormat dateFormatDateTime = DateFormatFactoryUtil.getSimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US, _utcTimeZone);// w w w .j a v a2 s . c om JSONObject jsonObject = eventJSON.getJSONObject(key); String dateString = jsonObject.getString("date"); String timeString = jsonObject.getString("time"); Date date = (Date) dateFormatDateTime.parseObject(dateString + StringPool.SPACE + timeString); return date.getTime(); }
From source file:com.liferay.ci.jenkins.processor.DefaultJobNameProcessorImpl.java
License:Open Source License
@Override public String process(String jobName) { if (Validator.isNull(jobName)) { return StringPool.BLANK; }//from w w w .ja v a 2 s . co m String processedJobName = jobName.replace("liferay", StringPool.BLANK); processedJobName = processedJobName.replace(StringPool.DASH, StringPool.SPACE); return processedJobName.trim(); }
From source file:com.liferay.contacts.util.ContactsUtil.java
License:Open Source License
private static String _getPhones(User user) throws Exception { List<Phone> phones = PhoneLocalServiceUtil.getPhones(user.getCompanyId(), Contact.class.getName(), user.getContactId());//from w w w . j a v a 2s . co m StringBundler sb = new StringBundler(phones.size() * 7); for (Phone phone : phones) { sb.append("TEL;TYPE="); ListType listType = phone.getType(); sb.append(StringUtil.toUpperCase(_getVCardListTypeName(listType))); sb.append(StringPool.COLON); sb.append(phone.getNumber()); sb.append(StringPool.SPACE); sb.append(phone.getExtension()); sb.append(StringPool.NEW_LINE); } return sb.toString(); }
From source file:com.liferay.content.targeting.hook.CTAssetVocabularyServiceImpl.java
License:Open Source License
@Override public List<AssetVocabulary> getVocabularies(long[] vocabularyIds) throws PortalException, SystemException { List<AssetVocabulary> vocabularies = super.getVocabularies(vocabularyIds); if (vocabularies.size() <= 1) { return vocabularies; }/*www. j a v a 2 s .c o m*/ List<AssetVocabulary> unambiguousVocabularies = new ArrayList<AssetVocabulary>(); Locale locale = LocaleThreadLocal.getThemeDisplayLocale(); for (AssetVocabulary vocabulary : vocabularies) { String vocabularyTitle = vocabulary.getTitle(locale); if (vocabularyTitle.equals(UserSegmentUtil.getAssetVocabularyName())) { Group vocabularyGroup = GroupLocalServiceUtil.getGroup(vocabulary.getGroupId()); if (!vocabularyGroup.isCompany()) { StringBundler sb = new StringBundler(5); sb.append(vocabularyTitle); sb.append(StringPool.SPACE); sb.append(StringPool.OPEN_PARENTHESIS); sb.append(vocabularyGroup.getDescriptiveName(locale)); sb.append(StringPool.CLOSE_PARENTHESIS); vocabulary.setTitle(sb.toString(), locale); } } unambiguousVocabularies.add(vocabulary); } return unambiguousVocabularies; }
From source file:com.liferay.content.targeting.model.impl.CampaignImpl.java
License:Open Source License
public String getNameWithGroupName(Locale locale, long groupId) { String name = getName(locale); if (groupId != getGroupId()) { try {//from w ww .j av a2 s.c o m Group group = GroupLocalServiceUtil.getGroup(getGroupId()); StringBundler sb = new StringBundler(5); sb.append(name); sb.append(StringPool.SPACE); sb.append(StringPool.OPEN_PARENTHESIS); sb.append(group.getDescriptiveName(locale)); sb.append(StringPool.CLOSE_PARENTHESIS); name = sb.toString(); } catch (Exception e) { if (_log.isDebugEnabled()) { _log.debug("Group can not be found for groupId " + getGroupId()); } } } return name; }
From source file:com.liferay.content.targeting.model.impl.UserSegmentImpl.java
License:Open Source License
public String getNameWithGroupName(Locale locale, long groupId) { String name = getName(locale); try {/*from w ww.j a v a 2 s .co m*/ Group group = GroupLocalServiceUtil.getGroup(getGroupId()); if ((groupId != getGroupId()) && (!group.hasStagingGroup() || (group.getStagingGroup().getGroupId() != groupId))) { StringBundler sb = new StringBundler(5); sb.append(name); sb.append(StringPool.SPACE); sb.append(StringPool.OPEN_PARENTHESIS); sb.append(group.getDescriptiveName(locale)); sb.append(StringPool.CLOSE_PARENTHESIS); name = sb.toString(); } } catch (Exception e) { if (_log.isDebugEnabled()) { _log.debug("Group can not be found for groupId " + getGroupId()); } } return name; }
From source file:com.liferay.content.targeting.portlet.util.AssetQueryRule.java
License:Open Source License
protected String htmlOperator(Boolean andOperator, boolean contains, PortletConfig portletConfig, Locale locale) {//ww w .ja v a2 s .c om StringBundler sb = new StringBundler(5); String cssClass = "query-operator"; if ((andOperator == null) && !contains) { sb.append(LanguageUtil.get(portletConfig, locale, "not")); sb.append(StringPool.SPACE); cssClass += " first"; } else { sb.append(StringPool.SPACE); sb.append(andOperator ? LanguageUtil.get(portletConfig, locale, "and") : LanguageUtil.get(portletConfig, locale, "or")); sb.append(StringPool.SPACE); if (!contains) { sb.append(LanguageUtil.get(portletConfig, locale, "not")); sb.append(StringPool.SPACE); } } StringBundler html = new StringBundler(5); html.append("<span class=\""); html.append(cssClass); html.append("\">"); html.append(StringUtil.toLowerCase(sb.toString())); html.append("</span>"); return html.toString(); }
From source file:com.liferay.content.targeting.rule.device.DeviceRule.java
License:Open Source License
@Override public String getSummary(RuleInstance ruleInstance, Locale locale) { long mdrRuleGroupId = getMDRRuleGroupId(ruleInstance); if (mdrRuleGroupId <= 0) { return StringPool.BLANK; }/*from w ww . j a v a 2s. c o m*/ MDRRuleGroup mdrRuleGroup = null; try { mdrRuleGroup = MDRRuleGroupLocalServiceUtil.fetchMDRRuleGroup(mdrRuleGroupId); } catch (SystemException se) { _log.error(se); } if (mdrRuleGroup == null) { return StringPool.BLANK; } StringBuilder sb = new StringBuilder(3); sb.append(LanguageUtil.get(locale, "device-family")); sb.append(StringPool.COLON); sb.append(StringPool.SPACE); sb.append(mdrRuleGroup.getName(locale)); String description = mdrRuleGroup.getDescription(locale); if (Validator.isNotNull(description)) { sb.append(StringPool.COLON); sb.append(StringPool.SPACE); sb.append(mdrRuleGroup.getDescription(locale)); } return sb.toString(); }