public static void saveProperties(
        CmsObject cms,
        Element parentElement,
        Map<String, String> properties,
        Map<String, CmsXmlContentProperty> propertiesConf) {

        // remove old entries
        for (Object propElement : parentElement.elements(CmsXmlContentProperty.XmlNode.Properties.name())) {
            parentElement.remove((Element)propElement);
        }

        // use a sorted map to force a defined order
        SortedMap<String, String> props = new TreeMap<String, String>(properties);

        // create new entries
        for (Map.Entry<String, String> property : props.entrySet()) {
            String propName = property.getKey();
            String propValue = property.getValue();
            if ((propValue == null) || (propValue.length() == 0)) {
                continue;
            }
            // only if the property is configured in the schema we will save it
            Element propElement = parentElement.addElement(CmsXmlContentProperty.XmlNode.Properties.name());

            // the property name
            propElement.addElement(CmsXmlContentProperty.XmlNode.Name.name()).addCDATA(propName);
            Element valueElement = propElement.addElement(CmsXmlContentProperty.XmlNode.Value.name());
            boolean isVfs = false;
            CmsXmlContentProperty propDef = propertiesConf.get(propName);
            if (propDef != null) {
                isVfs = CmsXmlContentProperty.PropType.isVfsList(propDef.getType());
            }
            if (!isVfs) {
                // string value
                valueElement.addElement(CmsXmlContentProperty.XmlNode.String.name()).addCDATA(propValue);
            } else {
                addFileListPropertyValue(cms, valueElement, propValue);
            }
        }
    }
public static void saveProperties ( CmsObject cms , Element parentElement , Map < String , String > properties , Map < String , CmsXmlContentProperty > propertiesConf ) { for ( Object propElement : parentElement . elements ( CmsXmlContentProperty . XmlNode . Properties . name ( ) ) ) { parentElement . remove ( ( Element ) propElement ) ; } SortedMap < String , String > props = new TreeMap < String , String > ( properties ) ; for ( Map . Entry < String , String > property : props . entrySet ( ) ) { String propName = property . getKey ( ) ; String propValue = property . getValue ( ) ; if ( ( propValue == null ) || ( propValue . length ( ) == 0 ) ) { continue ; } Element propElement = parentElement . addElement ( CmsXmlContentProperty . XmlNode . Properties . name ( ) ) ; propElement . addElement ( CmsXmlContentProperty . XmlNode . Name . name ( ) ) . addCDATA ( propName ) ; Element valueElement = propElement . addElement ( CmsXmlContentProperty . XmlNode . Value . name ( ) ) ; boolean isVfs = false ; CmsXmlContentProperty propDef = propertiesConf . get ( propName ) ; if ( propDef != null ) { isVfs = CmsXmlContentProperty . PropType . isVfsList ( propDef . getType ( ) ) ; } if ( ! isVfs ) { valueElement . addElement ( CmsXmlContentProperty . XmlNode . String . name ( ) ) . addCDATA ( propValue ) ; } else { addFileListPropertyValue ( cms , valueElement , propValue ) ; } } }
Saves the given properties to the given xml element.<p>

@param cms the current CMS context
@param parentElement the parent xml element
@param properties the properties to save, if there is a list of resources, every entry can be a site path or a UUID
@param propertiesConf the configuration of the properties