Package org.opencms.xml.containerpage
Class CmsXmlGroupContainer
- java.lang.Object
-
- org.opencms.xml.A_CmsXmlDocument
-
- org.opencms.xml.content.CmsXmlContent
-
- org.opencms.xml.containerpage.CmsXmlGroupContainer
-
- All Implemented Interfaces:
I_CmsXmlDocument
public class CmsXmlGroupContainer extends CmsXmlContent
Implementation of a object used to access and manage the xml data of a group container.In addition to the XML content interface. It also provides access to more comfortable beans.
- Since:
- 8.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCmsXmlGroupContainer.XmlNodeXML node name constants.
-
Field Summary
-
Fields inherited from class org.opencms.xml.content.CmsXmlContent
A_VERSION, AUTO_CORRECTION_ATTRIBUTE, m_autoCorrectionEnabled, m_contentDefinition, XERCES_SCHEMA_PROPERTY
-
Fields inherited from class org.opencms.xml.A_CmsXmlDocument
m_conversion, m_document, m_elementLocales, m_elementNames, m_encoding, m_file, m_locales
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCmsXmlGroupContainer()Hides the public constructor.protectedCmsXmlGroupContainer(CmsObject cms, java.util.Locale locale, java.lang.String modelUri)Create a new group container based on the given default content, that will have all language nodes of the default content and ensures the presence of the given locale.protectedCmsXmlGroupContainer(CmsObject cms, java.util.Locale locale, java.lang.String encoding, CmsXmlContentDefinition contentDefinition)Create a new container page based on the given content definition, that will have one language node for the given locale all initialized with default values.protectedCmsXmlGroupContainer(CmsObject cms, org.dom4j.Document document, java.lang.String encoding, org.xml.sax.EntityResolver resolver)Creates a new group container based on the provided XML document.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearLocales()Removes all locales from the element group XML.protected voidfillResource(CmsObject cms, org.dom4j.Element element, CmsResource res)Fills aCmsXmlVfsFileValuewith the resource identified by the given id.CmsGroupContainerBeangetGroupContainer(CmsObject cms)Returns the group container bean for the given locale.protected voidinitDocument(org.dom4j.Document document, java.lang.String encoding, CmsXmlContentDefinition definition)Initializes an XML document based on the provided document, encoding and content definition.booleanisAutoCorrectionEnabled()Returnstrueif the auto correction feature is enabled for saving this XML content.voidsave(CmsObject cms, CmsGroupContainerBean groupContainer, java.util.Locale locale)Saves given container page in the current locale, and not only in memory but also to VFS.protected voidsaveGroupContainer(CmsObject cms, org.dom4j.Element parent, CmsGroupContainerBean groupContainer)Adds the given container page to the given element.protected voidsetFile(CmsFile file)Sets the file this XML content is written to.-
Methods inherited from class org.opencms.xml.content.CmsXmlContent
addBookmarkForElement, addBookmarkForValue, addLocale, addValue, addValue, clone, copyLocale, getAllSimpleSubValues, getBookmark, getBookmarks, getChoiceOptions, getContentDefinition, getContentDefinition, getHandler, getLinkProcessor, getLocaleNode, getSchemaVersion, getSimpleValuesBelowPath, getSubValues, getValuesByPath, getValueSequence, hasChoiceOptions, initDocument, isLocaleIndependent, isTransformedVersion, processSchemaNode, removeValue, resolveMappings, setAutoCorrectionEnabled, synchronizeLocaleIndependentValues, validate, visitAllValuesWith
-
Methods inherited from class org.opencms.xml.A_CmsXmlDocument
addBookmark, addLocale, clearBookmarks, copyLocale, copyLocale, correctXmlStructure, createDeepElementCopy, getBestMatchingLocale, getBookmark, getBookmarkName, getConversion, getEncoding, getFile, getIndexCount, getLocales, getLocales, getNames, getStringValue, getStringValue, getTempDataCache, getValue, getValue, getValueInternal, getValues, getValues, hasLocale, hasValue, hasValue, initDocument, isEnabled, isEnabled, marshal, marshal, moveLocale, removeBookmark, removeLocale, setConversion, toString, updateLocaleNodeSorting, validateXmlStructure
-
-
-
-
Constructor Detail
-
CmsXmlGroupContainer
protected CmsXmlGroupContainer()
Hides the public constructor.
-
CmsXmlGroupContainer
protected CmsXmlGroupContainer(CmsObject cms, org.dom4j.Document document, java.lang.String encoding, org.xml.sax.EntityResolver resolver)
Creates a new group container based on the provided XML document.The given encoding is used when marshalling the XML again later.
- Parameters:
cms- the cms context, ifnullno link validation is performeddocument- the document to create the container page fromencoding- the encoding of the container pageresolver- the XML entity resolver to use
-
CmsXmlGroupContainer
protected CmsXmlGroupContainer(CmsObject cms, java.util.Locale locale, java.lang.String modelUri) throws CmsException
Create a new group container based on the given default content, that will have all language nodes of the default content and ensures the presence of the given locale.The given encoding is used when marshalling the XML again later.
- Parameters:
cms- the current users OpenCms contentlocale- the locale to generate the default content formodelUri- the absolute path to the container page file acting as model- Throws:
CmsException- in case the model file is not found or not valid
-
CmsXmlGroupContainer
protected CmsXmlGroupContainer(CmsObject cms, java.util.Locale locale, java.lang.String encoding, CmsXmlContentDefinition contentDefinition)
Create a new container page based on the given content definition, that will have one language node for the given locale all initialized with default values.The given encoding is used when marshalling the XML again later.
- Parameters:
cms- the current users OpenCms contentlocale- the locale to generate the default content forencoding- the encoding to use when marshalling the container page latercontentDefinition- the content definition to create the content for
-
-
Method Detail
-
clearLocales
public void clearLocales() throws CmsXmlException
Removes all locales from the element group XML.- Throws:
CmsXmlException- if something goes wrong
-
getGroupContainer
public CmsGroupContainerBean getGroupContainer(CmsObject cms)
Returns the group container bean for the given locale.- Parameters:
cms- the cms context- Returns:
- the group container bean
-
isAutoCorrectionEnabled
public boolean isAutoCorrectionEnabled()
Description copied from class:A_CmsXmlDocumentReturnstrueif the auto correction feature is enabled for saving this XML content.- Overrides:
isAutoCorrectionEnabledin classCmsXmlContent- Returns:
trueif the auto correction feature is enabled for saving this XML content- See Also:
CmsXmlContent.isAutoCorrectionEnabled()
-
save
public void save(CmsObject cms, CmsGroupContainerBean groupContainer, java.util.Locale locale) throws CmsException
Saves given container page in the current locale, and not only in memory but also to VFS.- Parameters:
cms- the current cms contextgroupContainer- the group-container page to savelocale- the locale to save- Throws:
CmsException- if something goes wrong
-
fillResource
protected void fillResource(CmsObject cms, org.dom4j.Element element, CmsResource res)
Fills aCmsXmlVfsFileValuewith the resource identified by the given id.- Parameters:
cms- the current CMS contextelement- the XML element to fillres- the resource to use
-
initDocument
protected void initDocument(org.dom4j.Document document, java.lang.String encoding, CmsXmlContentDefinition definition)
Description copied from class:A_CmsXmlDocumentInitializes an XML document based on the provided document, encoding and content definition.- Overrides:
initDocumentin classCmsXmlContent- Parameters:
document- the base XML document to use for initializingencoding- the encoding to use when marshalling the document laterdefinition- the content definition to use- See Also:
A_CmsXmlDocument.initDocument(org.dom4j.Document, java.lang.String, org.opencms.xml.CmsXmlContentDefinition)
-
saveGroupContainer
protected void saveGroupContainer(CmsObject cms, org.dom4j.Element parent, CmsGroupContainerBean groupContainer) throws CmsException
Adds the given container page to the given element.- Parameters:
cms- the current CMS objectparent- the element to add itgroupContainer- the container page to add- Throws:
CmsException- if something goes wrong
-
setFile
protected void setFile(CmsFile file)
Description copied from class:CmsXmlContentSets the file this XML content is written to.- Overrides:
setFilein classCmsXmlContent- Parameters:
file- the file this XML content content is written to- See Also:
CmsXmlContent.setFile(org.opencms.file.CmsFile)
-
-