Package org.opencms.ade.sitemap
Class CmsSitemapAttributeUpdater
- java.lang.Object
-
- org.opencms.ade.sitemap.CmsSitemapAttributeUpdater
-
public class CmsSitemapAttributeUpdater extends java.lang.Object
Performs attribute changes in a sitemap configuration file CmsXmlContent instance.
-
-
Constructor Summary
Constructors Constructor Description CmsSitemapAttributeUpdater(CmsObject cms, CmsXmlContent sitemapConfig)
Creates a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.util.Map<java.lang.String,java.lang.String>
computeUpdatesRelativeToInheritedValues(java.util.Map<java.lang.String,java.lang.String> newAttributes, CmsADEConfigData config)
Given a map of attribute values (usually from the attribute editor), this method computes the necessary updates to perform.java.util.Map<java.lang.String,java.lang.String>
getAttributesFromContent()
Gets the sitemap attributes that are currently stored in the XML content.CmsXmlContent
getContent()
Gets the XML content which this object operates on.void
replaceAttributes(java.util.Map<java.lang.String,java.lang.String> allValues)
Completely replaces the sitemap attributes in the XML content with the entries from the map passed as a parameter.boolean
saveAttributesFromEditorDialog(java.util.Map<java.lang.String,java.lang.String> attributes)
Saves the attributes coming from the editor dialog.boolean
updateAttributes(java.util.Map<java.lang.String,java.lang.String> attributeUpdates)
Performs a set of attribute changes.
-
-
-
Constructor Detail
-
CmsSitemapAttributeUpdater
public CmsSitemapAttributeUpdater(CmsObject cms, CmsXmlContent sitemapConfig)
Creates a new instance.- Parameters:
cms
- the CmsObject to usesitemapConfig
- the sitemap configuration XML content
-
-
Method Detail
-
computeUpdatesRelativeToInheritedValues
public static java.util.Map<java.lang.String,java.lang.String> computeUpdatesRelativeToInheritedValues(java.util.Map<java.lang.String,java.lang.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
public java.util.Map<java.lang.String,java.lang.String> getAttributesFromContent()
Gets the sitemap attributes that are currently stored in the XML content.- Returns:
- the map of sitemap attributes
-
getContent
public CmsXmlContent getContent()
Gets the XML content which this object operates on.- Returns:
- the XML content
-
replaceAttributes
public void replaceAttributes(java.util.Map<java.lang.String,java.lang.String> allValues)
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
public boolean saveAttributesFromEditorDialog(java.util.Map<java.lang.String,java.lang.String> attributes)
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
public boolean updateAttributes(java.util.Map<java.lang.String,java.lang.String> attributeUpdates)
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
-
-