Package org.opencms.xml.containerpage
Class CmsContainerElementBean
java.lang.Object
org.opencms.xml.containerpage.CmsContainerElementBean
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
CmsJspStandardContextBean.CmsContainerElementWrapper
One element of a container in a container page.
- Since:
- 8.0
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor to enable wrapped elements.CmsContainerElementBean(CmsFile file, CmsUUID formatterId, Map<String, String> individualSettings, boolean inMemoryOnly, String editorHash, boolean createNew) Creates a new container page element bean.CmsContainerElementBean(CmsUUID elementId, CmsUUID formatterId, Map<String, String> individualSettings, boolean createNew) Creates a new container page element bean. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFormatterSetting(String containerName, String formatterId) Adds a formatter setting.clone()static CmsContainerElementBeancloneWithFormatter(CmsContainerElementBean source, CmsUUID formatterId) Clones the given element bean with a different formatter.static CmsContainerElementBeancloneWithSettings(CmsContainerElementBean source, Map<String, String> settings) Clones the given element bean with a different set of settings.static CmsContainerElementBeancreateElementForResourceType(CmsObject cms, I_CmsResourceType resourceType, String targetFolder, Map<String, String> individualSettings, boolean isCopyModels, Locale locale) Creates an element bean for the given resource type.Returns the ADE client editor has value.voidEnsures the element has a new element instance id.booleanReturns the structure id of the formatter of this element.getId()Returns the structure id of the resource of this element.Returns the settings of this element.Returns the inheritance info.Returns the element instance id.Returns the resource of this element.Returns the element settings including default values for settings not set.Returns the site path of the resource of this element.Returns the resource type name.inthashCode()voidinitResource(CmsObject cms) Initializes the resource and the site path of this element.voidinitSettings(CmsObject cms, CmsADEConfigData config, I_CmsFormatterBean formatterBean, Locale locale, javax.servlet.ServletRequest request, Map<String, String> presets) Initializes the element settings.booleanReturns if the given element should be used as a copy model.booleanReturns if a new element should be created replacing the given one on first edit of a container-page.booleanChecks if the element is uncacheable.booleanTests whether this element refers to a group container.booleanChecks if the element is used for displaying a historical content (usually from the history dialog).booleanReturns whether this element refers to an inherited container element.booleanReturns if the represented resource is in memory only and not persisted in the VFS.booleanReturns if the given element is a model group.booleanReturns if all instances of this element should be replaced within a copy model.booleanReturns if the element resource is released and not expired.booleanReturns if the element resource contains temporary file content.voidsetDoNotCache(boolean doNotCache) Enables / disables 'do not cache' status, which prevents the element from being cached in the session cache.voidsetFormatterId(CmsUUID formatterId) Sets the formatter id.voidsetHistoryFile(CmsFile file) Sets a historical file.voidsetInheritanceInfo(CmsInheritanceInfo inheritanceInfo) Sets the inheritance info for this element.voidsetTemporaryFile(CmsFile elementFile) Sets the element resource as a temporary file.toString()voidupdateIndividualSettings(Map<String, String> newSettings) Updates the individual settings.
-
Constructor Details
-
CmsContainerElementBean
public CmsContainerElementBean(CmsFile file, CmsUUID formatterId, Map<String, String> individualSettings, boolean inMemoryOnly, String editorHash, boolean createNew) Creates a new container page element bean.- Parameters:
file- the element's fileformatterId- the formatter's structure id, could benullindividualSettings- the element settings as a map of name/value pairsinMemoryOnly- the in memory flageditorHash- the editor hash to usecreateNew-trueif a new element should be created replacing the given one on first edit of a container-page
-
CmsContainerElementBean
public CmsContainerElementBean(CmsUUID elementId, CmsUUID formatterId, Map<String, String> individualSettings, boolean createNew) Creates a new container page element bean.- Parameters:
elementId- the element's structure idformatterId- the formatter's structure id, could benullindividualSettings- the element settings as a map of name/value pairscreateNew-trueif a new element should be created replacing the given one on first edit of a container-page
-
CmsContainerElementBean
protected CmsContainerElementBean()Constructor to enable wrapped elements.
-
-
Method Details
-
cloneWithFormatter
public static CmsContainerElementBean cloneWithFormatter(CmsContainerElementBean source, CmsUUID formatterId) Clones the given element bean with a different formatter.- Parameters:
source- the element to cloneformatterId- the new formatter id- Returns:
- the element bean
-
cloneWithSettings
public static CmsContainerElementBean cloneWithSettings(CmsContainerElementBean source, Map<String, String> settings) Clones the given element bean with a different set of settings.- Parameters:
source- the element to clonesettings- the new settings- Returns:
- the element bean
-
createElementForResourceType
public static CmsContainerElementBean createElementForResourceType(CmsObject cms, I_CmsResourceType resourceType, String targetFolder, Map<String, String> individualSettings, boolean isCopyModels, Locale locale) throws CmsExceptionCreates an element bean for the given resource type.The represented resource will be in memory only and not in the VFS!!!.
- Parameters:
cms- the CMS contextresourceType- the resource typetargetFolder- the parent folder of the resourceindividualSettings- the element settings as a map of name/value pairsisCopyModels- if this element when used in models should be copied instead of reusedlocale- the locale to use- Returns:
- the created element bean
- Throws:
CmsException- if something goes wrong creating the elementIllegalArgumentException- if the resource type not instance ofCmsResourceTypeXmlContent
-
addFormatterSetting
Adds a formatter setting.- Parameters:
containerName- the container nameformatterId- the formatter id
-
clone
-
editorHash
Returns the ADE client editor has value.- Returns:
- the ADE client editor has value
-
ensureNewInstanceId
Ensures the element has a new element instance id. -
equals
-
getFormatterId
Returns the structure id of the formatter of this element.- Returns:
- the structure id of the formatter of this element
-
getId
Returns the structure id of the resource of this element.- Returns:
- the structure id of the resource of this element
-
getIndividualSettings
Returns the settings of this element.- Returns:
- the settings of this element
-
getInheritanceInfo
Returns the inheritance info.- Returns:
- the inheritance info or
nullif not available
-
getInstanceId
Returns the element instance id.- Returns:
- the element instance id
-
getResource
Returns the resource of this element.It is required to call
initResource(CmsObject)before this method can be used.- Returns:
- the resource of this element
- See Also:
-
getSettings
Returns the element settings including default values for settings not set.Will return
nullif the element bean has not been initialized withinitResource(org.opencms.file.CmsObject).- Returns:
- the element settings
-
getSitePath
Returns the site path of the resource of this element.It is required to call
initResource(CmsObject)before this method can be used.- Returns:
- the site path of the resource of this element
- See Also:
-
getTypeName
Returns the resource type name.- Returns:
- the type name
-
hashCode
-
initResource
Initializes the resource and the site path of this element.- Parameters:
cms- the CMS context- Throws:
CmsException- if something goes wrong reading the element resource
-
initSettings
public void initSettings(CmsObject cms, CmsADEConfigData config, I_CmsFormatterBean formatterBean, Locale locale, javax.servlet.ServletRequest request, Map<String, String> presets) Initializes the element settings.- Parameters:
cms- the CMS contextformatterBean- the formatter configuration beanlocale- the content localerequest- the current request, if availablepresets- the presets for container element settings
-
isCopyModel
Returns if the given element should be used as a copy model.- Returns:
trueif the given element should be used as a copy model
-
isCreateNew
Returns if a new element should be created replacing the given one on first edit of a container-page.- Returns:
trueif a new element should be created replacing the given one on first edit of a container-page
-
isDoNotCache
Checks if the element is uncacheable.- Returns:
- true if the element is uncacheable
-
isGroupContainer
Tests whether this element refers to a group container.- Parameters:
cms- the CmsObject used for VFS operations- Returns:
trueif the container element refers to a group container- Throws:
CmsException- if something goes wrong
-
isHistoryContent
Checks if the element is used for displaying a historical content (usually from the history dialog).- Returns:
- true if the element is used for displaying a historical content
-
isInheritedContainer
Returns whether this element refers to an inherited container element.- Parameters:
cms- the CmsObject used for VFS operations- Returns:
trueif the container element refers to an inherited container- Throws:
CmsException- if something goes wrong
-
isInMemoryOnly
Returns if the represented resource is in memory only and not persisted in the VFS.- Returns:
trueif the represented resource is in memory only and not persisted in the VFS
-
isModelGroup
Returns if the given element is a model group.- Returns:
trueif the given element is a model group
-
isModelGroupAlwaysReplace
Returns if all instances of this element should be replaced within a copy model.- Returns:
trueif all instances of this element should be replaced within a copy model
-
isReleasedAndNotExpired
Returns if the element resource is released and not expired.- Returns:
trueif the element resource is released and not expired
-
isTemporaryContent
Returns if the element resource contains temporary file content.- Returns:
trueif the element resource contains temporary file content
-
setDoNotCache
Enables / disables 'do not cache' status, which prevents the element from being cached in the session cache.- Parameters:
doNotCache- the new value
-
setFormatterId
Sets the formatter id.- Parameters:
formatterId- the formatter id
-
setHistoryFile
Sets a historical file.- Parameters:
file- the historical file
-
setTemporaryFile
Sets the element resource as a temporary file.- Parameters:
elementFile- the temporary file
-
toString
-
updateIndividualSettings
Updates the individual settings.This causes all merged settings (from defaults etc.) to be lost.
- Parameters:
newSettings- the new settings
-