public class CmsADEManager
extends java.lang.Object
限定符和类型 | 类和说明 |
---|---|
protected static class |
CmsADEManager.FavListProp
JSON property name constant.
|
protected static class |
CmsADEManager.Status
A status enum for the initialization status.
|
限定符和类型 | 字段和说明 |
---|---|
protected static java.lang.String |
ADDINFO_ADE_FAVORITE_LIST
User additional info key constant.
|
static java.lang.String |
ADDINFO_ADE_FAVORITE_LIST_SIZE
User additional info key constant.
|
protected static java.lang.String |
ADDINFO_ADE_RECENT_LIST
User additional info key constant.
|
static java.lang.String |
ADDINFO_ADE_RECENT_LIST_SIZE
User additional info key constant.
|
static java.lang.String |
ADDINFO_ADE_SEARCH_PAGE_SIZE
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 int |
DEFAULT_FAVORITE_LIST_SIZE
Default favorite list size constant.
|
static int |
DEFAULT_RECENT_LIST_SIZE
Default recent list size constant.
|
static java.lang.String |
MODULE_CONFIG_TYPE
The name of the module configuration file type.
|
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.
|
构造器和说明 |
---|
CmsADEManager(CmsObject adminCms,
CmsMemoryMonitor memoryMonitor,
CmsSystemConfiguration systemConfiguration)
Creates a new ADE manager.
|
限定符和类型 | 方法和说明 |
---|---|
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.
|
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.
|
CmsFormatterConfigurationCacheState |
getCachedFormatters(boolean online)
Gets the cached formatter beans.
|
I_CmsResourceType |
getConfigurationType()
Gets the configuration file type.
|
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.lang.String |
getDetailPage(CmsObject cms,
java.lang.String pageRootPath,
java.lang.String originPath)
Gets the detail page for a content element.
|
I_CmsDetailPageFinder |
getDetailPageFinder()
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.List<CmsContainerElementBean> |
getFavoriteList(CmsObject cms)
Returns the favorite list, or creates it if not available.
|
CmsInheritedContainerState |
getInheritedContainerState(CmsObject cms,
CmsResource resource,
java.lang.String name)
Returns the inheritance state for the given inheritance name and resource.
|
CmsInheritedContainerState |
getInheritedContainerState(CmsObject cms,
java.lang.String rootPath,
java.lang.String name)
Returns the inheritance state for the given inheritance name and root path.
|
int |
getMaxSitemapDepth()
Gets the maximum sitemap depth.
|
I_CmsResourceType |
getModuleConfigurationType()
Gets the module configuration resource type.
|
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.util.List<CmsContainerElementBean> |
getRecentList(CmsObject cms)
Returns the favorite list, or creates it if not available.
|
int |
getRecentListMaxSize(CmsUser user)
Gets the maximum length of the recent list.
|
protected java.lang.String |
getRootPath(CmsUUID structureId,
boolean online)
Gets the root path for a given resource structure id.
|
java.lang.String |
getSubSiteRoot(CmsObject cms,
java.lang.String rootPath)
Tries to get the subsite root for a given resource root path.
|
protected CmsProject |
getTempfileProject(CmsObject cms)
Gets a tempfile project, creating one if it doesn't exist already.
|
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 |
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.
|
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,
CmsResource pageResource,
java.lang.String name,
boolean newOrder,
java.util.List<CmsContainerElementBean> elements)
Saves the inheritance container information.
|
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 |
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 |
waitForFormatterCache(boolean online)
Waits until the formatter cache has finished updating itself.
|
public static final java.lang.String ADDINFO_ADE_FAVORITE_LIST_SIZE
public static final java.lang.String ADDINFO_ADE_RECENT_LIST_SIZE
public static final java.lang.String ADDINFO_ADE_SEARCH_PAGE_SIZE
public static final java.lang.String CLIENT_ID_SEPERATOR
public static final java.lang.String CONFIG_FILE_NAME
public static final java.lang.String CONFIG_FOLDER_TYPE
public static final java.lang.String CONFIG_SUFFIX
public static final java.lang.String CONFIG_TYPE
public static final java.lang.String CONTENT_FOLDER_NAME
public static final int DEFAULT_FAVORITE_LIST_SIZE
public static final int DEFAULT_RECENT_LIST_SIZE
public static final java.lang.String MODULE_CONFIG_TYPE
public static final java.lang.String N_LINK
public static final java.lang.String N_TYPE
public static final java.lang.String PATH_SITEMAP_EDITOR_JSP
protected static final java.lang.String ADDINFO_ADE_FAVORITE_LIST
protected static final java.lang.String ADDINFO_ADE_RECENT_LIST
protected static final java.lang.String ADDINFO_ADE_SHOW_EDITOR_HELP
public CmsADEManager(CmsObject adminCms, CmsMemoryMonitor memoryMonitor, CmsSystemConfiguration systemConfiguration)
adminCms
- a CMS context with admin privilegesmemoryMonitor
- the memory monitor instancesystemConfiguration
- the system configurationpublic java.lang.String findEntryPoint(CmsObject cms, java.lang.String openPath)
cms
- the CMS contextopenPath
- the resource path to find the sitemap topublic java.util.List<CmsDetailPageInfo> getAllDetailPages(CmsObject cms)
cms
- the CMS context to usepublic CmsADECache getCache()
public CmsFormatterConfigurationCacheState getCachedFormatters(boolean online)
online
- true if the Online project formatters should be returned, false for the Offline formatterspublic I_CmsResourceType getConfigurationType()
public CmsContainerElementBean getCurrentElement(javax.servlet.ServletRequest req) throws CmsException
req
- the servlet requestCmsException
- if no current element is setpublic CmsDetailNameCache getDetailIdCache(boolean online)
online
- if true, gets the Online project detail idpublic java.lang.String getDetailPage(CmsObject cms, java.lang.String pageRootPath, java.lang.String originPath)
cms
- the CMS contextpageRootPath
- the element's root pathoriginPath
- the path in which the the detail page is being requestedpublic I_CmsDetailPageFinder getDetailPageFinder()
public java.util.List<java.lang.String> getDetailPages(CmsObject cms, java.lang.String type)
cms
- the current CMS contexttype
- the resource type namepublic java.util.Set<java.lang.String> getDetailPageTypes(CmsObject cms)
cms
- the current CMS contextpublic java.util.Map<java.lang.String,CmsXmlContentProperty> getElementSettings(CmsObject cms, CmsResource resource) throws CmsException
cms
- the current cms contextresource
- the resourceCmsException
- if something goes wrongpublic java.util.List<CmsContainerElementBean> getFavoriteList(CmsObject cms) throws CmsException
cms
- the cms contextCmsException
- if something goes wrongpublic CmsInheritedContainerState getInheritedContainerState(CmsObject cms, CmsResource resource, java.lang.String name)
cms
- the current cms contextresource
- the resourcename
- the inheritance namepublic CmsInheritedContainerState getInheritedContainerState(CmsObject cms, java.lang.String rootPath, java.lang.String name) throws CmsException
cms
- the current cms contextrootPath
- the root pathname
- the inheritance nameCmsException
- if something goes wrongpublic int getMaxSitemapDepth()
public I_CmsResourceType getModuleConfigurationType()
public java.util.Map<java.lang.String,java.lang.String> getParameters(CmsObject cms)
cms
- the current CMS contextpublic java.util.List<CmsContainerElementBean> getRecentList(CmsObject cms) throws CmsException
cms
- the cms contextCmsException
- if something goes wrongpublic int getRecentListMaxSize(CmsUser user)
user
- the user for which to get the maximum lengthpublic java.lang.String getSubSiteRoot(CmsObject cms, java.lang.String rootPath)
cms
- the current CMS contextrootPath
- the root path for which the subsite root should be foundpublic void handleHtmlRedirect(CmsObject userCms, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String htmlRedirect) throws java.lang.Exception
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.
userCms
- the CMS context of the current userrequest
- the servlet requestresponse
- the servlet responsehtmlRedirect
- the path of the HTML redirect resourcejava.lang.Exception
- if something goes wrongpublic void initialize()
public boolean isDetailPage(CmsObject cms, CmsResource resource)
cms
- the current CMS contextresource
- the resource which should be testedpublic boolean isInitialized()
public boolean isShowEditorHelp(CmsObject cms)
cms
- the cms contextpublic CmsADEConfigData lookupConfiguration(CmsObject cms, java.lang.String rootPath)
cms
- the current CMS contextrootPath
- the root path for which the configuration data should be looked uppublic void refresh()
Normally you shouldn't call this directly since the event handlers take care of updating the configuration.
public boolean saveDetailPages(CmsObject cms, java.lang.String rootPath, java.util.List<CmsDetailPageInfo> detailPages, CmsUUID newId) throws CmsException
cms
- the cms contextrootPath
- the root pathdetailPages
- the detail pagesnewId
- the id to use for new detail pages without an idCmsException
- if something goes wrongpublic void saveFavoriteList(CmsObject cms, java.util.List<CmsContainerElementBean> favoriteList) throws CmsException
cms
- the cms contextfavoriteList
- the element listCmsException
- if something goes wrongpublic void saveInheritedContainer(CmsObject cms, CmsResource pageResource, java.lang.String name, boolean newOrder, java.util.List<CmsContainerElementBean> elements) throws CmsException
cms
- the current cms contextpageResource
- the resource or parent foldername
- the inheritance namenewOrder
- if the element have been reorderedelements
- the elementsCmsException
- if something goes wrongpublic void saveInheritedContainer(CmsObject cms, java.lang.String sitePath, java.lang.String name, boolean newOrder, java.util.List<CmsContainerElementBean> elements) throws CmsException
cms
- the current cms contextsitePath
- the site path of the resource or parent foldername
- the inheritance namenewOrder
- if the element have been reorderedelements
- the elementsCmsException
- if something goes wrongpublic void saveRecentList(CmsObject cms, java.util.List<CmsContainerElementBean> recentList) throws CmsException
cms
- the cms contextrecentList
- the element listCmsException
- if something goes wrongpublic void setShowEditorHelp(CmsObject cms, boolean showHelp) throws CmsException
cms
- the cms contextshowHelp
- the show help flagCmsException
- if writing the user info failspublic void shutdown()
public void waitForFormatterCache(boolean online)
This method is only intended for use in test cases.
online
- true if we should wait for the online formatter cache,false for the offline cacheprotected CmsContainerElementBean elementFromJson(JSONObject data) throws JSONException
data
- the serialized dataJSONException
- if the serialized data got corruptedprotected JSONObject elementToJson(CmsContainerElementBean element, java.util.Set<java.lang.String> excludeSettings)
element
- the element to convertexcludeSettings
- the keys of settings which should not be written to the JSONprotected org.opencms.ade.configuration.CmsConfigurationCache getOfflineCache()
protected org.opencms.ade.configuration.CmsConfigurationCache getOnlineCache()
protected java.lang.String getRootPath(CmsUUID structureId, boolean online) throws CmsException
structureId
- the structure idonline
- if true, the resource will be looked up in the online project ,else in the offline projectCmsException
- if something goes wrongprotected CmsProject getTempfileProject(CmsObject cms) throws CmsException
cms
- the CMS context to useCmsException
- if something goes wrongprotected CmsADEConfigData internalLookupConfiguration(CmsObject cms, java.lang.String rootPath)
cms
- the cms contextrootPath
- the root path for which to look up the configuration