Class CmsXmlContainerPageFactory
- Since:
- 7.5.2
-
Method Summary
Modifier and TypeMethodDescriptionstatic CmsXmlContainerPage
createDocument
(CmsObject cms, Locale locale, String modelUri) Create a new instance of an 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.static CmsXmlContainerPage
createDocument
(CmsObject cms, Locale locale, String encoding, CmsXmlContentDefinition contentDefinition) Create a new instance of a container page based on the given content definition, that will have one language node for the given locale all initialized with default values.static CmsXmlContainerPage
unmarshal
(CmsObject cms, byte[] xmlData, String encoding, EntityResolver resolver) Factory method to unmarshal (generate) a container page instance from a byte array that contains XML data.static CmsXmlContainerPage
unmarshal
(CmsObject cms, String xmlData, String encoding, EntityResolver resolver) Factory method to unmarshal (generate) a container page instance from a String that contains XML data.static CmsXmlContainerPage
unmarshal
(CmsObject cms, org.dom4j.Document document, String encoding, EntityResolver resolver) Factory method to unmarshal (generate) a container page instance from a XML document.static CmsXmlContainerPage
Factory method to unmarshal (read) a container page instance from a OpenCms VFS file that contains XML data.static CmsXmlContainerPage
Factory method to unmarshal (read) a container page instance from a OpenCms VFS file that contains XML data, using wither the encoding set in the XML file header, or the encoding set in the VFS file property.static CmsXmlContainerPage
Factory method to unmarshal (read) a container page instance from a OpenCms VFS file that contains XML data, using wither the encoding set in the XML file header, or the encoding set in the VFS file property.static CmsXmlContainerPage
unmarshal
(CmsObject cms, CmsResource resource) Factory method to unmarshal (read) a container page instance from a OpenCms VFS resource that contains XML data.static CmsXmlContainerPage
unmarshal
(CmsObject cms, CmsResource resource, javax.servlet.ServletRequest req) Factory method to unmarshal (read) a container page instance from a resource, using the request attributes as cache.
-
Method Details
-
createDocument
public static CmsXmlContainerPage createDocument(CmsObject cms, Locale locale, String modelUri) throws CmsException Create a new instance of an 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.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- Returns:
- the created container page
- Throws:
CmsException
- in case the model file is not found or not valid
-
createDocument
public static CmsXmlContainerPage createDocument(CmsObject cms, Locale locale, String encoding, CmsXmlContentDefinition contentDefinition) Create a new instance of a 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 XML content latercontentDefinition
- the content definition to create the content for- Returns:
- the created container page
-
unmarshal
public static CmsXmlContainerPage unmarshal(CmsObject cms, byte[] xmlData, String encoding, EntityResolver resolver) throws CmsXmlException Factory method to unmarshal (generate) a container page instance from a byte array that contains XML data.When unmarshalling, the encoding is read directly from the XML header of the byte array. The given encoding is used only when marshalling the XML again later.
Warning:
This method does not support requested historic versions, it always loads the most recent version. Use
for history support.unmarshal(CmsObject, CmsResource, ServletRequest)
- Parameters:
cms
- the cms contextxmlData
- the XML data in a byte arrayencoding
- the encoding to use when marshalling the XML content laterresolver
- the XML entitiy resolver to use- Returns:
- a container page instance unmarshalled from the byte array
- Throws:
CmsXmlException
- if something goes wrong
-
unmarshal
Factory method to unmarshal (read) a container page instance from a OpenCms VFS file that contains XML data.Warning:
This method does not support requested historic versions, it always loads the most recent version. Use
for history support.unmarshal(CmsObject, CmsResource, ServletRequest)
- Parameters:
cms
- the current cms objectfile
- the file with the XML data to unmarshal- Returns:
- a container page instance unmarshalled from the provided file
- Throws:
CmsXmlException
- if something goes wrong
-
unmarshal
public static CmsXmlContainerPage unmarshal(CmsObject cms, CmsFile file, boolean keepEncoding) throws CmsXmlException Factory method to unmarshal (read) a container page instance from a OpenCms VFS file that contains XML data, using wither the encoding set in the XML file header, or the encoding set in the VFS file property.If you are not sure about the implications of the encoding issues, use
unmarshal(CmsObject, CmsFile)
instead.Warning:
This method does not support requested historic versions, it always loads the most recent version. Use
for history support.unmarshal(CmsObject, CmsResource, ServletRequest)
- Parameters:
cms
- the current cms objectfile
- the file with the XML data to unmarshalkeepEncoding
- iftrue
, the encoding specified in the XML header is used, otherwise the encoding from the VFS file property is used- Returns:
- a container page instance unmarshalled from the provided file
- Throws:
CmsXmlException
- if something goes wrong
-
unmarshal
public static CmsXmlContainerPage unmarshal(CmsObject cms, CmsFile file, boolean keepEncoding, boolean noCache) throws CmsXmlException Factory method to unmarshal (read) a container page instance from a OpenCms VFS file that contains XML data, using wither the encoding set in the XML file header, or the encoding set in the VFS file property.If you are not sure about the implications of the encoding issues, use
unmarshal(CmsObject, CmsFile)
instead.Warning:
This method does not support requested historic versions, it always loads the most recent version. Use
for history support.unmarshal(CmsObject, CmsResource, ServletRequest)
- Parameters:
cms
- the current cms objectfile
- the file with the XML data to unmarshalkeepEncoding
- iftrue
, the encoding specified in the XML header is used, otherwise the encoding from the VFS file property is usednoCache
-true
to avoid cached results- Returns:
- a container page instance unmarshalled from the provided file
- Throws:
CmsXmlException
- if something goes wrong
-
unmarshal
public static CmsXmlContainerPage unmarshal(CmsObject cms, CmsResource resource) throws CmsException Factory method to unmarshal (read) a container page instance from a OpenCms VFS resource that contains XML data.Warning:
This method does not support requested historic versions, it always loads the most recent version. Use
for history support.unmarshal(CmsObject, CmsResource, ServletRequest)
- Parameters:
cms
- the current cms objectresource
- the resource with the XML data to unmarshal- Returns:
- a container page instance unmarshalled from the provided resource
- Throws:
CmsException
- if something goes wrong
-
unmarshal
public static CmsXmlContainerPage unmarshal(CmsObject cms, CmsResource resource, javax.servlet.ServletRequest req) throws CmsXmlException, CmsLoaderException, CmsException Factory method to unmarshal (read) a container page instance from a resource, using the request attributes as cache.- Parameters:
cms
- the current OpenCms context objectresource
- the resource to unmarshalreq
- the current request- Returns:
- the unmarshaled xml content, or null if the given resource was not of type
CmsResourceTypeXmlContainerPage
- Throws:
CmsException
- in something goes wrongCmsLoaderException
- if no loader for the givenresource
type (CmsResource.getTypeId()
) is availableCmsXmlException
- if the givenresource
is not of type container page
-
unmarshal
public static CmsXmlContainerPage unmarshal(CmsObject cms, org.dom4j.Document document, String encoding, EntityResolver resolver) Factory method to unmarshal (generate) a container page instance from a XML document.The given encoding is used when marshalling the XML again later.
Warning:
This method does not support requested historic versions, it always loads the most recent version. Use
for history support.unmarshal(CmsObject, CmsResource, ServletRequest)
- Parameters:
cms
- the cms context, ifnull
no link validation is performeddocument
- the XML document to generate the container page fromencoding
- the encoding to use when marshalling the container page laterresolver
- the XML entity resolver to use- Returns:
- a container page instance unmarshalled from the String
-
unmarshal
public static CmsXmlContainerPage unmarshal(CmsObject cms, String xmlData, String encoding, EntityResolver resolver) throws CmsXmlException Factory method to unmarshal (generate) a container page instance from a String that contains XML data.The given encoding is used when marshalling the XML again later.
Warning:
This method does not support requested historic versions, it always loads the most recent version. Use
for history support.unmarshal(CmsObject, CmsResource, ServletRequest)
- Parameters:
cms
- the cms context, ifnull
no link validation is performedxmlData
- the XML data in a Stringencoding
- the encoding to use when marshalling the container page laterresolver
- the XML entity resolver to use- Returns:
- a container page instance unmarshalled from the String
- Throws:
CmsXmlException
- if something goes wrong
-