Class CmsContainerPageWrapper
- java.lang.Object
-
- org.opencms.xml.containerpage.mutable.CmsContainerPageWrapper
-
public class CmsContainerPageWrapper extends java.lang.Object
'Wrapper' around XML container page used for programmatic editing operations on container pages.Uses mutable helper classes for the container page and its containers.
-
-
Constructor Summary
Constructors Constructor Description CmsContainerPageWrapper(CmsObject cms, CmsResource res)
Creates a new instance by reading the container page from a file.CmsContainerPageWrapper(CmsObject cms, CmsXmlContainerPage xml)
Creates a new instance from an existing XML container page object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addElementToContainer(java.lang.String containerName, CmsContainerElementBean element)
Adds an element to the given container (the first container with the given container suffix is used).byte[]
marshal()
Marshals the page data without writing it to the VFS.CmsMutableContainerPage
page()
Gets the mutable page bean instance.void
saveToVfs()
Saves the page data to the VFS, using the same resource from which this object was created.
-
-
-
Constructor Detail
-
CmsContainerPageWrapper
public CmsContainerPageWrapper(CmsObject cms, CmsResource res) throws CmsException
Creates a new instance by reading the container page from a file.- Parameters:
cms
- the CMS contextres
- the resource- Throws:
CmsException
- if something goes wrong
-
CmsContainerPageWrapper
public CmsContainerPageWrapper(CmsObject cms, CmsXmlContainerPage xml)
Creates a new instance from an existing XML container page object.- Parameters:
cms
- the CMS contextxml
- the XML container page object
-
-
Method Detail
-
addElementToContainer
public boolean addElementToContainer(java.lang.String containerName, CmsContainerElementBean element)
Adds an element to the given container (the first container with the given container suffix is used).- Parameters:
containerName
- the container name or suffixelement
- the element to add- Returns:
- false if there was no container to add the element to, true otherwise
-
marshal
public byte[] marshal() throws CmsException
Marshals the page data without writing it to the VFS.- Returns:
- the marshalled page data
- Throws:
CmsException
- if something goes wrong
-
page
public CmsMutableContainerPage page()
Gets the mutable page bean instance.- Returns:
- the mutable page bean
-
saveToVfs
public void saveToVfs() throws CmsException
Saves the page data to the VFS, using the same resource from which this object was created.- Throws:
CmsException
- if something goes wrong
-
-