Class CmsADEManager
- java.lang.Object
-
- org.opencms.ade.configuration.CmsADEManager
-
public class CmsADEManager extends java.lang.Object
This is the main class used to access the ADE configuration and also accomplish some other related tasks like loading/saving favorite and recent lists.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
CmsADEManager.FavListProp
JSON property name constant.protected static class
CmsADEManager.Status
A status enum for the initialization status.
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
ADDINFO_ADE_FAVORITE_LIST
User additional info key constant.protected static java.lang.String
ADDINFO_ADE_RECENT_LIST
User additional info key constant.protected static java.lang.String
ADDINFO_ADE_SHOW_EDITOR_HELP
User additional info key constant.static java.lang.String
CLIENT_ID_SEPERATOR
The client id separator.static java.lang.String
CONFIG_FILE_NAME
The configuration file name.static java.lang.String
CONFIG_FOLDER_TYPE
The name of the sitemap configuration file type.static java.lang.String
CONFIG_SUFFIX
The path for sitemap configuration files relative from the base path.static java.lang.String
CONFIG_TYPE
The name of the sitemap configuration file type.static java.lang.String
CONTENT_FOLDER_NAME
The content folder name.static java.lang.String
DEFAULT_DETAILPAGE_TYPE
The default detail page type name.static int
DEFAULT_ELEMENT_LIST_SIZE
Default favorite/recent list size constant.static java.lang.String
ELEMENT_VIEW_TYPE
The name of the element view configuration file type.static java.lang.String
MODULE_CONFIG_TYPE
The name of the module configuration file type.static java.lang.String
MODULE_NAME_ADE_CONFIG
The aADE configuration module name.static java.lang.String
N_LINK
Node name for the nav level link value.static java.lang.String
N_TYPE
Node name for the nav level type value.static java.lang.String
PATH_SITEMAP_EDITOR_JSP
The path to the sitemap editor JSP.
-
Constructor Summary
Constructors Constructor Description CmsADEManager(CmsObject adminCms, CmsMemoryMonitor memoryMonitor, CmsSystemConfiguration systemConfiguration)
Creates a new ADE manager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CmsWaitHandle
addFormatterCacheWaitHandle(boolean online)
Adds a wait handle for the next cache update to a formatter configuration.boolean
canEditSitemapConfiguration(CmsObject cms)
Checks if the sitemap config can be edited by the user in the given CMS context.protected CmsContainerElementBean
elementFromJson(JSONObject data)
Creates an element from its serialized data.protected JSONObject
elementToJson(CmsContainerElementBean element, java.util.Set<java.lang.String> excludeSettings)
Converts the given element to JSON.java.lang.String
findEntryPoint(CmsObject cms, java.lang.String openPath)
Finds the entry point to a sitemap.void
flushInheritanceGroupChanges()
Flushes inheritance group changes so the cache is updated.java.util.List<CmsDetailPageInfo>
getAllDetailPages(CmsObject cms)
Gets the complete list of beans for the currently configured detail pages.CmsADECache
getCache()
Gets the containerpage cache instance.protected org.opencms.ade.configuration.CmsConfigurationCache
getCache(boolean online)
Gets the configuration cache instance.CmsFormatterConfigurationCacheState
getCachedFormatters(boolean online)
Gets the cached formatter beans.CmsADEConfigCacheState
getCacheState(boolean online)
Gets the current ADE configuration cache state.I_CmsResourceType
getConfigurationType()
Gets the configuration file type.java.util.Set<java.lang.String>
getConfiguredWorkplaceBundles()
Returns the names of the bundles configured as workplace bundles in any module configuration.CmsContainerElementBean
getCurrentElement(javax.servlet.ServletRequest req)
Reads the current element bean from the request.CmsDetailNameCache
getDetailIdCache(boolean online)
Gets the detail id cache for the Online or Offline projects.java.util.List<CmsADEConfigData.DetailInfo>
getDetailInfo(CmsObject cms)
Gets the detail page information for everything.java.lang.String
getDetailPage(CmsObject cms, java.lang.String pageRootPath, java.lang.String originPath)
Gets the detail page for a content element.java.lang.String
getDetailPage(CmsObject cms, java.lang.String rootPath, java.lang.String linkSource, java.lang.String targetDetailPage)
Gets the detail page for a content element.I_CmsDetailPageHandler
getDetailPageHandler()
Gets the detail page finder.java.util.List<java.lang.String>
getDetailPages(CmsObject cms, java.lang.String type)
Returns the main detail pages for a type in all of the VFS tree.java.util.Set<java.lang.String>
getDetailPageTypes(CmsObject cms)
Gets the set of types for which detail pages are defined.java.util.Map<java.lang.String,CmsXmlContentProperty>
getElementSettings(CmsObject cms, CmsResource resource)
Returns the element settings for a given resource.java.util.Map<CmsUUID,CmsElementView>
getElementViews(CmsObject cms)
Returns the available element views.I_CmsResourceType
getElementViewType()
Gets the element view configuration resource type.java.util.List<CmsContainerElementBean>
getFavoriteList(CmsObject cms)
Returns the favorite list, or creates it if not available.java.util.Map<java.lang.String,CmsXmlContentProperty>
getFormatterSettings(CmsObject cms, CmsADEConfigData config, I_CmsFormatterBean mainFormatter, CmsResource res, java.util.Locale locale, javax.servlet.ServletRequest req)
Returns the settings configured for the given formatter.CmsInheritedContainerState
getInheritedContainerState(CmsObject cms, java.lang.String rootPath, java.lang.String name)
Returns the inheritance state for the given inheritance name and root path.CmsInheritedContainerState
getInheritedContainerState(CmsObject cms, CmsResource resource, java.lang.String name)
Returns the inheritance state for the given inheritance name and resource.int
getMaxSitemapDepth()
Gets the maximum sitemap depth.I_CmsResourceType
getModuleConfigurationType()
Gets the module configuration resource type.java.util.List<I_CmsFormatterBean>
getNestedFormatters(CmsObject cms, CmsADEConfigData config, CmsResource res, java.util.Locale locale, javax.servlet.ServletRequest req)
Returns the nested formatters of the given resource.protected org.opencms.ade.configuration.CmsConfigurationCache
getOfflineCache()
Gets the offline cache.protected org.opencms.ade.configuration.CmsConfigurationCache
getOnlineCache()
Gets the online cache.java.util.Map<java.lang.String,java.lang.String>
getParameters(CmsObject cms)
Gets ADE parameters.java.lang.String
getParentFolderType(boolean online, java.lang.String rootPath)
Gets the content element type for the given path's parent folder.CmsPermissionInfo
getPermissionInfo(CmsObject cms, CmsResource resource, java.lang.String contextPath)
Returns the permission info for the given resource.java.util.Map<java.lang.String,java.util.List<CmsTemplatePluginWrapper>>
getPluginsForPath(CmsObject cms, java.lang.String path)
Gets a map of plugin wrappers for the given site path.java.util.List<CmsDetailPageInfo>
getRawDetailPages(CmsObject cms)
Gets the raw configured detail page information, with no existence checks or path correction.java.util.List<CmsContainerElementBean>
getRecentList(CmsObject cms)
Returns the favorite list, or creates it if not available.protected CmsRole
getRoleForSitemapConfigEditing()
Gets the role necessary to edit sitemap configuration files.protected java.lang.String
getRootPath(CmsUUID structureId, boolean online)
Gets the root path for a given resource structure id.I_CmsResourceType
getSitemapConfigurationType()
Gets the sitemap configuration resource type.java.util.List<java.lang.String>
getSubSitePaths(CmsObject cms, java.lang.String subSiteRoot)
Returns all sub sites below the given path.java.lang.String
getSubSiteRoot(CmsObject cms, java.lang.String rootPath)
Tries to get the subsite root for a given resource root path.java.util.List<java.lang.String>
getSubsitesForSiteSelector(boolean online)
Gets the subsites to be displayed in the site selector.protected CmsProject
getTempfileProject(CmsObject cms)
Gets a tempfile project, creating one if it doesn't exist already.CmsUploadWarningTable
getUploadWarningTable()
Gets the table of upload warnings.void
handleHtmlRedirect(CmsObject userCms, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String htmlRedirect)
Processes a HTML redirect content.void
initialize()
Initializes the configuration by reading all configuration files and caching their data.protected CmsADEConfigData
internalLookupConfiguration(CmsObject cms, java.lang.String rootPath)
Internal configuration lookup method.boolean
isDetailPage(CmsObject cms, CmsResource resource)
Checks whether the given resource is configured as a detail page.boolean
isEditorRestricted(CmsObject cms, CmsResource res)
Checks if the user should be prevented from editing a file.boolean
isInitialized()
Checks whether the ADE manager is initialized (this should usually be the case except during the setup).boolean
isShowEditorHelp(CmsObject cms)
Returns the show editor help flag.CmsADEConfigData
lookupConfiguration(CmsObject cms, java.lang.String rootPath)
Looks up the configuration data for a given sitemap path.CmsADEConfigData
lookupConfigurationWithCache(CmsObject cms, java.lang.String rootPath)
Looks up the configuration data for a given sitemap path, but uses a thread-local cache for the current request for efficiency.void
refresh()
Reloads the configuration.boolean
saveDetailPages(CmsObject cms, java.lang.String rootPath, java.util.List<CmsDetailPageInfo> detailPages, CmsUUID newId)
Saves a list of detail pages.void
saveFavoriteList(CmsObject cms, java.util.List<CmsContainerElementBean> favoriteList)
Saves the favorite list, user based.void
saveInheritedContainer(CmsObject cms, java.lang.String sitePath, java.lang.String name, boolean newOrder, java.util.List<CmsContainerElementBean> elements)
Saves the inheritance container information.void
saveInheritedContainer(CmsObject cms, CmsResource pageResource, java.lang.String name, boolean newOrder, java.util.List<CmsContainerElementBean> elements)
Saves the inheritance container information.void
saveRecentList(CmsObject cms, java.util.List<CmsContainerElementBean> recentList)
Saves the favorite list, user based.void
setShowEditorHelp(CmsObject cms, boolean showHelp)
Sets the show editor help flag.void
shutdown()
The method which is called when the OpenCms instance is shut down.void
waitForCacheUpdate(boolean online)
Waits until the next time the cache is updated.void
waitForFormatterCache(boolean online)
Waits until the formatter cache has finished updating itself.
-
-
-
Field Detail
-
CLIENT_ID_SEPERATOR
public static final java.lang.String CLIENT_ID_SEPERATOR
The client id separator.- See Also:
- Constant Field Values
-
CONFIG_FILE_NAME
public static final java.lang.String CONFIG_FILE_NAME
The configuration file name.- See Also:
- Constant Field Values
-
CONFIG_FOLDER_TYPE
public static final java.lang.String CONFIG_FOLDER_TYPE
The name of the sitemap configuration file type.- See Also:
- Constant Field Values
-
CONFIG_SUFFIX
public static final java.lang.String CONFIG_SUFFIX
The path for sitemap configuration files relative from the base path.- See Also:
- Constant Field Values
-
CONFIG_TYPE
public static final java.lang.String CONFIG_TYPE
The name of the sitemap configuration file type.- See Also:
- Constant Field Values
-
CONTENT_FOLDER_NAME
public static final java.lang.String CONTENT_FOLDER_NAME
The content folder name.- See Also:
- Constant Field Values
-
DEFAULT_DETAILPAGE_TYPE
public static final java.lang.String DEFAULT_DETAILPAGE_TYPE
The default detail page type name.- See Also:
- Constant Field Values
-
DEFAULT_ELEMENT_LIST_SIZE
public static final int DEFAULT_ELEMENT_LIST_SIZE
Default favorite/recent list size constant.- See Also:
- Constant Field Values
-
ELEMENT_VIEW_TYPE
public static final java.lang.String ELEMENT_VIEW_TYPE
The name of the element view configuration file type.- See Also:
- Constant Field Values
-
MODULE_CONFIG_TYPE
public static final java.lang.String MODULE_CONFIG_TYPE
The name of the module configuration file type.- See Also:
- Constant Field Values
-
MODULE_NAME_ADE_CONFIG
public static final java.lang.String MODULE_NAME_ADE_CONFIG
The aADE configuration module name.- See Also:
- Constant Field Values
-
N_LINK
public static final java.lang.String N_LINK
Node name for the nav level link value.- See Also:
- Constant Field Values
-
N_TYPE
public static final java.lang.String N_TYPE
Node name for the nav level type value.- See Also:
- Constant Field Values
-
PATH_SITEMAP_EDITOR_JSP
public static final java.lang.String PATH_SITEMAP_EDITOR_JSP
The path to the sitemap editor JSP.- See Also:
- Constant Field Values
-
ADDINFO_ADE_FAVORITE_LIST
protected static final java.lang.String ADDINFO_ADE_FAVORITE_LIST
User additional info key constant.- See Also:
- Constant Field Values
-
ADDINFO_ADE_RECENT_LIST
protected static final java.lang.String ADDINFO_ADE_RECENT_LIST
User additional info key constant.- See Also:
- Constant Field Values
-
ADDINFO_ADE_SHOW_EDITOR_HELP
protected static final java.lang.String ADDINFO_ADE_SHOW_EDITOR_HELP
User additional info key constant.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsADEManager
public CmsADEManager(CmsObject adminCms, CmsMemoryMonitor memoryMonitor, CmsSystemConfiguration systemConfiguration)
Creates a new ADE manager.- Parameters:
adminCms
- a CMS context with admin privilegesmemoryMonitor
- the memory monitor instancesystemConfiguration
- the system configuration
-
-
Method Detail
-
addFormatterCacheWaitHandle
public CmsWaitHandle addFormatterCacheWaitHandle(boolean online)
Adds a wait handle for the next cache update to a formatter configuration.- Parameters:
online
- true if we want to add a wait handle to the online cache, else the offline cache- Returns:
- the wait handle that has been added
-
canEditSitemapConfiguration
public boolean canEditSitemapConfiguration(CmsObject cms)
Checks if the sitemap config can be edited by the user in the given CMS context.Note: Even if this returns true, there may be other reasons preventing the sitemap configuration from being edited by the user.
- Parameters:
cms
- the CMS context to check- Returns:
- false if the user should not be able to edit the sitemap configuration
-
findEntryPoint
public java.lang.String findEntryPoint(CmsObject cms, java.lang.String openPath)
Finds the entry point to a sitemap.- Parameters:
cms
- the CMS contextopenPath
- the resource path to find the sitemap to- Returns:
- the sitemap entry point
-
flushInheritanceGroupChanges
public void flushInheritanceGroupChanges()
Flushes inheritance group changes so the cache is updated.This is useful for test cases.
-
getAllDetailPages
public java.util.List<CmsDetailPageInfo> getAllDetailPages(CmsObject cms)
Gets the complete list of beans for the currently configured detail pages.- Parameters:
cms
- the CMS context to use- Returns:
- the list of detail page infos
-
getCache
public CmsADECache getCache()
Gets the containerpage cache instance.- Returns:
- the containerpage cache instance
-
getCachedFormatters
public CmsFormatterConfigurationCacheState getCachedFormatters(boolean online)
Gets the cached formatter beans.- Parameters:
online
- true if the Online project formatters should be returned, false for the Offline formatters- Returns:
- the formatter configuration cache state
-
getCacheState
public CmsADEConfigCacheState getCacheState(boolean online)
Gets the current ADE configuration cache state.- Parameters:
online
- true if you want the online state, false for the offline state- Returns:
- the configuration cache state
-
getConfigurationType
public I_CmsResourceType getConfigurationType()
Gets the configuration file type.- Returns:
- the configuration file type
-
getConfiguredWorkplaceBundles
public java.util.Set<java.lang.String> getConfiguredWorkplaceBundles()
Returns the names of the bundles configured as workplace bundles in any module configuration.- Returns:
- the names of the bundles configured as workplace bundles in any module configuration.
-
getCurrentElement
public CmsContainerElementBean getCurrentElement(javax.servlet.ServletRequest req) throws CmsException
Reads the current element bean from the request.- Parameters:
req
- the servlet request- Returns:
- the element bean
- Throws:
CmsException
- if no current element is set
-
getDetailIdCache
public CmsDetailNameCache getDetailIdCache(boolean online)
Gets the detail id cache for the Online or Offline projects.- Parameters:
online
- if true, gets the Online project detail id- Returns:
- the detail name cache
-
getDetailInfo
public java.util.List<CmsADEConfigData.DetailInfo> getDetailInfo(CmsObject cms)
Gets the detail page information for everything.- Parameters:
cms
- the current CMS context- Returns:
- the list with all the detail page information
-
getDetailPage
public java.lang.String getDetailPage(CmsObject cms, java.lang.String pageRootPath, java.lang.String originPath)
Gets the detail page for a content element.- Parameters:
cms
- the CMS contextpageRootPath
- the element's root pathoriginPath
- the path in which the the detail page is being requested- Returns:
- the detail page for the content element
-
getDetailPage
public java.lang.String getDetailPage(CmsObject cms, java.lang.String rootPath, java.lang.String linkSource, java.lang.String targetDetailPage)
Gets the detail page for a content element.- Parameters:
cms
- the CMS contextrootPath
- the element's root pathlinkSource
- the path in which the the detail page is being requestedtargetDetailPage
- the target detail page to use- Returns:
- the detail page for the content element
-
getDetailPageHandler
public I_CmsDetailPageHandler getDetailPageHandler()
Gets the detail page finder.- Returns:
- the detail page finder
-
getDetailPages
public java.util.List<java.lang.String> getDetailPages(CmsObject cms, java.lang.String type)
Returns the main detail pages for a type in all of the VFS tree.- Parameters:
cms
- the current CMS contexttype
- the resource type name- Returns:
- a list of detail page root paths
-
getDetailPageTypes
public java.util.Set<java.lang.String> getDetailPageTypes(CmsObject cms)
Gets the set of types for which detail pages are defined.- Parameters:
cms
- the current CMS context- Returns:
- the set of types for which detail pages are defined
-
getElementSettings
public java.util.Map<java.lang.String,CmsXmlContentProperty> getElementSettings(CmsObject cms, CmsResource resource) throws CmsException
Returns the element settings for a given resource.- Parameters:
cms
- the current cms contextresource
- the resource- Returns:
- the element settings for a given resource
- Throws:
CmsException
- if something goes wrong
-
getElementViews
public java.util.Map<CmsUUID,CmsElementView> getElementViews(CmsObject cms)
Returns the available element views.- Parameters:
cms
- the cms context- Returns:
- the element views
-
getElementViewType
public I_CmsResourceType getElementViewType()
Gets the element view configuration resource type.- Returns:
- the element view configuration resource type
-
getFavoriteList
public java.util.List<CmsContainerElementBean> getFavoriteList(CmsObject cms) throws CmsException
Returns the favorite list, or creates it if not available.- Parameters:
cms
- the cms context- Returns:
- the favorite list
- Throws:
CmsException
- if something goes wrong
-
getFormatterSettings
public java.util.Map<java.lang.String,CmsXmlContentProperty> getFormatterSettings(CmsObject cms, CmsADEConfigData config, I_CmsFormatterBean mainFormatter, CmsResource res, java.util.Locale locale, javax.servlet.ServletRequest req)
Returns the settings configured for the given formatter.- Parameters:
cms
- the cms contextconfig
- the sitemap configurationmainFormatter
- the formatterres
- the element resourcelocale
- the content localereq
- the current request, if available- Returns:
- the settings configured for the given formatter
-
getInheritedContainerState
public CmsInheritedContainerState getInheritedContainerState(CmsObject cms, CmsResource resource, java.lang.String name)
Returns the inheritance state for the given inheritance name and resource.- Parameters:
cms
- the current cms contextresource
- the resourcename
- the inheritance name- Returns:
- the inheritance state
-
getInheritedContainerState
public CmsInheritedContainerState getInheritedContainerState(CmsObject cms, java.lang.String rootPath, java.lang.String name) throws CmsException
Returns the inheritance state for the given inheritance name and root path.- Parameters:
cms
- the current cms contextrootPath
- the root pathname
- the inheritance name- Returns:
- the inheritance state
- Throws:
CmsException
- if something goes wrong
-
getMaxSitemapDepth
public int getMaxSitemapDepth()
Gets the maximum sitemap depth.- Returns:
- the maximum sitemap depth
-
getModuleConfigurationType
public I_CmsResourceType getModuleConfigurationType()
Gets the module configuration resource type.- Returns:
- the module configuration resource type
-
getNestedFormatters
public java.util.List<I_CmsFormatterBean> getNestedFormatters(CmsObject cms, CmsADEConfigData config, CmsResource res, java.util.Locale locale, javax.servlet.ServletRequest req)
Returns the nested formatters of the given resource.- Parameters:
cms
- the cms contextconfig
- the sitemap configurationres
- the resourcelocale
- the content localereq
- the request, if available- Returns:
- the nested formatters
-
getParameters
public java.util.Map<java.lang.String,java.lang.String> getParameters(CmsObject cms)
Gets ADE parameters.- Parameters:
cms
- the current CMS context- Returns:
- the ADE parameters for the current user
-
getParentFolderType
public java.lang.String getParentFolderType(boolean online, java.lang.String rootPath)
Gets the content element type for the given path's parent folder.- Parameters:
online
- true if we want to use the Online project's configurationrootPath
- the root path of a content- Returns:
- the parent folder type name, or null if none is defined
-
getPermissionInfo
public CmsPermissionInfo getPermissionInfo(CmsObject cms, CmsResource resource, java.lang.String contextPath) throws CmsException
Returns the permission info for the given resource.- Parameters:
cms
- the cms contextresource
- the resourcecontextPath
- the context path- Returns:
- the permission info
- Throws:
CmsException
- if checking the permissions fails
-
getPluginsForPath
public java.util.Map<java.lang.String,java.util.List<CmsTemplatePluginWrapper>> getPluginsForPath(CmsObject cms, java.lang.String path)
Gets a map of plugin wrappers for the given site path.This *only* includes plugins defined in site plugins active on the given path, not those referenced in formatters.
- Parameters:
cms
- the CMS contextpath
- the path for which to get the plugins- Returns:
- the map of plugin wrappers, with the plugin groups as keys
-
getRawDetailPages
public java.util.List<CmsDetailPageInfo> getRawDetailPages(CmsObject cms)
Gets the raw configured detail page information, with no existence checks or path correction.- Parameters:
cms
- the CMS context- Returns:
- the list of raw detail page info beans
-
getRecentList
public java.util.List<CmsContainerElementBean> getRecentList(CmsObject cms) throws CmsException
Returns the favorite list, or creates it if not available.- Parameters:
cms
- the cms context- Returns:
- the favorite list
- Throws:
CmsException
- if something goes wrong
-
getSitemapConfigurationType
public I_CmsResourceType getSitemapConfigurationType()
Gets the sitemap configuration resource type.- Returns:
- the resource type for sitemap configurations
-
getSubSitePaths
public java.util.List<java.lang.String> getSubSitePaths(CmsObject cms, java.lang.String subSiteRoot)
Returns all sub sites below the given path.- Parameters:
cms
- the cms contextsubSiteRoot
- the sub site root path- Returns:
- the sub site root paths
-
getSubSiteRoot
public java.lang.String getSubSiteRoot(CmsObject cms, java.lang.String rootPath)
Tries to get the subsite root for a given resource root path.- Parameters:
cms
- the current CMS contextrootPath
- the root path for which the subsite root should be found- Returns:
- the subsite root
-
getSubsitesForSiteSelector
public java.util.List<java.lang.String> getSubsitesForSiteSelector(boolean online)
Gets the subsites to be displayed in the site selector.- Parameters:
online
- true if we want the subsites for the Online project- Returns:
- the subsites to be displayed in the site selector
-
getUploadWarningTable
public CmsUploadWarningTable getUploadWarningTable()
Gets the table of upload warnings.- Returns:
- the table of upload warnings
-
handleHtmlRedirect
public void handleHtmlRedirect(CmsObject userCms, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String htmlRedirect) throws CmsException
Processes a HTML redirect content.This needs to be in the ADE manager because the user for whom the HTML redirect is being loaded does not necessarily have read permissions for the redirect target, so we read the redirect target with admin privileges.
- Parameters:
userCms
- the CMS context of the current userrequest
- the servlet requestresponse
- the servlet responsehtmlRedirect
- the path of the HTML redirect resource- Throws:
CmsException
- if something goes wrong
-
initialize
public void initialize()
Initializes the configuration by reading all configuration files and caching their data.
-
isDetailPage
public boolean isDetailPage(CmsObject cms, CmsResource resource)
Checks whether the given resource is configured as a detail page.- Parameters:
cms
- the current CMS contextresource
- the resource which should be tested- Returns:
- true if the resource is configured as a detail page
-
isEditorRestricted
public boolean isEditorRestricted(CmsObject cms, CmsResource res)
Checks if the user should be prevented from editing a file.This is not a permission check, but an additional mechanism to prevent users from editing configuration files even if they technically need or have write permissions for these files.
- Parameters:
cms
- the CMS contextres
- the resource to check- Returns:
- true if the user should be prevented from editing the file
-
isInitialized
public boolean isInitialized()
Checks whether the ADE manager is initialized (this should usually be the case except during the setup).- Returns:
- true if the ADE manager is initialized
-
isShowEditorHelp
public boolean isShowEditorHelp(CmsObject cms)
Returns the show editor help flag.- Parameters:
cms
- the cms context- Returns:
- the show editor help flag
-
lookupConfiguration
public CmsADEConfigData lookupConfiguration(CmsObject cms, java.lang.String rootPath)
Looks up the configuration data for a given sitemap path.- Parameters:
cms
- the current CMS contextrootPath
- the root path for which the configuration data should be looked up- Returns:
- the configuration data
-
lookupConfigurationWithCache
public CmsADEConfigData lookupConfigurationWithCache(CmsObject cms, java.lang.String rootPath)
Looks up the configuration data for a given sitemap path, but uses a thread-local cache for the current request for efficiency.- Parameters:
cms
- the current CMS contextrootPath
- the root path for which the configuration data should be looked up- Returns:
- the configuration data
-
refresh
public void refresh()
Reloads the configuration.Normally you shouldn't call this directly since the event handlers take care of updating the configuration.
-
saveDetailPages
public boolean saveDetailPages(CmsObject cms, java.lang.String rootPath, java.util.List<CmsDetailPageInfo> detailPages, CmsUUID newId) throws CmsException
Saves a list of detail pages.- Parameters:
cms
- the cms contextrootPath
- the root pathdetailPages
- the detail pagesnewId
- the id to use for new detail pages without an id- Returns:
- true if the detail pages could be successfully saved
- Throws:
CmsException
- if something goes wrong
-
saveFavoriteList
public void saveFavoriteList(CmsObject cms, java.util.List<CmsContainerElementBean> favoriteList) throws CmsException
Saves the favorite list, user based.- Parameters:
cms
- the cms contextfavoriteList
- the element list- Throws:
CmsException
- if something goes wrong
-
saveInheritedContainer
public void saveInheritedContainer(CmsObject cms, CmsResource pageResource, java.lang.String name, boolean newOrder, java.util.List<CmsContainerElementBean> elements) throws CmsException
Saves the inheritance container information.- Parameters:
cms
- the current cms contextpageResource
- the resource or parent foldername
- the inheritance namenewOrder
- if the element have been reorderedelements
- the elements- Throws:
CmsException
- if something goes wrong
-
saveInheritedContainer
public void saveInheritedContainer(CmsObject cms, java.lang.String sitePath, java.lang.String name, boolean newOrder, java.util.List<CmsContainerElementBean> elements) throws CmsException
Saves the inheritance container information.- Parameters:
cms
- the current cms contextsitePath
- the site path of the resource or parent foldername
- the inheritance namenewOrder
- if the element have been reorderedelements
- the elements- Throws:
CmsException
- if something goes wrong
-
saveRecentList
public void saveRecentList(CmsObject cms, java.util.List<CmsContainerElementBean> recentList) throws CmsException
Saves the favorite list, user based.- Parameters:
cms
- the cms contextrecentList
- the element list- Throws:
CmsException
- if something goes wrong
-
setShowEditorHelp
public void setShowEditorHelp(CmsObject cms, boolean showHelp) throws CmsException
Sets the show editor help flag.- Parameters:
cms
- the cms contextshowHelp
- the show help flag- Throws:
CmsException
- if writing the user info fails
-
shutdown
public void shutdown()
The method which is called when the OpenCms instance is shut down.
-
waitForCacheUpdate
public void waitForCacheUpdate(boolean online)
Waits until the next time the cache is updated.- Parameters:
online
- true if we want to wait for the online cache, false for the offline cache
-
waitForFormatterCache
public void waitForFormatterCache(boolean online)
Waits until the formatter cache has finished updating itself.This method is only intended for use in test cases.
- Parameters:
online
- true if we should wait for the online formatter cache,false for the offline cache
-
elementFromJson
protected CmsContainerElementBean elementFromJson(JSONObject data) throws JSONException
Creates an element from its serialized data.- Parameters:
data
- the serialized data- Returns:
- the restored element bean
- Throws:
JSONException
- if the serialized data got corrupted
-
elementToJson
protected JSONObject elementToJson(CmsContainerElementBean element, java.util.Set<java.lang.String> excludeSettings)
Converts the given element to JSON.- Parameters:
element
- the element to convertexcludeSettings
- the keys of settings which should not be written to the JSON- Returns:
- the JSON representation
-
getCache
protected org.opencms.ade.configuration.CmsConfigurationCache getCache(boolean online)
Gets the configuration cache instance.- Parameters:
online
- true if you want the online cache, false for the offline cache- Returns:
- the ADE configuration cache instance
-
getOfflineCache
protected org.opencms.ade.configuration.CmsConfigurationCache getOfflineCache()
Gets the offline cache.- Returns:
- the offline configuration cache
-
getOnlineCache
protected org.opencms.ade.configuration.CmsConfigurationCache getOnlineCache()
Gets the online cache.- Returns:
- the online configuration cache
-
getRoleForSitemapConfigEditing
protected CmsRole getRoleForSitemapConfigEditing()
Gets the role necessary to edit sitemap configuration files.- Returns:
- the role needed for editing sitemap configurations
-
getRootPath
protected java.lang.String getRootPath(CmsUUID structureId, boolean online) throws CmsException
Gets the root path for a given resource structure id.- Parameters:
structureId
- the structure idonline
- if true, the resource will be looked up in the online project ,else in the offline project- Returns:
- the root path for the given structure id
- Throws:
CmsException
- if something goes wrong
-
getTempfileProject
protected CmsProject getTempfileProject(CmsObject cms) throws CmsException
Gets a tempfile project, creating one if it doesn't exist already.- Parameters:
cms
- the CMS context to use- Returns:
- the tempfile project
- Throws:
CmsException
- if something goes wrong
-
internalLookupConfiguration
protected CmsADEConfigData internalLookupConfiguration(CmsObject cms, java.lang.String rootPath)
Internal configuration lookup method.- Parameters:
cms
- the cms contextrootPath
- the root path for which to look up the configuration- Returns:
- the configuration for the given path
-
-