public static double getDouble( UnicodeProperties properties, PortletRequest portletRequest, String param, double defaultValue, Locale locale) { String propertiesValue = properties.getProperty(param, null); double getterUtilValue = GetterUtil.getDouble( propertiesValue, defaultValue); return ParamUtil.getDouble( portletRequest, param, getterUtilValue, locale); }
protected String getNewTypeSettings( String typeSettings, String oldPropertyId, String newPropertyId) { UnicodeProperties typeSettingsProperties = new UnicodeProperties(true); typeSettingsProperties.fastLoad(typeSettings); String value = typeSettingsProperties.remove(oldPropertyId); if (value != null) { typeSettingsProperties.setProperty(newPropertyId, value); } return typeSettingsProperties.toString(); }
public String getProperty(String key, String defaultValue) { String value = get(key); if (value == null) { return defaultValue; } return value; }
/** * @deprecated As of Judson (7.1.x) */ @Deprecated protected String getNewTypeSettings( String typeSettings, String oldRootPortletId, String newRootPortletId, List<String> columnIds, boolean exactMatch) { UnicodeProperties typeSettingsProperties = new UnicodeProperties(true); typeSettingsProperties.fastLoad(typeSettings); return getNewTypeSettings( typeSettings, oldRootPortletId, newRootPortletId, exactMatch); }
public static UnicodeProperties getProperties( HttpServletRequest request, String prefix) { UnicodeProperties properties = new UnicodeProperties(true); Map<String, String[]> parameterMap = request.getParameterMap(); for (String param : parameterMap.keySet()) { if (param.startsWith(prefix)) { String key = param.substring( prefix.length(), param.length() - 2); String value = request.getParameter(param); properties.setProperty(key, value); } } return properties; }
boolean exactMatch) { UnicodeProperties typeSettingsProperties = new UnicodeProperties(true); typeSettingsProperties.fastLoad(typeSettings); typeSettingsProperties.entrySet()) { typeSettingsProperties.setProperty(typeSettingId, portletIdsString); return typeSettingsProperties.toString();
@Override public void updatePropertiesOnRemoveFromLayout( String portletId, UnicodeProperties typeSettingsProperties) throws PortletLayoutListenerException { String defaultAssetPublisherPortletId = typeSettingsProperties.getProperty( LayoutTypePortletConstants.DEFAULT_ASSET_PUBLISHER_PORTLET_ID); if (portletId.equals(defaultAssetPublisherPortletId)) { typeSettingsProperties.setProperty( LayoutTypePortletConstants.DEFAULT_ASSET_PUBLISHER_PORTLET_ID, StringPool.BLANK); } }
protected Date getLayoutSetLastPublishDate(long groupId) throws Exception { try (PreparedStatement ps = connection.prepareStatement( "select settings_ from LayoutSet where groupId = ?")) { ps.setLong(1, groupId); try (ResultSet rs = ps.executeQuery()) { while (rs.next()) { UnicodeProperties settingsProperties = new UnicodeProperties(true); settingsProperties.load(rs.getString("settings_")); String lastPublishDateString = settingsProperties.getProperty("last-publish-date"); if (Validator.isNotNull(lastPublishDateString)) { return new Date( GetterUtil.getLong(lastPublishDateString)); } } return null; } } }
public void put(String line) { line = line.trim(); if (_isComment(line)) { return; } int pos = line.indexOf(CharPool.EQUAL); if (pos == -1) { _log.error("Invalid property on line " + line); } else { String value = StringUtil.trim(line.substring(pos + 1)); if (_safe) { value = _decode(value); } setProperty(StringUtil.trim(line.substring(0, pos)), value); } }
UnicodeProperties typeSettingsProperties = new UnicodeProperties(); typeSettingsProperties.put("title", folder.getName());
private Layout _createAssetDisplayLayout(long groupId) throws PortalException { Group group = _groupLocalService.fetchGroup(groupId); long defaultUserId = _userLocalService.getDefaultUserId( group.getCompanyId()); Locale locale = LocaleUtil.getSiteDefault(); Map<Locale, String> nameMap = new HashMap<>(); nameMap.put(locale, "Asset Display Page"); UnicodeProperties typeSettingsProperties = new UnicodeProperties(); typeSettingsProperties.put("visible", Boolean.FALSE.toString()); ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext(); serviceContext.setAttribute( "layout.instanceable.allowed", Boolean.TRUE); return _layoutLocalService.addLayout( defaultUserId, groupId, false, 0, nameMap, null, null, null, null, "asset_display", typeSettingsProperties.toString(), true, new HashMap<>(), serviceContext); }
private void _setGroupTypeSetting(long groupId, String key, String value) { Group group = _groupLocalService.fetchGroup(groupId); if (group == null) { return; } UnicodeProperties typeSettingsProperties = group.getTypeSettingsProperties(); if (Validator.isNotNull(value)) { typeSettingsProperties.setProperty(key, value); } else { typeSettingsProperties.remove(key); } group.setTypeSettingsProperties(typeSettingsProperties); group.setTypeSettings(typeSettingsProperties.toString()); _groupLocalService.updateGroup(group); }
public String setProperty(String key, String value) { return put(key, value); }
public String toString() { StringBuilder sb = new StringBuilder(_length); for (String key : keySet()) { String value = get(key); if (Validator.isNotNull(value)) { if (_safe) { value = _encode(value); } sb.append(key); sb.append(StringPool.EQUAL); sb.append(value); sb.append(StringPool.NEW_LINE); } } return sb.toString(); }
@Override public void deleteLastImportSettings(Group liveGroup, boolean privateLayout) throws PortalException { List<Layout> layouts = _layoutLocalService.getLayouts( liveGroup.getGroupId(), privateLayout); for (Layout layout : layouts) { UnicodeProperties typeSettingsProperties = layout.getTypeSettingsProperties(); Set<String> keys = new HashSet<>(); for (String key : typeSettingsProperties.keySet()) { if (key.startsWith("last-import-")) { keys.add(key); } } if (keys.isEmpty()) { continue; } for (String key : keys) { typeSettingsProperties.remove(key); } _layoutLocalService.updateLayout( layout.getGroupId(), layout.isPrivateLayout(), layout.getLayoutId(), typeSettingsProperties.toString()); } }
public static void updateLastPublishDate( long groupId, boolean privateLayout, DateRange dateRange, Date lastPublishDate) throws PortalException { LayoutSet layoutSet = LayoutSetLocalServiceUtil.getLayoutSet( groupId, privateLayout); Date originalLastPublishDate = getLastPublishDate(layoutSet); if (!isValidDateRange(dateRange, originalLastPublishDate)) { return; } if (lastPublishDate == null) { lastPublishDate = new Date(); } UnicodeProperties settingsProperties = layoutSet.getSettingsProperties(); settingsProperties.setProperty( _LAST_PUBLISH_DATE, String.valueOf(lastPublishDate.getTime())); LayoutSetLocalServiceUtil.updateSettings( layoutSet.getGroupId(), layoutSet.isPrivateLayout(), settingsProperties.toString()); }
public String getProperty(String key, String defaultValue) { if (containsKey(key)) { return getProperty(key); } else { return defaultValue; } }
public static void clearLastPublishDate(long groupId, boolean privateLayout) throws PortalException { LayoutSet layoutSet = LayoutSetLocalServiceUtil.getLayoutSet( groupId, privateLayout); UnicodeProperties settingsProperties = layoutSet.getSettingsProperties(); settingsProperties.remove(_LAST_PUBLISH_DATE); LayoutSetLocalServiceUtil.updateSettings( groupId, privateLayout, settingsProperties.toString()); }
group.getTypeSettingsProperties(); if (typeSettingsProperties.isEmpty()) { return false; typeSettingsProperties.getProperty("branchingPrivate")); typeSettingsProperties.getProperty("branchingPublic"));
/** * @deprecated As of Wilberforce (7.0.x), replaced by {@link #toString} */ @Deprecated public String toSortedString() { return toString(); }