Class CmsContainerConfigurationWriter
java.lang.Object
org.opencms.ade.containerpage.inherited.CmsContainerConfigurationWriter
A helper class for writing inherited container configuration back to a VFS file.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected CmsContainerConfiguration
createConfigurationBean
(boolean newOrdering, List<CmsContainerElementBean> elements, Set<String> parentKeys) Converts a list of container elements into a bean which should be saved to the inherited container configuration.protected Map<String,
CmsXmlContentProperty> getSettingConfiguration
(CmsObject cms, CmsResource resource) Gets the setting configuration of an element.protected void
removeExistingEntry
(CmsObject cms, CmsXmlContent content, Locale locale, String name) Removes an existing inheritance container entry with a given name from the configuration file.void
save
(CmsObject cms, String name, boolean newOrdering, CmsResource pageResource, List<CmsContainerElementBean> elements) Saves a list of container element beans to a file in the VFS.protected CmsXmlContent
saveInContentObject
(CmsObject cms, CmsXmlContent content, Locale locale, String name, CmsContainerConfiguration configuration) Saves a single container configuration in an XML content object, but doesn't write it to the VFS.org.dom4j.Element
serializeSingleConfiguration
(CmsObject cms, String name, CmsContainerConfiguration config, org.dom4j.Element parentElement) Serializes a single container configuration into an XML element.
-
Constructor Details
-
CmsContainerConfigurationWriter
public CmsContainerConfigurationWriter()
-
-
Method Details
-
save
public void save(CmsObject cms, String name, boolean newOrdering, CmsResource pageResource, List<CmsContainerElementBean> elements) throws CmsException Saves a list of container element beans to a file in the VFS.- Parameters:
cms
- the current CMS contextname
- the name of the configuration to savenewOrdering
- true if a new ordering needs to be savedpageResource
- a container page or folderelements
- the elements whose data should be saved- Throws:
CmsException
- if something goes wrong
-
serializeSingleConfiguration
public org.dom4j.Element serializeSingleConfiguration(CmsObject cms, String name, CmsContainerConfiguration config, org.dom4j.Element parentElement) throws CmsException Serializes a single container configuration into an XML element.- Parameters:
cms
- the current CMS contextname
- the configuration nameconfig
- the configuration beanparentElement
- the parent element to which the new element should be attached- Returns:
- the created XML element
- Throws:
CmsException
- if something goes wrong
-
createConfigurationBean
protected CmsContainerConfiguration createConfigurationBean(boolean newOrdering, List<CmsContainerElementBean> elements, Set<String> parentKeys) Converts a list of container elements into a bean which should be saved to the inherited container configuration.- Parameters:
newOrdering
- if true, save a new orderingelements
- the elements which should be convertedparentKeys
- the keys for new elements defined in the parent configurations- Returns:
- the bean containing the information from the container elements which should be saved
-
getSettingConfiguration
protected Map<String,CmsXmlContentProperty> getSettingConfiguration(CmsObject cms, CmsResource resource) throws CmsException Gets the setting configuration of an element.- Parameters:
cms
- the current CMS contextresource
- the resource for which the setting configuration should be returned- Returns:
- the setting configuration for that element
- Throws:
CmsException
- if something goes wrong
-
removeExistingEntry
protected void removeExistingEntry(CmsObject cms, CmsXmlContent content, Locale locale, String name) Removes an existing inheritance container entry with a given name from the configuration file.This does nothing if no such entry actually exists.
- Parameters:
cms
- the current CMS contextcontent
- the XML contentlocale
- the locale from which to remove the entryname
- the name of the entry
-
saveInContentObject
protected CmsXmlContent saveInContentObject(CmsObject cms, CmsXmlContent content, Locale locale, String name, CmsContainerConfiguration configuration) throws CmsException Saves a single container configuration in an XML content object, but doesn't write it to the VFS.If the XML content passed as a parameter is null, a new XML content object will be created
- Parameters:
cms
- the current CMS contextcontent
- the XML contentlocale
- the locale in which the configuration should be writtenname
- the name of the configurationconfiguration
- the configuration to write- Returns:
- the modified or new XML content
- Throws:
CmsException
- if something goes wrong
-