Package org.opencms.xml.containerpage
Class CmsADESessionCache
- java.lang.Object
-
- org.opencms.xml.containerpage.CmsADESessionCache
-
public final class CmsADESessionCache extends java.lang.Object
ADE's session cache.- Since:
- 8.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CmsADESessionCache.LastPageBean
Stores information about the container page which was last edited, so we can jump back to it later.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
SESSION_ATTR_ADE_CACHE
Session attribute name constant.
-
Constructor Summary
Constructors Modifier Constructor Description protected
CmsADESessionCache(CmsObject cms, javax.servlet.http.HttpServletRequest request)
Initializes the session cache.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRecentFormatter(java.lang.String resType, java.lang.String keyOrId)
Adds the formatter id to the recently used list for the given type.void
clearDynamicValues()
Clear the cache values that are dynamically loaded in the Acacia content editor.void
clearLastPage()
Removes the information about the last edited container page.static CmsADESessionCache
getCache(javax.servlet.http.HttpServletRequest request, CmsObject cms)
Gets the session cache for the current session.CmsContainerElementBean
getCacheContainerElement(java.lang.String key)
Returns the cached container element under the given key.CmsXmlContent
getCacheXmlContent(CmsUUID structureId)
Returns the cached XML content document.java.lang.String
getDynamicValue(java.lang.String attribute)
Get cached value that is dynamically loaded by the Acacia content editor.CmsUUID
getElementView()
Returns the current element view id.CmsADESessionCache.LastPageBean
getLastPage()
Returns the lastPage.CmsGallerySearchBean
getLastPageEditorGallerySearch()
Returns the lastPageEditorGallerySearch.I_CmsFormatterBean
getRecentFormatter(java.lang.String resType, CmsContainer container, CmsADEConfigData config)
Returns the least recently used matching formatter for the given resource type.CmsSitemapData.EditorMode
getSitemapEditorMode()
Returns the sitemap editor mode.CmsJspStandardContextBean.TemplateBean
getTemplateBean(java.lang.String uri, boolean safe)
Gets the cached template bean for a given container page uri.boolean
isEditSmallElements()
Returns true if, in this session, a newly opened container page editor window should display edit points for small elements initially.boolean
isToolbarVisible()
Returns the tool-bar visibility.void
setCacheContainerElement(java.lang.String key, CmsContainerElementBean containerElement)
Caches the given container element under the given key.void
setCacheXmlContent(CmsUUID structureId, CmsXmlContent xmlContent)
Caches the given XML content document.void
setDynamicValue(java.lang.String attribute, java.lang.String value)
Set cached value for the attribute.void
setEditSmallElements(boolean editSmallElements)
Sets the default initial setting for small element editability in this session.void
setElementView(CmsUUID elementView)
Sets the current element view id.void
setLastPage(CmsObject cms, CmsUUID pageId, CmsUUID detailId)
Stores information about the last edited container page.void
setLastPageEditorGallerySearch(CmsGallerySearchBean searchObj)
Sets the last stored gallery search from the page editor.void
setSitemapEditorMode(CmsSitemapData.EditorMode sitemapEditorMode)
Sets the sitemap editor mode.void
setTemplateBean(java.lang.String uri, CmsJspStandardContextBean.TemplateBean templateBean)
Caches a template bean for a given container page URI.void
setToolbarVisible(boolean toolbarVisible)
Sets the tool-bar visibility flag.void
uncacheXmlContent(CmsUUID structureId)
Purges the XML content document by the given id from the cache.
-
-
-
Field Detail
-
SESSION_ATTR_ADE_CACHE
public static final java.lang.String SESSION_ATTR_ADE_CACHE
Session attribute name constant.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsADESessionCache
protected CmsADESessionCache(CmsObject cms, javax.servlet.http.HttpServletRequest request)
Initializes the session cache.- Parameters:
cms
- the cms contextrequest
- the current request
-
-
Method Detail
-
getCache
public static CmsADESessionCache getCache(javax.servlet.http.HttpServletRequest request, CmsObject cms)
Gets the session cache for the current session.In case the request is not editable,
null
will be returned.- Parameters:
request
- the current requestcms
- the current CMS context- Returns:
- the ADE session cache for the current session
-
addRecentFormatter
public void addRecentFormatter(java.lang.String resType, java.lang.String keyOrId)
Adds the formatter id to the recently used list for the given type.- Parameters:
resType
- the resource typekeyOrId
- the formatter id
-
clearDynamicValues
public void clearDynamicValues()
Clear the cache values that are dynamically loaded in the Acacia content editor.
-
clearLastPage
public void clearLastPage()
Removes the information about the last edited container page.
-
getCacheContainerElement
public CmsContainerElementBean getCacheContainerElement(java.lang.String key)
Returns the cached container element under the given key.- Parameters:
key
- the cache key- Returns:
- the cached container element or
null
if not found
-
getCacheXmlContent
public CmsXmlContent getCacheXmlContent(CmsUUID structureId)
Returns the cached XML content document.- Parameters:
structureId
- the structure id- Returns:
- the XML document
-
getDynamicValue
public java.lang.String getDynamicValue(java.lang.String attribute)
Get cached value that is dynamically loaded by the Acacia content editor.- Parameters:
attribute
- the attribute to load the value to- Returns:
- the cached value
-
getElementView
public CmsUUID getElementView()
Returns the current element view id.- Returns:
- the current element view id
-
getLastPage
public CmsADESessionCache.LastPageBean getLastPage()
Returns the lastPage.- Returns:
- the lastPage
-
getLastPageEditorGallerySearch
public CmsGallerySearchBean getLastPageEditorGallerySearch()
Returns the lastPageEditorGallerySearch.- Returns:
- the lastPageEditorGallerySearch
-
getRecentFormatter
public I_CmsFormatterBean getRecentFormatter(java.lang.String resType, CmsContainer container, CmsADEConfigData config)
Returns the least recently used matching formatter for the given resource type.- Parameters:
resType
- the resource typecontainer
- the container to matchconfig
- the config data- Returns:
- the formatter if any
-
getSitemapEditorMode
public CmsSitemapData.EditorMode getSitemapEditorMode()
Returns the sitemap editor mode.- Returns:
- the sitemap editor mode
-
getTemplateBean
public CmsJspStandardContextBean.TemplateBean getTemplateBean(java.lang.String uri, boolean safe)
Gets the cached template bean for a given container page uri.- Parameters:
uri
- the container page urisafe
- if true, return a valid template bean even if it hasn't been cached before- Returns:
- the template bean
-
isEditSmallElements
public boolean isEditSmallElements()
Returns true if, in this session, a newly opened container page editor window should display edit points for small elements initially.- Returns:
- true if small elements should be editable initially
-
isToolbarVisible
public boolean isToolbarVisible()
Returns the tool-bar visibility.- Returns:
- the tool-bar visibility
-
setCacheContainerElement
public void setCacheContainerElement(java.lang.String key, CmsContainerElementBean containerElement)
Caches the given container element under the given key.- Parameters:
key
- the cache keycontainerElement
- the object to cache
-
setCacheXmlContent
public void setCacheXmlContent(CmsUUID structureId, CmsXmlContent xmlContent)
Caches the given XML content document.- Parameters:
structureId
- the structure idxmlContent
- the XML document
-
setDynamicValue
public void setDynamicValue(java.lang.String attribute, java.lang.String value)
Set cached value for the attribute. Used for dynamically loaded values in the Acacia content editor.- Parameters:
attribute
- the attribute for which the value should be cachedvalue
- the value to cache
-
setEditSmallElements
public void setEditSmallElements(boolean editSmallElements)
Sets the default initial setting for small element editability in this session.- Parameters:
editSmallElements
- true if small elements should be initially editable
-
setElementView
public void setElementView(CmsUUID elementView)
Sets the current element view id.- Parameters:
elementView
- the current element view id
-
setLastPage
public void setLastPage(CmsObject cms, CmsUUID pageId, CmsUUID detailId)
Stores information about the last edited container page.- Parameters:
cms
- the CMS contextpageId
- the page iddetailId
- the detail content id
-
setLastPageEditorGallerySearch
public void setLastPageEditorGallerySearch(CmsGallerySearchBean searchObj)
Sets the last stored gallery search from the page editor.- Parameters:
searchObj
- the search to store
-
setSitemapEditorMode
public void setSitemapEditorMode(CmsSitemapData.EditorMode sitemapEditorMode)
Sets the sitemap editor mode.- Parameters:
sitemapEditorMode
- the sitemap editor mode
-
setTemplateBean
public void setTemplateBean(java.lang.String uri, CmsJspStandardContextBean.TemplateBean templateBean)
Caches a template bean for a given container page URI.- Parameters:
uri
- the container page uritemplateBean
- the template bean to cache
-
setToolbarVisible
public void setToolbarVisible(boolean toolbarVisible)
Sets the tool-bar visibility flag.- Parameters:
toolbarVisible
- the tool-bar visibility to set
-
uncacheXmlContent
public void uncacheXmlContent(CmsUUID structureId)
Purges the XML content document by the given id from the cache.- Parameters:
structureId
- the structure id
-
-