Package org.opencms.ade.sitemap
Class CmsSitemapAttributeUpdater
java.lang.Object
org.opencms.ade.sitemap.CmsSitemapAttributeUpdater
Performs attribute changes in a sitemap configuration file CmsXmlContent instance.
-
Constructor Summary
ConstructorDescriptionCmsSitemapAttributeUpdater
(CmsObject cms, CmsXmlContent sitemapConfig) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptioncomputeUpdatesRelativeToInheritedValues
(Map<String, String> newAttributes, CmsADEConfigData config) Given a map of attribute values (usually from the attribute editor), this method computes the necessary updates to perform.Gets the sitemap attributes that are currently stored in the XML content.Gets the XML content which this object operates on.void
replaceAttributes
(Map<String, String> allValues) Completely replaces the sitemap attributes in the XML content with the entries from the map passed as a parameter.boolean
saveAttributesFromEditorDialog
(Map<String, String> attributes) Saves the attributes coming from the editor dialog.boolean
updateAttributes
(Map<String, String> attributeUpdates) Performs a set of attribute changes.
-
Constructor Details
-
CmsSitemapAttributeUpdater
Creates a new instance.- Parameters:
cms
- the CmsObject to usesitemapConfig
- the sitemap configuration XML content
-
-
Method Details
-
computeUpdatesRelativeToInheritedValues
public static Map<String,String> computeUpdatesRelativeToInheritedValues(Map<String, String> newAttributes, CmsADEConfigData config) Given a map of attribute values (usually from the attribute editor), this method computes the necessary updates to perform.Attribute values that match the inherited attribute from a parent sitemap configuration should cause the attribute to be removed.
- Parameters:
newAttributes
- the map of attributesconfig
- the sitemap config we are currently working on- Returns:
- the map of updates (with null values indicating that the key should be removed)
-
getAttributesFromContent
Gets the sitemap attributes that are currently stored in the XML content.- Returns:
- the map of sitemap attributes
-
getContent
Gets the XML content which this object operates on.- Returns:
- the XML content
-
replaceAttributes
Completely replaces the sitemap attributes in the XML content with the entries from the map passed as a parameter.- Parameters:
allValues
- the new sitemap attributes that should replace the existing ones
-
saveAttributesFromEditorDialog
Saves the attributes coming from the editor dialog.This method replaces values that match values inherited from a parent configuration with null (not set).
- Parameters:
attributes
- the attributes to save- Returns:
- true if any changes were made
-
updateAttributes
Performs a set of attribute changes.The map given as an argument may contain null values. In that case, the corresponding attribute is removed from the XML content.
- Parameters:
attributeUpdates
- a map of attributes- Returns:
- true if any attribute changes were necessary in the XML content
-