Package org.opencms.ade.sitemap
Class CmsModelPageHelper
- java.lang.Object
-
- org.opencms.ade.sitemap.CmsModelPageHelper
-
public class CmsModelPageHelper extends java.lang.Object
Helper class for model page operations in the sitemap editor.
-
-
Constructor Summary
Constructors Constructor Description CmsModelPageHelper(CmsObject cms, CmsResource rootResource)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addModelPageToSitemapConfiguration(CmsResource sitemapConfig, CmsResource modelPage, boolean disabled)
Adds a model page to the sitemap config.CmsResource
createModelGroupPage(java.lang.String name, java.lang.String description, CmsUUID copyId)
Creates a new model group page.CmsResource
createPageInModelFolder(java.lang.String name, java.lang.String description, CmsUUID copyId)
Creates a new potential model page in the default folder for new model pages.void
disableModelPage(CmsResource sitemapConfig, CmsUUID structureId, boolean disabled)
Disables the given model page.CmsResource
ensureModelFolder(CmsResource rootResource)
Tries to either read or create the default folder for model pages in the current sitemap, and returns it.java.util.List<CmsModelPageEntry>
getModelGroups()
Returns the local model group pages.CmsModelInfo
getModelInfo()
Returns the model infos.java.util.List<CmsModelPageEntry>
getModelPages()
Reads the model pages from the ADE configuration.java.util.List<CmsModelPageEntry>
getParentModelPages()
Returns the parent model pages.void
removeModelPage(CmsResource sitemapConfig, CmsUUID structureId)
Removes a model page from the sitemap configuration.
-
-
-
Constructor Detail
-
CmsModelPageHelper
public CmsModelPageHelper(CmsObject cms, CmsResource rootResource) throws CmsException
Creates a new instance.- Parameters:
cms
- the CMS context to userootResource
- the root resource for the sitemap- Throws:
CmsException
- if something goes wrong
-
-
Method Detail
-
addModelPageToSitemapConfiguration
public void addModelPageToSitemapConfiguration(CmsResource sitemapConfig, CmsResource modelPage, boolean disabled) throws CmsException
Adds a model page to the sitemap config.- Parameters:
sitemapConfig
- the sitemap configuration resourcemodelPage
- the model page to adddisabled
- true if the model page should be added as 'disabled'- Throws:
CmsException
- if something goes wrong
-
createModelGroupPage
public CmsResource createModelGroupPage(java.lang.String name, java.lang.String description, CmsUUID copyId) throws CmsException
Creates a new model group page.- Parameters:
name
- the page namedescription
- the page descriptioncopyId
- structure id of the resource to use as a model for the model page, if any (may be null)- Returns:
- the new resource
- Throws:
CmsException
- in case something goes wrong
-
createPageInModelFolder
public CmsResource createPageInModelFolder(java.lang.String name, java.lang.String description, CmsUUID copyId) throws CmsException
Creates a new potential model page in the default folder for new model pages.- Parameters:
name
- the title for the model pagedescription
- the description for the model pagecopyId
- structure id of the resource to use as a model for the model page, if any (may be null)- Returns:
- the created resource
- Throws:
CmsException
- if something goes wrong
-
disableModelPage
public void disableModelPage(CmsResource sitemapConfig, CmsUUID structureId, boolean disabled) throws CmsException
Disables the given model page.- Parameters:
sitemapConfig
- the configuration resourcestructureId
- the model page iddisabled
-true
to disabe the entry- Throws:
CmsException
- if something goes wrong
-
ensureModelFolder
public CmsResource ensureModelFolder(CmsResource rootResource) throws CmsException
Tries to either read or create the default folder for model pages in the current sitemap, and returns it.- Parameters:
rootResource
- the root of the sitemap- Returns:
- the folder resource
- Throws:
CmsException
- if something goes wrong
-
getModelGroups
public java.util.List<CmsModelPageEntry> getModelGroups()
Returns the local model group pages.- Returns:
- the model group pages
-
getModelInfo
public CmsModelInfo getModelInfo()
Returns the model infos.- Returns:
- the model infos
-
getModelPages
public java.util.List<CmsModelPageEntry> getModelPages()
Reads the model pages from the ADE configuration.- Returns:
- the list of model pages
-
getParentModelPages
public java.util.List<CmsModelPageEntry> getParentModelPages()
Returns the parent model pages.- Returns:
- the parent model pages
-
removeModelPage
public void removeModelPage(CmsResource sitemapConfig, CmsUUID structureId) throws CmsException
Removes a model page from the sitemap configuration.- Parameters:
sitemapConfig
- the sitemap configuration resourcestructureId
- the structure id of the model page to remove- Throws:
CmsException
- if something goes wrong
-
-