List of usage examples for com.liferay.portal.kernel.util UnicodeProperties UnicodeProperties
public UnicodeProperties(boolean safe)
From source file:com.liferay.calendar.model.impl.CalendarNotificationTemplateImpl.java
License:Open Source License
@Override public UnicodeProperties getNotificationTypeSettingsProperties() { if (_notificationTypeSettingsProperties == null) { _notificationTypeSettingsProperties = new UnicodeProperties(true); try {/*from w w w . j ava 2 s . co m*/ _notificationTypeSettingsProperties.load(super.getNotificationTypeSettings()); } catch (IOException ioe) { _log.error(ioe, ioe); } } return _notificationTypeSettingsProperties; }
From source file:com.liferay.calendar.portlet.CalendarPortlet.java
License:Open Source License
protected String getNotificationTypeSettings(ActionRequest actionRequest, NotificationType notificationType) { UnicodeProperties notificationTypeSettingsProperties = new UnicodeProperties(true); if (notificationType == NotificationType.EMAIL) { String fromAddress = ParamUtil.getString(actionRequest, "fromAddress"); String fromName = ParamUtil.getString(actionRequest, "fromName"); notificationTypeSettingsProperties.put(CalendarNotificationTemplateConstants.PROPERTY_FROM_ADDRESS, fromAddress);/*from w w w . j a v a2 s . co m*/ notificationTypeSettingsProperties.put(CalendarNotificationTemplateConstants.PROPERTY_FROM_NAME, fromName); } return notificationTypeSettingsProperties.toString(); }
From source file:com.liferay.calendar.test.util.CalendarNotificationTemplateTestUtil.java
License:Open Source License
public static CalendarNotificationTemplate addCalendarNotificationTemplate(Calendar calendar, NotificationTemplateType notificationTemplateType, String fromAddress, String fromName, String subject, String body) throws PortalException { UnicodeProperties notificationTypeSettingsProperties = new UnicodeProperties(true); notificationTypeSettingsProperties.put(CalendarNotificationTemplateConstants.PROPERTY_FROM_ADDRESS, fromAddress);/*w ww . j a v a2 s . co m*/ notificationTypeSettingsProperties.put(CalendarNotificationTemplateConstants.PROPERTY_FROM_NAME, fromName); User user = UserLocalServiceUtil.getUser(calendar.getUserId()); return CalendarNotificationTemplateLocalServiceUtil.addCalendarNotificationTemplate(calendar.getUserId(), calendar.getCalendarId(), NotificationType.EMAIL, notificationTypeSettingsProperties.toString(), notificationTemplateType, subject, body, createServiceContext(user)); }
From source file:com.liferay.calendarimporter.model.impl.ImportEntryImpl.java
License:Open Source License
@Override public UnicodeProperties getTypeSettingsProperties() { if (_typeSettingsProperties == null) { _typeSettingsProperties = new UnicodeProperties(true); _typeSettingsProperties.fastLoad(super.getTypeSettings()); }/*from w w w . j a va 2s . c o m*/ return _typeSettingsProperties; }
From source file:com.liferay.layout.admin.web.internal.exportimport.data.handler.LayoutStagedModelDataHandler.java
License:Open Source License
protected void mergePortlets(Layout layout, String newTypeSettings, String portletsMergeMode) { try {//from w w w . ja v a2 s . c om UnicodeProperties previousTypeSettingsProperties = layout.getTypeSettingsProperties(); LayoutTypePortlet previousLayoutType = (LayoutTypePortlet) layout.getLayoutType(); LayoutTemplate previousLayoutTemplate = previousLayoutType.getLayoutTemplate(); List<String> previousColumns = previousLayoutTemplate.getColumns(); UnicodeProperties newTypeSettingsProperties = new UnicodeProperties(true); newTypeSettingsProperties.load(newTypeSettings); String layoutTemplateId = newTypeSettingsProperties .getProperty(LayoutTypePortletConstants.LAYOUT_TEMPLATE_ID); previousTypeSettingsProperties.setProperty(LayoutTypePortletConstants.LAYOUT_TEMPLATE_ID, layoutTemplateId); String nestedColumnIds = newTypeSettingsProperties .getProperty(LayoutTypePortletConstants.NESTED_COLUMN_IDS); if (Validator.isNotNull(nestedColumnIds)) { previousTypeSettingsProperties.setProperty(LayoutTypePortletConstants.NESTED_COLUMN_IDS, nestedColumnIds); String[] nestedColumnIdsArray = StringUtil.split(nestedColumnIds); for (String nestedColumnId : nestedColumnIdsArray) { String nestedColumnValue = newTypeSettingsProperties.getProperty(nestedColumnId); previousTypeSettingsProperties.setProperty(nestedColumnId, nestedColumnValue); } } LayoutTemplate newLayoutTemplate = _layoutTemplateLocalService.getLayoutTemplate(layoutTemplateId, false, null); String[] newPortletIds = new String[0]; for (String columnId : newLayoutTemplate.getColumns()) { String columnValue = newTypeSettingsProperties.getProperty(columnId); String[] portletIds = StringUtil.split(columnValue); if (!previousColumns.contains(columnId)) { newPortletIds = ArrayUtil.append(newPortletIds, portletIds); } else { String[] previousPortletIds = StringUtil .split(previousTypeSettingsProperties.getProperty(columnId)); portletIds = appendPortletIds(previousPortletIds, portletIds, portletsMergeMode); previousTypeSettingsProperties.setProperty(columnId, StringUtil.merge(portletIds)); } } // Add portlets in non-existent column to the first column String columnId = previousColumns.get(0); String[] portletIds = StringUtil.split(previousTypeSettingsProperties.getProperty(columnId)); appendPortletIds(portletIds, newPortletIds, portletsMergeMode); previousTypeSettingsProperties.setProperty(columnId, StringUtil.merge(portletIds)); layout.setTypeSettings(previousTypeSettingsProperties.toString()); } catch (IOException ioe) { layout.setTypeSettings(newTypeSettings); } }
From source file:com.liferay.layout.admin.web.internal.upgrade.v_1_0_0.UpgradeLayout.java
License:Open Source License
protected void updateLayout(long plid, String typeSettings) throws Exception { if (Validator.isNull(typeSettings)) { return;/* w w w . j av a 2 s .c o m*/ } UnicodeProperties typeSettingsProperties = new UnicodeProperties(true); typeSettingsProperties.load(typeSettings); typeSettingsProperties.setProperty("embeddedLayoutURL", typeSettingsProperties.getProperty("url")); typeSettingsProperties.remove("url"); updateTypeSettings(plid, typeSettingsProperties.toString()); }
From source file:com.liferay.layout.admin.web.internal.upgrade.v_1_0_1.UpgradeLayoutType.java
License:Open Source License
protected String getArticleId(String typeSettings) throws Exception { UnicodeProperties typeSettingsProperties = new UnicodeProperties(true); typeSettingsProperties.fastLoad(typeSettings); return typeSettingsProperties.getProperty("article-id"); }
From source file:com.liferay.layout.admin.web.internal.upgrade.v_1_0_1.UpgradeLayoutType.java
License:Open Source License
protected String getTypeSettings(String portletId) { UnicodeProperties newTypeSettings = new UnicodeProperties(true); newTypeSettings.put("column-1", portletId); newTypeSettings.put(LayoutTypePortletConstants.LAYOUT_TEMPLATE_ID, "1_column"); return newTypeSettings.toString(); }
From source file:com.liferay.mobile.device.rules.model.impl.MDRRuleImpl.java
License:Open Source License
@Override public UnicodeProperties getTypeSettingsProperties() { if (_typeSettingsProperties == null) { _typeSettingsProperties = new UnicodeProperties(true); _typeSettingsProperties.fastLoad(getTypeSettings()); }//from ww w. jav a2s.c o m return _typeSettingsProperties; }
From source file:com.liferay.portlet.asset.model.impl.AssetVocabularyImpl.java
License:Open Source License
public UnicodeProperties getSettingsProperties() { if (_settingsProperties == null) { _settingsProperties = new UnicodeProperties(true); _settingsProperties.fastLoad(super.getSettings()); }//w w w . j a va2s . c om return _settingsProperties; }