public class CmsContainerPageCopier extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CmsContainerPageCopier.CopyMode
Enum representing the element copy mode.
|
static class |
CmsContainerPageCopier.NoCustomReplacementException
Exception indicating that no custom replacement element was found
for a type which requires replacement.
|
| Constructor and Description |
|---|
CmsContainerPageCopier(CmsObject cms)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
adjustLocalesForElement(CmsResource elementResource)
Converts locales for the copied container element.
|
void |
copyPageOnly(CmsResource originalPage,
java.lang.String targetPageRootPath)
Copies the given container page to the provided root path.
|
CmsResource |
getCopiedFolderOrPage()
Gets the copied folder or page.
|
CmsResource |
getTargetFolder()
Returns the target folder.
|
CmsContainerElementBean |
replaceContainerElement(CmsResource targetPage,
CmsContainerElementBean originalElement)
Produces the replacement for a container page element to use in a copy of an existing container page.
|
void |
replaceElements(CmsResource containerPage)
Replaces the elements in the copied container page with copies, if appropriate based on the current copy mode.
|
void |
run(CmsResource source,
CmsResource target)
Starts the page copying process.
|
void |
run(CmsResource source,
CmsResource target,
java.lang.String targetName)
Starts the page copying process.
|
void |
setCopyMode(CmsContainerPageCopier.CopyMode copyMode)
Sets the copy mode.
|
public CmsContainerPageCopier(CmsObject cms)
cms - the CMS context to usepublic void adjustLocalesForElement(CmsResource elementResource) throws CmsException
elementResource - the copied container elementCmsException - if something goes wrongpublic void copyPageOnly(CmsResource originalPage, java.lang.String targetPageRootPath) throws CmsException, CmsContainerPageCopier.NoCustomReplacementException
originalPage - the page to copytargetPageRootPath - the root path of the copy target.CmsException - thrown if something goes wrong.CmsContainerPageCopier.NoCustomReplacementException - if a custom replacement is not found for a type which requires it.public CmsResource getCopiedFolderOrPage()
public CmsResource getTargetFolder()
public CmsContainerElementBean replaceContainerElement(CmsResource targetPage, CmsContainerElementBean originalElement) throws CmsException, CmsContainerPageCopier.NoCustomReplacementException
targetPage - the target container pageoriginalElement - the original elementCmsException - if something goes wrongCmsContainerPageCopier.NoCustomReplacementException - if a custom replacement is not found for a type which requires itpublic void replaceElements(CmsResource containerPage) throws CmsException, CmsContainerPageCopier.NoCustomReplacementException
containerPage - the container page copy whose elements should be replaced with copiesCmsException - if something goes wrongCmsContainerPageCopier.NoCustomReplacementException - if a custom replacement element was not found for a type which requires itpublic void run(CmsResource source, CmsResource target) throws CmsException, CmsContainerPageCopier.NoCustomReplacementException
source - the source (can be either a container page, or a folder whose default file is a container page)target - the target folderCmsException - if soemthing goes wrongCmsContainerPageCopier.NoCustomReplacementException - if a custom replacement element was not foundpublic void run(CmsResource source, CmsResource target, java.lang.String targetName) throws CmsException, CmsContainerPageCopier.NoCustomReplacementException
source - the source (can be either a container page, or a folder whose default file is a container page)target - the target foldertargetName - the name to give the new folderCmsException - if something goes wrongCmsContainerPageCopier.NoCustomReplacementException - if a custom replacement element was not foundpublic void setCopyMode(CmsContainerPageCopier.CopyMode copyMode)
copyMode - the copy mode