org.opencms.xml.containerpage
Class CmsContainerElementBean

java.lang.Object
  extended by org.opencms.xml.containerpage.CmsContainerElementBean

public class CmsContainerElementBean
extends java.lang.Object

One element of a container in a container page.

Since:
8.0

Constructor Summary
CmsContainerElementBean(CmsUUID elementId, CmsUUID formatterId, java.util.Map<java.lang.String,java.lang.String> individualSettings, boolean createNew)
          Creates a new container page element bean.
 
Method Summary
static CmsContainerElementBean cloneWithSettings(CmsContainerElementBean source, java.util.Map<java.lang.String,java.lang.String> settings)
          Clones the given element bean with a different set of settings.
static CmsContainerElementBean createElementForResourceType(CmsObject cms, I_CmsResourceType resourceType, java.lang.String targetFolder, java.util.Map<java.lang.String,java.lang.String> individualSettings, java.util.Locale locale)
          Creates an element bean for the given resource type.
 java.lang.String editorHash()
          Returns the ADE client editor has value.
 boolean equals(java.lang.Object obj)
           
 CmsUUID getFormatterId()
          Returns the structure id of the formatter of this element.
 CmsUUID getId()
          Returns the structure id of the resource of this element.
 java.util.Map<java.lang.String,java.lang.String> getIndividualSettings()
          Returns the settings of this element.
 CmsResource getResource()
          Returns the resource of this element.
 java.util.Map<java.lang.String,java.lang.String> getSettings()
          Returns the element settings including default values for settings not set.
 java.lang.String getSitePath()
          Returns the site path of the resource of this element.
 int hashCode()
           
 void initResource(CmsObject cms)
          Initializes the resource and the site path of this element.
 boolean isCreateNew()
          Returns if a new element should be created replacing the given one on first edit of a container-page.
 boolean isGroupContainer(CmsObject cms)
          Tests whether this element refers to a group container.
 boolean isInMemoryOnly()
          Returns if the represented resource is in memory only and not persisted in the VFS.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CmsContainerElementBean

public CmsContainerElementBean(CmsUUID elementId,
                               CmsUUID formatterId,
                               java.util.Map<java.lang.String,java.lang.String> individualSettings,
                               boolean createNew)
Creates a new container page element bean.

Parameters:
elementId - the element's structure id
formatterId - the formatter's structure id, could be null
individualSettings - the element settings as a map of name/value pairs
createNew - true if a new element should be created replacing the given one on first edit of a container-page
Method Detail

cloneWithSettings

public static CmsContainerElementBean cloneWithSettings(CmsContainerElementBean source,
                                                        java.util.Map<java.lang.String,java.lang.String> settings)
Clones the given element bean with a different set of settings.

Parameters:
source - the element to clone
settings - the new settings
Returns:
the element bean

createElementForResourceType

public static CmsContainerElementBean createElementForResourceType(CmsObject cms,
                                                                   I_CmsResourceType resourceType,
                                                                   java.lang.String targetFolder,
                                                                   java.util.Map<java.lang.String,java.lang.String> individualSettings,
                                                                   java.util.Locale locale)
                                                            throws CmsException
Creates 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 context
resourceType - the resource type
targetFolder - the parent folder of the resource
individualSettings - the element settings as a map of name/value pairs
locale - the locale to use
Returns:
the created element bean
Throws:
CmsException
java.lang.IllegalArgumentException - if the resource type not instance of CmsResourceTypeXmlContent

editorHash

public java.lang.String editorHash()
Returns the ADE client editor has value.

Returns:
the ADE client editor has value

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

getFormatterId

public CmsUUID getFormatterId()
Returns the structure id of the formatter of this element.

Returns:
the structure id of the formatter of this element

getId

public CmsUUID getId()
Returns the structure id of the resource of this element.

Returns:
the structure id of the resource of this element

getIndividualSettings

public java.util.Map<java.lang.String,java.lang.String> getIndividualSettings()
Returns the settings of this element.

Returns:
the settings of this element

getResource

public CmsResource 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:
initResource(CmsObject)

getSettings

public java.util.Map<java.lang.String,java.lang.String> getSettings()
Returns the element settings including default values for settings not set.

Will return null if the element bean has not been initialized with initResource(org.opencms.file.CmsObject).

Returns:
the element settings

getSitePath

public java.lang.String 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:
initResource(CmsObject)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

initResource

public void initResource(CmsObject cms)
                  throws CmsException
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

isCreateNew

public boolean isCreateNew()
Returns if a new element should be created replacing the given one on first edit of a container-page.

Returns:
true if a new element should be created replacing the given one on first edit of a container-page

isGroupContainer

public boolean isGroupContainer(CmsObject cms)
                         throws CmsException
Tests whether this element refers to a group container.

Parameters:
cms - the CmsObject used for VFS operations
Returns:
true if the container element refers to a group container
Throws:
CmsException - if something goes wrong

isInMemoryOnly

public boolean isInMemoryOnly()
Returns if the represented resource is in memory only and not persisted in the VFS.

Returns:
true if the represented resource is in memory only and not persisted in the VFS

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()