/** * Helper method for converting a map of properties from client format to server format or vice versa.<p> * * @param cms the CmsObject to use for VFS operations * @param props the map of properties * @param propConfig the property configuration * @param toClient if true, convert from server to client, else from client to server * * @return the converted property map */ protected static Map<String, String> convertProperties( CmsObject cms, Map<String, String> props, Map<String, CmsXmlContentProperty> propConfig, boolean toClient) { Map<String, String> result = new HashMap<String, String>(); for (Map.Entry<String, String> entry : props.entrySet()) { String propName = entry.getKey(); String propValue = entry.getValue(); String type = "string"; CmsXmlContentProperty configEntry = getPropertyConfig(propConfig, propName); if (configEntry != null) { type = configEntry.getType(); } String newValue = convertStringPropertyValue(cms, propValue, type, toClient); result.put(propName, newValue); } return result; }
/** * Extends the given properties with the default values * from property configuration.<p> * * @param cms the current CMS context * @param propertyConfig the property configuration * @param properties the properties to extend * * @return a merged map of properties */ public static Map<String, String> mergeDefaults( CmsObject cms, Map<String, CmsXmlContentProperty> propertyConfig, Map<String, String> properties) { Map<String, String> result = new HashMap<String, String>(); if (propertyConfig != null) { for (Map.Entry<String, CmsXmlContentProperty> entry : propertyConfig.entrySet()) { CmsXmlContentProperty prop = entry.getValue(); String value = getPropValueIds(cms, prop.getType(), prop.getDefault()); if (value != null) { result.put(entry.getKey(), value); } } } result.putAll(properties); return result; }
String settingType = "string"; if (settingsConf.get(settingName) != null) { settingType = settingsConf.get(settingName).getType();
CmsXmlContentProperty propDef = propertiesConf.get(propName); if (propDef != null) { isVfs = CmsXmlContentProperty.PropType.isVfsList(propDef.getType());
/** * Resolves the macros in a single property.<p> * * @param property the property in which macros should be resolved * @param resolver the macro resolver to use * * @return a new property with resolved macros */ public static CmsXmlContentProperty resolveMacrosInProperty( CmsXmlContentProperty property, I_CmsMacroResolver resolver) { String propName = property.getName(); CmsXmlContentProperty result = new CmsXmlContentProperty( propName, property.getType(), property.getWidget(), resolver.resolveMacros(property.getWidgetConfiguration()), property.getRuleRegex(), property.getRuleType(), property.getDefault(), resolver.resolveMacros(property.getNiceName()), resolver.resolveMacros(property.getDescription()), resolver.resolveMacros(property.getError()), property.isPreferFolder() ? "true" : "false"); return result; }