public class CmsXmlContainerPage extends CmsXmlContent
In addition to the XML content interface. It also provides access to more comfortable beans.
getContainerPage(CmsObject)| Modifier and Type | Class and Description |
|---|---|
static class |
CmsXmlContainerPage.XmlNode
XML node name constants.
|
AUTO_CORRECTION_ATTRIBUTE, m_autoCorrectionEnabled, m_contentDefinition, XERCES_SCHEMA_PROPERTYm_conversion, m_document, m_elementLocales, m_elementNames, m_encoding, m_file, m_locales| Modifier | Constructor and Description |
|---|---|
protected |
CmsXmlContainerPage()
Hides the public constructor.
|
protected |
CmsXmlContainerPage(CmsObject cms,
org.dom4j.Document document,
java.lang.String encoding,
org.xml.sax.EntityResolver resolver)
Creates a new container page based on the provided XML document.
|
protected |
CmsXmlContainerPage(CmsObject cms,
java.util.Locale locale,
java.lang.String modelUri)
Create a new container page based on the given default content,
that will have all language nodes of the default content and ensures the presence of the given locale.
|
protected |
CmsXmlContainerPage(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.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkLinkConcistency(CmsObject cms)
Checks the link consistency for a given locale and reinitializes the document afterwards.
|
protected CmsContainerPageBean |
cleanupContainersContainers(CmsObject cms,
CmsContainerPageBean cntPage)
Removes all empty containers and merges the containers of the current document that are not used in the given container page with it.
|
byte[] |
createContainerPageXml(CmsObject cms,
CmsContainerPageBean cntPage)
Saves a container page bean to the in-memory XML structure and returns the changed content.
|
protected CmsResource |
fillResource(CmsObject cms,
org.dom4j.Element element,
CmsUUID resourceId)
Fills a
CmsXmlVfsFileValue with the resource identified by the given id. |
CmsContainerPageBean |
getContainerPage(CmsObject cms)
Gets the container page content as a bean.
|
protected void |
initDocument(CmsObject cms,
org.dom4j.Document document,
java.lang.String encoding,
CmsXmlContentDefinition definition)
Initializes an XML document based on the provided document, encoding and content definition.
|
protected void |
initDocument(org.dom4j.Document document,
java.lang.String encoding,
CmsXmlContentDefinition definition)
Initializes an XML document based on the provided document, encoding and content definition.
|
boolean |
isAutoCorrectionEnabled()
Returns
true if the auto correction feature is enabled for saving this XML content. |
protected CmsContainerPageBean |
removeEmptyContainers(CmsContainerPageBean cntPage)
Removes all empty containers to clean up container page XML.
|
void |
save(CmsObject cms,
CmsContainerPageBean cntPage)
Saves given container page in the current locale, and not only in memory but also to VFS.
|
void |
save(CmsObject cms,
CmsContainerPageBean cntPage,
boolean ifChangedOnly)
Saves given container page in the current locale, and not only in memory but also to VFS.
|
protected void |
saveContainerPage(CmsObject cms,
org.dom4j.Element parent,
CmsContainerPageBean cntPage)
Adds the given container page to the given element.
|
protected void |
setFile(CmsFile file)
Sets the file this XML content is written to.
|
void |
writeContainerPage(CmsObject cms,
CmsContainerPageBean cntPage)
Saves a container page in in-memory XML structure.
|
addBookmarkForElement, addBookmarkForValue, addLocale, addValue, addValue, clone, copyLocale, getAllSimpleSubValues, getBookmark, getBookmarks, getChoiceOptions, getContentDefinition, getContentDefinition, getHandler, getLinkProcessor, getLocaleNode, getSimpleValuesBelowPath, getSubValues, getValuesByPath, getValueSequence, hasChoiceOptions, isLocaleIndependent, processSchemaNode, removeValue, resolveMappings, setAutoCorrectionEnabled, synchronizeLocaleIndependentValues, validate, visitAllValuesWithaddBookmark, addLocale, clearBookmarks, copyLocale, copyLocale, correctXmlStructure, createDeepElementCopy, getBestMatchingLocale, getBookmark, getBookmarkName, getConversion, getEncoding, getFile, getIndexCount, getLocales, getLocales, getNames, getStringValue, getStringValue, getValue, getValue, getValueInternal, getValues, getValues, hasLocale, hasValue, hasValue, initDocument, isEnabled, isEnabled, marshal, marshal, moveLocale, removeBookmark, removeLocale, setConversion, toString, updateLocaleNodeSorting, validateXmlStructureprotected CmsXmlContainerPage()
protected CmsXmlContainerPage(CmsObject cms, org.dom4j.Document document, java.lang.String encoding, org.xml.sax.EntityResolver resolver)
The given encoding is used when marshalling the XML again later.
cms - the cms context, if null no link validation is performeddocument - the document to create the container page fromencoding - the encoding of the container pageresolver - the XML entity resolver to useprotected CmsXmlContainerPage(CmsObject cms, java.util.Locale locale, java.lang.String modelUri) throws CmsException
The given encoding is used when marshalling the XML again later.
cms - the current users OpenCms contentlocale - the locale to generate the default content formodelUri - the absolute path to the container page file acting as modelCmsException - in case the model file is not found or not validprotected CmsXmlContainerPage(CmsObject cms, java.util.Locale locale, java.lang.String encoding, CmsXmlContentDefinition contentDefinition)
The given encoding is used when marshalling the XML again later.
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 forpublic byte[] createContainerPageXml(CmsObject cms, CmsContainerPageBean cntPage) throws CmsException
cms - the current CMS contextcntPage - the container page beanCmsException - if something goes wrongpublic CmsContainerPageBean getContainerPage(CmsObject cms)
cms - the current CMS contextpublic boolean isAutoCorrectionEnabled()
A_CmsXmlDocumenttrue if the auto correction feature is enabled for saving this XML content.isAutoCorrectionEnabled in class CmsXmlContenttrue if the auto correction feature is enabled for saving this XML contentCmsXmlContent.isAutoCorrectionEnabled()public void save(CmsObject cms, CmsContainerPageBean cntPage) throws CmsException
cms - the current cms contextcntPage - the container page to saveCmsException - if something goes wrongpublic void save(CmsObject cms, CmsContainerPageBean cntPage, boolean ifChangedOnly) throws CmsException
cms - the current cms contextcntPage - the container page to saveifChangedOnly - true to only write the file if the content has changedCmsException - if something goes wrongpublic void writeContainerPage(CmsObject cms, CmsContainerPageBean cntPage) throws CmsException
cms - the current CMS contextcntPage - the container page bean to saveCmsException - if something goes wrongprotected void checkLinkConcistency(CmsObject cms)
cms - the cms contextprotected CmsContainerPageBean cleanupContainersContainers(CmsObject cms, CmsContainerPageBean cntPage)
cms - the current CMS contextcntPage - the container page to mergeprotected CmsResource fillResource(CmsObject cms, org.dom4j.Element element, CmsUUID resourceId) throws CmsException
CmsXmlVfsFileValue with the resource identified by the given id.cms - the current CMS contextelement - the XML element to fillresourceId - the ID identifying the resource to useCmsException - if the resource can not be readprotected void initDocument(CmsObject cms, org.dom4j.Document document, java.lang.String encoding, CmsXmlContentDefinition definition)
CmsXmlContentChecks the links and removes invalid ones in the initialized document.
initDocument in class CmsXmlContentcms - the current users OpenCms contentdocument - the base XML document to use for initializingencoding - the encoding to use when marshalling the document laterdefinition - the content definition to useCmsXmlContent.initDocument(org.opencms.file.CmsObject, org.dom4j.Document, java.lang.String, org.opencms.xml.CmsXmlContentDefinition)protected void initDocument(org.dom4j.Document document, java.lang.String encoding, CmsXmlContentDefinition definition)
A_CmsXmlDocumentinitDocument in class CmsXmlContentdocument - the base XML document to use for initializingencoding - the encoding to use when marshalling the document laterdefinition - the content definition to useA_CmsXmlDocument.initDocument(org.dom4j.Document, java.lang.String, org.opencms.xml.CmsXmlContentDefinition)protected CmsContainerPageBean removeEmptyContainers(CmsContainerPageBean cntPage)
cntPage - the container page beanprotected void saveContainerPage(CmsObject cms, org.dom4j.Element parent, CmsContainerPageBean cntPage) throws CmsException
cms - the current CMS objectparent - the element to add itcntPage - the container page to addCmsException - if something goes wrongprotected void setFile(CmsFile file)
CmsXmlContentsetFile in class CmsXmlContentfile - the file this XML content content is written toCmsXmlContent.setFile(org.opencms.file.CmsFile)