public final class CmsJspContentAccessValueWrapper extends java.util.AbstractCollection<java.lang.String>
The implementation is optimized for performance and uses lazy initializing of the requested values as much as possible.
CmsJspContentAccessBean
,
CmsJspTagContentAccess
Modifier and Type | Class and Description |
---|---|
class |
CmsJspContentAccessValueWrapper.CmsHasValueTransformer
Provides a Map with Booleans that
indicate if a nested sub value (xpath) for the current value is available in the XML content.
|
class |
CmsJspContentAccessValueWrapper.CmsRdfaTransformer
Provides a Map which lets the user a nested sub value from the current value,
the input is assumed to be a String that represents an xpath in the XML content.
|
class |
CmsJspContentAccessValueWrapper.CmsSubValueListTransformer
Provides a Map which lets the user access nested sub value Lists directly below the current value,
the input is assumed to be a String that represents an xpath in the XML content.
|
class |
CmsJspContentAccessValueWrapper.CmsValueListTransformer
Provides a Map which lets the user access nested sub value Lists from the current value,
the input is assumed to be a String that represents an xpath in the XML content.
|
class |
CmsJspContentAccessValueWrapper.CmsValueTransformer
Provides a Map which returns a nested sub value from the current value.
|
class |
CmsJspContentAccessValueWrapper.CmsXmlValueTransformer
Provides a Map which lets the user directly access sub-nodes of the XML represented by the current value,
the input is assumed to be a String that represents an xpath in the XML content.
|
protected static class |
CmsJspContentAccessValueWrapper.NullValueInfo
The null value info, used to generate RDFA and DND annotations for null values.
|
Modifier and Type | Field and Description |
---|---|
protected CmsObject |
m_cms
The wrapped OpenCms user context.
|
protected static CmsJspContentAccessValueWrapper |
NULL_VALUE_WRAPPER
Constant for the null (non existing) value.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
createPath(java.lang.Object input)
Returns the path to the XML content based on the current element path.
|
static CmsJspContentAccessValueWrapper |
createWrapper(CmsObject cms,
I_CmsXmlContentValue value,
I_CmsXmlContentValue parentValue,
java.lang.String valueName)
Factory method to create a new XML content value wrapper.
|
static CmsJspContentAccessValueWrapper |
createWrapper(CmsObject cms,
I_CmsXmlContentValue value,
I_CmsXmlDocument content,
java.lang.String valueName,
java.util.Locale locale)
Factory method to create a new XML content value wrapper.
|
boolean |
equals(java.lang.Object obj) |
CmsObject |
getCmsObject()
Returns the current cms context.
|
java.util.Map<java.lang.Object,java.lang.Boolean> |
getContains()
Returns a lazy initialized Map that provides Booleans which
indicate if if the wrapped values String representation contains a specific String.
|
I_CmsXmlContentValue |
getContentValue()
Returns the wrapped content value.
|
boolean |
getExists()
Returns
true in case this value actually exists in the XML content it was requested from. |
java.util.Map<java.lang.String,java.lang.Boolean> |
getHasValue()
Returns a lazy initialized Map that provides Booleans that
indicate if a nested sub value (xpath) for the current value is available in the XML content.
|
java.lang.String |
getImageDndAttr()
Returns the annotation that enables image drag and drop for this content value.
|
int |
getIndex()
Returns the node index of the XML content value in the source XML document,
starting with 0.
|
boolean |
getIsEmpty()
Returns
true in case the value is empty, that is either null or an empty String. |
boolean |
getIsEmptyOrWhitespaceOnly()
Returns
true in case the value is empty or whitespace only,
that is either null or String that contains only whitespace chars. |
java.util.Map<java.lang.Object,java.lang.Boolean> |
getIsEqual()
Returns a lazy initialized Map that provides Booleans which
indicate if an Object is equal to the wrapped object.
|
boolean |
getIsSet()
Returns
true in case the wrapped value exists and is not empty or whitespace only. |
boolean |
getIsSetNotNone()
Returns
true in case the wrapped value exists, is not empty or whitespace only
and is also not equal to the String 'none' . |
java.util.Locale |
getLocale()
Returns the Locale of the current XML content value.
|
java.lang.Long |
getMathCeil()
Calculates the next largest integer from the wrapped value.
|
java.lang.Long |
getMathFloor()
Calculates the next smallest integer from the wrapped value.
|
java.lang.Long |
getMathRound()
Calculates the next integer from the wrapped value by rounding.
|
java.lang.String |
getName()
Returns the xml node name of the wrapped content value.
|
java.util.List<java.lang.String> |
getNames()
Returns a list that provides the names of all nested sub values
directly below the current value from the XML content, including the index.
|
java.lang.Object |
getObjectValue()
Returns the raw instance of the wrapped value.
|
java.lang.String |
getPath()
Returns the path to the current XML content value.
|
java.util.Map<java.lang.String,java.lang.String> |
getRdfa()
Returns a lazy initialized Map that provides the RDFA for nested sub values.
|
java.lang.String |
getRdfaAttr()
Returns the RDF annotation to this content value.
|
CmsJspContentAccessValueWrapper |
getResolve()
Short form of
getResolveMacros() . |
CmsJspContentAccessValueWrapper |
getResolveMacros()
Turn on macro resolving for the wrapped value.
|
java.lang.String |
getStringValue()
Deprecated.
use
getToString() instead |
java.lang.String |
getStripHtml()
Assumes the wrapped value is a String and strips all HTML markup from this String.
|
java.util.Map<java.lang.String,java.util.List<CmsJspContentAccessValueWrapper>> |
getSubValueList()
Returns a lazy initialized Map that provides the Lists of sub values directly below
the current value from the XML content.
|
boolean |
getToBoolean()
Converts the wrapped value to a boolean.
|
java.util.Date |
getToDate()
Converts the wrapped value to a date.
|
CmsJspDateSeriesBean |
getToDateSeries()
Converts a date series configuration to a date series bean.
|
java.lang.Double |
getToDouble()
Parses the wrapped value to a Double precision float.
|
java.lang.Double |
getToFloat()
Parses the wrapped value to a Double precision float.
|
CmsJspImageBean |
getToImage()
Returns a scaled image bean from the wrapped value.
|
CmsJspInstanceDateBean |
getToInstanceDate()
Converts a date to an instance date bean.
|
java.lang.Long |
getToInteger()
Parses the wrapped value to a Long integer.
|
java.lang.String |
getToLink()
Returns the substituted link to the wrapped value.
|
java.lang.Long |
getToLong()
Parses the wrapped value to a Long integer.
|
java.util.Map<java.lang.String,java.lang.String> |
getToParameters()
Transforms the current value into a parameter map.
|
CmsJspResourceWrapper |
getToResource()
Converts a date to an instance date bean.
|
java.lang.String |
getToString()
Returns the wrapped value as a String.
|
java.util.Map<java.lang.Object,java.lang.String> |
getTrimToSize()
Returns a lazy initialized map that provides trimmed to size strings of the wrapped object string value.
|
java.lang.String |
getTypeName()
Returns the schema type name of the wrapped content value.
|
java.util.Map<java.lang.String,CmsJspContentAccessValueWrapper> |
getValue()
Returns a lazy initialized Map that provides the nested sub values
for the current value from the XML content.
|
java.util.Map<java.lang.String,java.util.List<CmsJspContentAccessValueWrapper>> |
getValueList()
Returns a lazy initialized Map that provides the Lists of nested sub values
for the current value from the XML content.
|
java.util.Map<java.lang.String,java.lang.String> |
getXmlText()
Returns a lazy initialized Map that provides direct access to the XML element
for the current value from the XML content.
|
int |
hashCode()
The hash code is created from the file structure id of the underlying XML content,
the selected locale and the path to the node in the XML content.
|
boolean |
isEmpty()
Supports the use of the
empty operator in the JSP EL by implementing the Collection interface. |
java.util.Iterator<java.lang.String> |
iterator()
Supports the use of the
empty operator in the JSP EL by implementing the Collection interface. |
CmsObject |
obtainCmsObject()
Deprecated.
use
getCmsObject() instead |
I_CmsXmlContentValue |
obtainContentValue()
Deprecated.
use
getContentValue() instead |
int |
size()
Supports the use of the
empty operator in the JSP EL by implementing the Collection interface. |
protected static java.lang.String |
substituteLink(CmsObject cms,
java.lang.String target)
Returns the substituted link to the given target.
|
java.lang.Double |
toDouble(java.lang.Double def)
Parses the wrapped value to a Double precision float, returning the default in case the number can not be parsed.
|
java.lang.Double |
toFloat(java.lang.Double def)
Parses the wrapped value to a Double precision float, returning the default in case the number can not be parsed.
|
java.lang.Long |
toInteger(java.lang.Long def)
Parses the wrapped value to a Long integer, returning the default in case the number can not be parsed.
|
java.lang.Long |
toLong(java.lang.Long def)
Parses the wrapped value to a Long integer, returning the default in case the number can not be parsed.
|
java.lang.String |
toString() |
org.opencms.jsp.util.A_CmsJspValueWrapper |
useDefault(java.lang.Object defaultValue)
Returns a value wrapper for the provided default in case this value is empty.
|
add, addAll, clear, contains, containsAll, remove, removeAll, retainAll, toArray, toArray
protected static final CmsJspContentAccessValueWrapper NULL_VALUE_WRAPPER
public static CmsJspContentAccessValueWrapper createWrapper(CmsObject cms, I_CmsXmlContentValue value, I_CmsXmlContentValue parentValue, java.lang.String valueName)
In case either parameter is null
, the NULL_VALUE_WRAPPER
is returned.
cms
- the current users OpenCms contextvalue
- the value to warpparentValue
- the parent value, required to set the null value infovalueName
- the value path namenull
if any parameter is null
public static CmsJspContentAccessValueWrapper createWrapper(CmsObject cms, I_CmsXmlContentValue value, I_CmsXmlDocument content, java.lang.String valueName, java.util.Locale locale)
In case either parameter is null
, the NULL_VALUE_WRAPPER
is returned.
cms
- the current users OpenCms contextvalue
- the value to warpcontent
- the content document, required to set the null value infovalueName
- the value path namelocale
- the selected localenull
if any parameter is null
public I_CmsXmlContentValue getContentValue()
Note that this will return null
when getExists()
returns false
.
public boolean getExists()
true
in case this value actually exists in the XML content it was requested from.Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:if test="${content.value['Link'].exists}" > The content has a "Link" value! </c:if> </cms:contentload>
true
in case this value actually exists in the XML content it was requested frompublic java.util.Map<java.lang.String,java.lang.Boolean> getHasValue()
The provided Map key is assumed to be a String that represents the relative xpath to the value.
In case the current value is not a nested XML content value, or the XML content value does not exist,
the CmsConstantMap.CONSTANT_BOOLEAN_FALSE_MAP
is returned.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:if test="${content.value['Link'].hasValue['Description']}" > The content has a "Description" value as sub element to the "Link" value! </c:if> </cms:contentload>Please note that you can also test if a sub-value exists like this:
<c:if test="${content.value['Link'].value['Description'].exists}" > ... </c:if>
public java.lang.String getImageDndAttr()
Use to insert the annotation attributes into a HTML tag.
Only makes sense in case this node actually contains the path to an image.
Example using EL: <span ${value.Image.imageDndAttr}> ... </span> will result in <span data-imagednd="..."> ... </span>
public int getIndex()
In case the XML content value does not exist, -1
is returned.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> The locale of the Link node: ${content.value['Link'].locale} </cms:contentload>
public boolean getIsEmpty()
true
in case the value is empty, that is either null
or an empty String.
In case the XML content value does not exist, true
is returned.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:if test="${content.value['Link'].isEmpty}" > The content of the "Link" value is empty. </c:if> </cms:contentload>
true
in case the value is emptypublic boolean getIsEmptyOrWhitespaceOnly()
true
in case the value is empty or whitespace only,
that is either null
or String that contains only whitespace chars.
In case the XML content value does not exist, true
is returned.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:if test="${content.value['Link'].isEmptyOrWhitespaceOnly}" > The content of the "Link" value is empty or contains only whitespace chars. </c:if> </cms:contentload>
true
in case the value is empty or whitespace onlypublic java.util.Locale getLocale()
In case the XML content value does not exist, the OpenCms system default Locale is returned.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> The locale of the Link node: ${content.value['Link'].locale} </cms:contentload>
public java.lang.String getName()
I_CmsXmlSchemaType.getName()
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.value['Items'].names}" var="elem"> <c:out value="${elem}" /> </c:forEach> </cms:contentload>
public java.lang.Object getObjectValue()
A_CmsJspValueWrapper.getObjectValue()
public java.lang.String getPath()
In case the XML content value does not exist, an empty String ""
is returned.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> The path to the Link node in the XML: ${content.value['Link'].path} </cms:contentload>
public java.util.Map<java.lang.String,java.lang.String> getRdfa()
The provided Map key is assumed to be a String that represents the relative xpath to the value.
public java.lang.String getRdfaAttr()
Use to insert the annotation attributes into a HTML tag.
Example using EL: <h1 ${value.Title.rdfaAttr}>${value.Title}</h1> will result in <h1 data-oc-id="..." data-oc-field="...">My title</h1>
public CmsJspContentAccessValueWrapper getResolve()
getResolveMacros()
.getResolveMacros()
public CmsJspContentAccessValueWrapper getResolveMacros()
Macro resolving is turned off by default.
When turned on, a macro resolver is initialized with
the current OpenCms user context and the URI of the current resource.
This means known macros contained in the wrapped value will be resolved when the output String is generated.
For example, a %(property.Title)
in the value would be replaced with the
value of the title property. Macros that can not be resolved will be kept.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> The text with macros resolved: ${content.value['Text'].resolveMacros} </cms:contentload>
CmsMacroResolver
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 relative xpath to the value. Use this method in case you want to iterate over a List of sub values from the XML content.
In case the current value is not a nested XML content value, or the XML content value does not exist,
the CmsConstantMap.CONSTANT_EMPTY_LIST_MAP
is returned.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:forEach var="desc" items="${content.value['Link'].subValueList['Description']}"> ${desc} </c:forEach> </cms:contentload>
public CmsJspDateSeriesBean getToDateSeries()
public java.util.Map<java.lang.String,java.lang.String> getToParameters()
The current value must be a nested content with sub-values that have exactly 2 values each, for example like this:
<Parameters> <Key><foo></Key> <Value><bar></Value> </Parameters> <Parameters> <Key><foo2></Key> <Value><bar2></Value> </Parameters>Please note that the result Map is a simple String map, NOT a map with
CmsJspContentAccessValueWrapper
classes.public java.lang.String getTypeName()
I_CmsXmlSchemaType.getTypeName()
public java.util.Map<java.lang.String,CmsJspContentAccessValueWrapper> getValue()
The provided Map key is assumed to be a String that represents the relative xpath to the value.
In case the current value is not a nested XML content value, or the XML content value does not exist,
the CmsJspContentAccessBean.CONSTANT_NULL_VALUE_WRAPPER_MAP
is returned.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> The Link Description: ${content.value['Link'].value['Description']} </cms:contentload>Please note that this example will only work if the 'Link' element is mandatory in the schema definition of the XML content.
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 relative xpath to the value. Use this method in case you want to iterate over a List of values form the XML content.
In case the current value is not a nested XML content value, or the XML content value does not exist,
the CmsConstantMap.CONSTANT_EMPTY_LIST_MAP
is returned.
Usage example on a JSP with the JSTL:
<cms:contentload ... > <cms:contentaccess var="content" /> <c:forEach var="desc" items="${content.value['Link'].valueList['Description']}"> ${desc} </c:forEach> </cms:contentload>
public java.util.Map<java.lang.String,java.lang.String> getXmlText()
public int hashCode()
hashCode
in interface java.util.Collection<java.lang.String>
Object.hashCode()
@Deprecated public CmsObject obtainCmsObject()
getCmsObject()
instead
Note that this will return null
when getExists()
returns false
.
@Deprecated public I_CmsXmlContentValue obtainContentValue()
getContentValue()
instead
Note that this will return null
when getExists()
returns false
. Method name does not start with "get" to prevent using it in the expression language.
public java.lang.String toString()
toString
in class java.util.AbstractCollection<java.lang.String>
Object.toString()
,
getToString()
public org.opencms.jsp.util.A_CmsJspValueWrapper useDefault(java.lang.Object defaultValue)
For XML content access value wrappers like this,
the default object returned is of type CmsJspObjectValueWrapper
.
This means you can only use simple "get me the value as type X" operations on the result safely.
defaultValue
- the string to generate the default value fromCmsJspObjectValueWrapper.createWrapper(CmsObject, Object)
protected java.lang.String createPath(java.lang.Object input)
This is used to create xpath information for sub-elements in the transformers.
input
- the additional path that is appended to the current pathprotected static java.lang.String substituteLink(CmsObject cms, java.lang.String target)
cms
- the cms contexttarget
- the link targetpublic boolean equals(java.lang.Object obj)
equals
in interface java.util.Collection<java.lang.String>
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public CmsObject getCmsObject()
public java.util.Map<java.lang.Object,java.lang.Boolean> getContains()
The Object parameter is transformed to it's String representation to perform this check.
public java.util.Map<java.lang.Object,java.lang.Boolean> getIsEqual()
public boolean getIsSet()
true
in case the wrapped value exists and is not empty or whitespace only.true
in case the wrapped value exists and is not empty or whitespace onlypublic boolean getIsSetNotNone()
true
in case the wrapped value exists, is not empty or whitespace only
and is also not equal to the String 'none'
.true
in case the wrapped value exists, is not empty or whitespace only
and is also not equal to the String 'none'
public java.lang.Long getMathCeil()
Note that the result is an Object of type Long
,
so in case the wrapped value can not be converted to a number, null
is returned.
This means you can check for an empty
result in the EL.
public java.lang.Long getMathFloor()
Note that the result is an Object of type Long
,
so in case the wrapped value can not be converted to a number, null
is returned.
This means you can check for an empty
result in the EL.
public java.lang.Long getMathRound()
Note that the result is an Object of type Long
,
so in case the wrapped value can not be converted to a number, null
is returned.
This means you can check for an empty
result in the EL.
@Deprecated public java.lang.String getStringValue()
getToString()
instead
This will return the empty String ""
when getExists()
returns false
.
public java.lang.String getStripHtml()
public boolean getToBoolean()
public java.util.Date getToDate()
CmsJspElFunctions.convertDate(Object)
public java.lang.Double getToDouble()
Note that the result is an Object of type Double
,
so in case the wrapped value can not be converted to a number, null
is returned.
This means you can check for an empty
result in the EL.
public java.lang.Double getToFloat()
Note that the result is an Object of type Double
,
so in case the wrapped value can not be converted to a number, null
is returned.
This means you can check for an empty
result in the EL.
public CmsJspImageBean getToImage()
In case the value does not point to an image resource, null
is returned.
public CmsJspInstanceDateBean getToInstanceDate()
public java.lang.Long getToInteger()
Note that the result is an Object of type Long
,
so in case the wrapped value can not be converted to a number, null
is returned.
This means you can check for an empty
result in the EL.
getToLong()
public java.lang.String getToLink()
In case no link can be substituted from the wrapped value, an empty String ""
is returned.
public java.lang.Long getToLong()
Note that the result is an Object of type Long
,
so in case the wrapped value can not be converted to a number, null
is returned.
This means you can check for an empty
result in the EL.
getToInteger()
public CmsJspResourceWrapper getToResource()
public java.lang.String getToString()
This will always be at least an empty String ""
, never null
.
public java.util.Map<java.lang.Object,java.lang.String> getTrimToSize()
public boolean isEmpty()
empty
operator in the JSP EL by implementing the Collection interface.isEmpty
in interface java.util.Collection<java.lang.String>
isEmpty
in class java.util.AbstractCollection<java.lang.String>
getIsEmptyOrWhitespaceOnly()
which is the inverse of getIsSet()
.AbstractCollection.isEmpty()
,
getIsEmptyOrWhitespaceOnly()
,
getIsSet()
public java.util.Iterator<java.lang.String> iterator()
empty
operator in the JSP EL by implementing the Collection interface.iterator
in interface java.lang.Iterable<java.lang.String>
iterator
in interface java.util.Collection<java.lang.String>
iterator
in class java.util.AbstractCollection<java.lang.String>
isEmpty()
is true
,
otherwise an Iterator that will return the String value of this wrapper exactly once.AbstractCollection.size()
public int size()
empty
operator in the JSP EL by implementing the Collection interface.size
in interface java.util.Collection<java.lang.String>
size
in class java.util.AbstractCollection<java.lang.String>
AbstractCollection.size()
public java.lang.Double toDouble(java.lang.Double def)
def
- the default in case the wrapped value can not be converted to a numbertoFloat(Double)
public java.lang.Double toFloat(java.lang.Double def)
def
- the default in case the wrapped value can not be converted to a numbertoDouble(Double)
public java.lang.Long toInteger(java.lang.Long def)
def
- the default in case the wrapped value can not be converted to a numbertoLong(Long)
public java.lang.Long toLong(java.lang.Long def)
def
- the default in case the wrapped value can not be converted to a numbertoInteger(Long)