public class CmsJspContentAccessBean extends java.lang.Object
<cms:contentload>
tag.The implementation is optimized for performance and uses lazy initializing of the requested values as much as possible.
CmsJspTagContentAccess
Modifier and Type | Class and Description |
---|---|
class |
CmsJspContentAccessBean.CmsHasLocaleTransformer
Provides Booleans that indicate if a specified locale is available in the XML content,
the input is assumed to be a String that represents a Locale.
|
class |
CmsJspContentAccessBean.CmsHasLocaleValueTransformer
Provides Booleans that indicate if a specified path exists in the XML content,
the input is assumed to be a String that represents an xpath in the XML content.
|
class |
CmsJspContentAccessBean.CmsHasValueTransformer
Provides a Map with Booleans that indicate if a specified path exists in the XML content in the selected Locale,
the input is assumed to be a String that represents an xpath in the XML content.
|
class |
CmsJspContentAccessBean.CmsImageDndTransformer
Transformer used for the 'imageDnd' EL attribute which is used to annotate images which can be replaced by drag and drop.
|
class |
CmsJspContentAccessBean.CmsLocaleNamesTransformer
Provides a Map which lets the user access the list of element names from the selected locale in an XML content,
the input is assumed to be a String that represents a Locale.
|
class |
CmsJspContentAccessBean.CmsLocaleRdfaTransformer
Provides a Map which lets the user access the RDFA tags for all values in the selected locale in an XML content,
the input is assumed to be a String that represents a Locale.
|
class |
CmsJspContentAccessBean.CmsLocaleSubValueListTransformer
Provides a Map which lets the user access sub value Lists from the selected locale in an XML content,
the input is assumed to be a String that represents a Locale.
|
class |
CmsJspContentAccessBean.CmsLocaleValueListTransformer
Provides a Map which lets the user access value Lists from the selected locale in an XML content,
the input is assumed to be a String that represents a Locale.
|
class |
CmsJspContentAccessBean.CmsLocaleValueTransformer
Provides a Map which lets the user access a value from the selected locale in an XML content,
the input is assumed to be a String that represents a Locale.
|
class |
CmsJspContentAccessBean.CmsRdfaTransformer
Provides a Map which lets the user access the RDFA tag for a value in an XML content,
the input is assumed to be a String that represents an xpath in the XML content.
|
class |
CmsJspContentAccessBean.CmsSubValueListTransformer
Provides a Map which lets the user access sub value Lists in an XML content,
the input is assumed to be a String that represents an xpath in the XML content.
|
class |
CmsJspContentAccessBean.CmsValueListTransformer
Provides a Map which lets the user access value Lists in an XML content,
the input is assumed to be a String that represents an xpath in the XML content.
|
class |
CmsJspContentAccessBean.CmsValueTransformer
Provides a Map which lets the user access a value in an XML content,
the input is assumed to be a String that represents an xpath in the XML content.
|
Modifier and Type | Field and Description |
---|---|
protected static java.util.Map<java.lang.String,CmsJspContentAccessValueWrapper> |
CONSTANT_NULL_VALUE_WRAPPER_MAP
Constant Map that always returns the
CmsJspContentAccessValueWrapper.NULL_VALUE_WRAPPER . |
Constructor and Description |
---|
CmsJspContentAccessBean()
No argument constructor, required for a JavaBean.
|
CmsJspContentAccessBean(CmsObject cms,
CmsResource resource)
Creates a content access bean based on a Resource, using the current request context locale.
|
CmsJspContentAccessBean(CmsObject cms,
java.util.Locale locale,
CmsResource resource)
Creates a content access bean based on a Resource.
|
CmsJspContentAccessBean(CmsObject cms,
java.util.Locale locale,
I_CmsXmlDocument content)
Creates a content access bean based on an XML content object.
|
Modifier and Type | Method and Description |
---|---|
protected static java.lang.String |
createImageDndAttr(CmsUUID structureId,
java.lang.String imagePath,
java.lang.String locale)
Generates the HTML attribute "data-imagednd" that enables the ADE image drag and drop feature.
|
java.util.List<java.lang.String> |
getAttachmentLocales()
Gets the list of locales for which there are attachments.
|
CmsJspContentAttachmentsBean |
getAttachments()
Gets an attachment bean, trying to automatically find the right locale for the current page.
|
java.util.Map<?,?> |
getAttachmentsForLocale()
Gets a lazy map which maps locales to attachment beans for that locale.
|
CmsObject |
getCmsObject()
Returns the OpenCms user context this bean was initialized with.
|
CmsFile |
getFile()
Returns the raw VFS file object the content accessed by this bean was created from.
|
java.lang.String |
getFileLink()
Returns the substituted link to the content file.
|
java.lang.String |
getFilename()
Returns the site path of the current resource, that is the result of
CmsObject.getSitePath(CmsResource) with the resource
obtained by getFile() . |
java.util.Map<java.lang.String,java.lang.Boolean> |
getHasLocale()
Returns a lazy initialized Map that provides Booleans that indicate if a specified Locale is available
in the XML content.
|
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Boolean>> |
getHasLocaleValue()
Returns a lazy initialized Map that provides a Map that provides Booleans that
indicate if a value (xpath) is available in the XML content in the selected locale.
|
java.util.Map<java.lang.String,java.lang.Boolean> |
getHasValue()
Returns a lazy initialized Map that provides Booleans that
indicate if a value (xpath) is available in the XML content in the current locale.
|
CmsUUID |
getId()
Returns the structure ID of the current resource, that is the ID of
the resource obtained by
getFile() . |
java.util.Map<java.lang.String,java.lang.String> |
getImageDnd()
Gets the lazy imageDnd map.
|
boolean |
getIsEditable()
Returns
true in case the current user is allowed to edit the XML content. |
java.util.Locale |
getLocale()
Returns the Locale this bean is using for content access, this may be a default fall back Locale.
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getLocaleNames()
Returns a lazy initialized Map that provides a List with all available elements paths (Strings)
used in this document in the selected locale.
|
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> |
getLocaleRdfa()
Returns the map of RDFA maps by locale.
|
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.List<CmsJspContentAccessValueWrapper>>> |
getLocaleSubValueList()
Returns a lazy initialized Map that provides a Map that provides Lists of direct sub values
from the XML content in the selected locale.
|
java.util.Map<java.lang.String,java.util.Map<java.lang.String,CmsJspContentAccessValueWrapper>> |
getLocaleValue()
Returns a lazy initialized Map that provides a Map that provides
values from the XML content in the selected locale.
|
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.List<CmsJspContentAccessValueWrapper>>> |
getLocaleValueList()
Returns a lazy initialized Map that provides a Map that provides Lists of values
from the XML content in the selected locale.
|
java.util.List<java.lang.String> |
getNames()
Returns a list with all available elements paths (Strings) used in this document
in the current locale.
|
java.lang.String |
getPrintStructure()
Prints the XPaths of the available content values into an HTML ul list.
|
I_CmsXmlDocument |
getRawContent()
Returns the raw XML content object that is accessed by this bean.
|
java.util.Map<java.lang.String,java.lang.String> |
getRdfa()
Returns RDFA by value name map.
|
CmsJspCategoryAccessBean |
getReadCategories()
Reads and returns the categories assigned to the content's VFS resource.
|
java.util.Map<java.lang.String,java.util.List<CmsJspContentAccessValueWrapper>> |
getSubValueList()
Returns a lazy initialized Map that provides Lists of direct sub values
of the given value from the XML content in the current locale.
|
java.lang.String |
getTypeName()
Returns the resource type name.
|
java.util.Map<java.lang.String,CmsJspContentAccessValueWrapper> |
getValue()
Returns a lazy initialized Map that provides values from the XML content in the current locale.
|
java.util.Map<java.lang.String,java.util.List<CmsJspContentAccessValueWrapper>> |
getValueList()
Returns a lazy initialized Map that provides Lists of values from the XML content in the current locale.
|
CmsJspVfsAccessBean |
getVfs()
Returns an instance of a VFS access bean,
initialized with the OpenCms user context this bean was created with.
|
CmsJspResourceWrapper |
getWrap()
Returns the content file as a CmsJspObjectValueWrapper.
|
void |
init(CmsObject cms,
java.util.Locale locale,
I_CmsXmlDocument content,
CmsResource resource)
Initialize this instance.
|
protected static final java.util.Map<java.lang.String,CmsJspContentAccessValueWrapper> CONSTANT_NULL_VALUE_WRAPPER_MAP
CmsJspContentAccessValueWrapper.NULL_VALUE_WRAPPER
.public CmsJspContentAccessBean()
You must call init(CmsObject, Locale, I_CmsXmlDocument, CmsResource)
and provide the
required values when you use this constructor.
public CmsJspContentAccessBean(CmsObject cms, CmsResource resource)
cms
- the OpenCms context of the current userresource
- the resource to create the content frompublic CmsJspContentAccessBean(CmsObject cms, java.util.Locale locale, CmsResource resource)
cms
- the OpenCms context of the current userlocale
- the Locale to use when accessing the contentresource
- the resource to create the content frompublic CmsJspContentAccessBean(CmsObject cms, java.util.Locale locale, I_CmsXmlDocument content)
cms
- the OpenCms context of the current userlocale
- the Locale to use when accessing the contentcontent
- the content to accessprotected static java.lang.String createImageDndAttr(CmsUUID structureId, java.lang.String imagePath, java.lang.String locale)
structureId
- the structure ID of the XML document to insert the imagelocale
- the locale to generate the image inimagePath
- the XML path to the image source node.public java.util.List<java.lang.String> getAttachmentLocales()
public CmsJspContentAttachmentsBean getAttachments() throws CmsException
CmsException
- if something goes wrongpublic java.util.Map<?,?> getAttachmentsForLocale()
public CmsObject getCmsObject()
public CmsFile getFile()
This can be used to access information from the raw file on a JSP.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> Root path of the resource: ${content.file.rootPath} </cms:contentload>
public java.lang.String getFileLink()
Use for detail page links.
public java.lang.String getFilename()
CmsObject.getSitePath(CmsResource)
with the resource
obtained by getFile()
.Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> Site path of the resource: "${content.filename}"; </cms:contentload>
CmsObject.getSitePath(CmsResource)
public java.util.Map<java.lang.String,java.lang.Boolean> getHasLocale()
The provided Map key is assumed to be a String that represents a Locale.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:if test="${content.hasLocale['de']}" > The content has a "de" Locale! </c:if> </cms:contentload>
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Boolean>> getHasLocaleValue()
The first provided Map key is assumed to be a String that represents the Locale, the second provided Map key is assumed to be a String that represents the xpath to the value.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:if test="${content.hasLocaleValue['de']['Title']}" > The content has a "Title" value in the "de" Locale! </c:if> </cms:contentload>Please note that you can also test if a locale value exists like this:
<c:if test="${content.value['de']['Title'].exists}" > ... </c:if>
getHasValue()
public java.util.Map<java.lang.String,java.lang.Boolean> getHasValue()
The provided Map key is assumed to be a String that represents the xpath to the value.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:if test="${content.hasValue['Title']}" > The content has a "Title" value in the current locale! </c:if> </cms:contentload>Please note that you can also test if a value exists like this:
<c:if test="${content.value['Title'].exists}" > ... </c:if>
getHasLocaleValue()
public CmsUUID getId()
getFile()
.Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> Site path of the resource: "${content.id}"; </cms:contentload>
CmsResource.getStructureId()
public java.util.Map<java.lang.String,java.lang.String> getImageDnd()
public boolean getIsEditable()
true
in case the current user is allowed to edit the XML content.
If the check is performed from the online project, the user context is internally switched to an offline
project. So this may return true
even if the user is currently in the online project.
"Allowed to edit" here requires "read" and "write" permission for the VFS resource the XML content was created from.
It also requires that the VFS resource is not locked by another user.
Moreover, the user must be able to access at least one "offline" project.
Intended for quick checks to for example show / hide edit buttons for user generated content.
true
in case the current user is allowed to edit the XML contentpublic java.util.Locale getLocale()
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getLocaleNames()
The provided Map key is assumed to be a String that represents the Locale.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:forEach items="${content.localeNames['de']}" var="elem"> <c:out value="${elem}" /> </c:forEach> </cms:contentload>
getNames()
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> getLocaleRdfa()
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.List<CmsJspContentAccessValueWrapper>>> getLocaleSubValueList()
The first provided Map key is assumed to be a String that represents the Locale, the second provided Map key is assumed to be a String that represents the xpath to the value.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:forEach var="item" items="${content.localeSubValueList['de']['Items']}"> ${item} </c:forEach> </cms:contentload>
getLocaleValue()
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,CmsJspContentAccessValueWrapper>> getLocaleValue()
The first provided Map key is assumed to be a String that represents the Locale, the second provided Map key is assumed to be a String that represents the xpath to the value.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> The Title in Locale "de": ${content.localeValue['de']['Title']} </cms:contentload>
getValue()
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.List<CmsJspContentAccessValueWrapper>>> getLocaleValueList()
The first provided Map key is assumed to be a String that represents the Locale, the second provided Map key is assumed to be a String that represents the xpath to the value.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:forEach var="teaser" items="${content.localeValueList['de']['Teaser']}"> ${teaser} </c:forEach> </cms:contentload>
getLocaleValue()
public java.util.List<java.lang.String> getNames()
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:forEach items="${content.names}" var="elem"> <c:out value="${elem}" /> </c:forEach> </cms:contentload>
getLocaleNames()
public java.lang.String getPrintStructure()
public I_CmsXmlDocument getRawContent()
public java.util.Map<java.lang.String,java.lang.String> getRdfa()
public CmsJspCategoryAccessBean getReadCategories()
public java.util.Map<java.lang.String,java.util.List<CmsJspContentAccessValueWrapper>> getSubValueList()
The provided Map key is assumed to be a String that represents the xpath to the value. Use this method in case you want to iterate over a List of sub values from the XML content.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:forEach var="teaser" items="${content.subValueList['Items']}"> ${item} </c:forEach> </cms:contentload>
getLocaleValueList()
public java.lang.String getTypeName()
public java.util.Map<java.lang.String,CmsJspContentAccessValueWrapper> getValue()
The provided Map key is assumed to be a String that represents the xpath to the value.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> The Title: ${content.value['Title']} </cms:contentload>
getLocaleValue()
public java.util.Map<java.lang.String,java.util.List<CmsJspContentAccessValueWrapper>> getValueList()
The provided Map key is assumed to be a String that represents the xpath to the value. Use this method in case you want to iterate over a List of values form the XML content.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:forEach var="teaser" items="${content.valueList['Teaser']}"> ${teaser} </c:forEach> </cms:contentload>
getLocaleValueList()
public CmsJspVfsAccessBean getVfs()
public CmsJspResourceWrapper getWrap()
public void init(CmsObject cms, java.util.Locale locale, I_CmsXmlDocument content, CmsResource resource)
cms
- the OpenCms context of the current userlocale
- the Locale to use when accessing the contentcontent
- the XML content to accessresource
- the resource to create the content from