Copyright© 2008-2026 Sitevision AB, all rights reserved.
@Requireable(value="PropertyUtil") public interface PropertyUtil
An instance of the Sitevision class implementing this interface can be obtained via
Utils.getPropertyUtil().
See Utils for how to obtain an instance of the Utils interface.
The advantage of using these methods instead of explicitly use the "get property" methods as defined in JCR is that none of the methods defined here throw Exceptions. (Exception handling can of course be handled properly if you implements your own JSR 286 portlet in Java, but when rendering in Velocity you can't catch Exceptions.)
---------------------------------------------------------Node have a
boolean property called "isInUse"1. The JCR way:
a) This can return true, false or throw an Exception:
#if ($aNode.getProperty('isInUse').boolean)
...
#end
b) Even if you ensure there actually are a property called "isInUse" it can still throw an Exception if the property isn't a
boolean:
#if ($aNode.hasProperty('isInUse') && $aNode.getProperty('isInUse').boolean)
...
#end
c) Your best possible effort to avoid Exceptions is to ensure that there are a property and that it actually is of boolean
type before you check its value:
(Note! Property types are defined in javax.jcr.PropertyType and the BOOLEAN type is represented by the
int value 6):
#if ($aNode.hasProperty('isInUse') && $aNode.getProperty('isInUse').type == 6 && $aNode.getProperty('isInUse').boolean)
...
#end
The drawback with this alternative is that you miss boolean properties that isn't registered as the
BOOLEAN type (e.g. a String property with the value "true" or "false")
2. The PropertyUtil way:
This always returns true or false:
#set ($propertyUtil = $sitevisionUtils.propertyUtil)
...
#if ($propertyUtil.getBoolean($aNode, 'isInUse')
...
#end
--------------------------------------------------------- int value and a int
property "myNumber".#set statement)1. The JCR way:
This can't be achieved in Velocity! You can only fetch the value as a long ($aNode.getProperty('myNumber').long)
but Velocity needs an int or an Integer to perform addition.
2. The PropertyUtil way:
This will work in Velocity (i.e. use PropertyUtil to get the int):
#set ($propertyUtil = $sitevisionUtils.propertyUtil)
...
#set ($result = $propertyUtil.getInt($aNode, 'myNumber') + 45)
---------------------------------------------------------
Since the property name "anIllegal[./]name" contains illegal characters it must be escaped.
To do this you typically use the escapeJcrName(String)
method in EndecUtil.
Note that the property name "aLegalName" is not escaped since it doesn't contain any illegal characters.
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
#set ($propertyUtil = $sitevisionUtils.propertyUtil)
#set ($endecUtil = $sitevisionUtils.endecUtil)
...
#set ($escapedName = $endecUtil.escapeJcrName('anIllegal[./]name'))
#set ($firstValue = $propertyUtil.getInt($aNode, $escapedName)
#set ($secondValue = $propertyUtil.getInt($aNode, 'aLegalName')
| Modifier and Type | Method and Description |
|---|---|
Binary |
getBinary(Node aNode,
String aPropertyName)
Gets a Binary property from a Node.
|
Binary |
getBinary(Node aNode,
String aPropertyName,
Binary aDefaultValue)
Gets a Binary property from a node with a fallback value if the property doesn't exist.
|
boolean |
getBoolean(Node aNode,
String aPropertyName)
Gets a boolean property from a Node.
|
boolean |
getBoolean(Node aNode,
String aPropertyName,
boolean aDefaultValue)
Gets a boolean property from a Node with a fallback value if the property doesn't exist or is incompatible with the boolean type.
|
Calendar |
getCalendar(Node aNode,
String aPropertyName)
Gets a Calendar property from a Node.
|
Calendar |
getCalendar(Node aNode,
String aPropertyName,
Calendar aDefaultValue)
Gets a Calendar property from a Node with a fallback value if the property doesn't exist or is incompatible with the Calendar type.
|
double |
getDouble(Node aNode,
String aPropertyName)
Gets a double property from a Node.
|
double |
getDouble(Node aNode,
String aPropertyName,
double aDefaultValue)
Gets a double property from a node with a fallback value if the property doesn't exist or is incompatible with the double type.
|
Node |
getEnabledNode(Node aNode,
String aEnablingPropertyName,
String aNodePropertyName)
Gets a Node property from a Node if an enabling property allows it.
|
Node |
getEnabledNode(Node aNode,
String aEnablingPropertyName,
String aNodePropertyName,
Node aDefaultValue)
Gets a Node property from a Node if an enabling property allows it, with a fallback Node value.
|
String |
getEnabledString(Node aNode,
String aEnablingPropertyName,
String aStringPropertyName)
Gets a String property from a Node if an enabling boolean property allows it.
|
String |
getEnabledString(Node aNode,
String aEnablingPropertyName,
String aStringPropertyName,
String aDefaultValue)
Gets a String property from a Node if an enabling boolean property allows it, with a fallback value.
|
String |
getEnabledStringEscaped(Node aNode,
String aEnablingPropertyName,
String aStringPropertyName)
Gets a String property from a Node if an enabling boolean property allows it, and returns it XML escaped.
|
String |
getEnabledStringEscaped(Node aNode,
String aEnablingPropertyName,
String aStringPropertyName,
String aDefaultValue)
Gets a String property from a Node if an enabling boolean property allows it, and returns it XML escaped with a fallback value.
|
int |
getInt(Node aNode,
String aPropertyName)
Gets an int property from a Node.
|
int |
getInt(Node aNode,
String aPropertyName,
int aDefaultValue)
Gets an int property from a node with a fallback value if the property doesn't exist or is incompatible with the int type.
|
Binary |
getNestedBinary(Node aNode,
String aNodePropertyName,
String aPropertyName)
Gets a Binary property from a "nested" Node's property.
|
Binary |
getNestedBinary(Node aNode,
String aNodePropertyName,
String aPropertyName,
Binary aDefaultValue)
Gets a Binary property from a "nested" Node's property with a fallback value if the property doesn't exist.
|
boolean |
getNestedBoolean(Node aNode,
String aNodePropertyName,
String aPropertyName)
Gets a boolean property from a "nested" Node's property.
|
boolean |
getNestedBoolean(Node aNode,
String aNodePropertyName,
String aPropertyName,
boolean aDefaultValue)
Gets a boolean property from a "nested" Node's property with a fallback value if the property doesn't exist or is incompatible
with the boolean type.
|
Calendar |
getNestedCalendar(Node aNode,
String aNodePropertyName,
String aPropertyName)
Gets a Calendar property from a "nested" Node's property.
|
Calendar |
getNestedCalendar(Node aNode,
String aNodePropertyName,
String aPropertyName,
Calendar aDefaultValue)
Gets a Calendar property from a "nested" Node's property with a fallback value if the property doesn't exist.
|
double |
getNestedDouble(Node aNode,
String aNodePropertyName,
String aPropertyName)
Gets a double property from a "nested" Node's property.
|
double |
getNestedDouble(Node aNode,
String aNodePropertyName,
String aPropertyName,
double aDefaultValue)
Gets a double property from a "nested" Node's property with a fallback value if the property doesn't exist or is incompatible
with the double type.
|
int |
getNestedInt(Node aNode,
String aNodePropertyName,
String aPropertyName)
Gets an int property from a "nested" Node's property.
|
int |
getNestedInt(Node aNode,
String aNodePropertyName,
String aPropertyName,
int aDefaultValue)
Gets an int property from a "nested" Node's property with a fallback value if the property doesn't exist or is incompatible with the int type.
|
Node |
getNestedNode(Node aNode,
String aNodePropertyName,
String aPropertyName)
Gets a Node property from a "nested" Node's property.
|
Node |
getNestedNode(Node aNode,
String aNodePropertyName,
String aPropertyName,
Node aDefaultValue)
Gets a Node property from a "nested" Node's property with a fallback value if the property doesn't exist.
|
String |
getNestedString(Node aNode,
String aNodePropertyName,
String aPropertyName)
Gets a String property from a "nested" Node's property.
|
String |
getNestedString(Node aNode,
String aNodePropertyName,
String aPropertyName,
String aDefaultValue)
Gets a String property from a "nested" Node's property with a fallback value if the property doesn't exist.
|
String |
getNestedStringEscaped(Node aNode,
String aNodePropertyName,
String aPropertyName)
Gets a String property from a "nested" Node's property and returns it XML escaped.
|
String |
getNestedStringEscaped(Node aNode,
String aNodePropertyName,
String aPropertyName,
String aDefaultValue)
Gets a String property from a "nested" Node's property with a fallback value if the property doesn't exist, and returns it XML escaped.
|
List<String> |
getNestedStrings(Node aNode,
String aNodePropertyName,
String aPropertyName)
Gets a
List of property values from a "nested" Node's property. |
List<String> |
getNestedStrings(Node aNode,
String aNodePropertyName,
String aPropertyName,
List<String> aDefaultValue)
Gets a
List of property values from a "nested" Node's property with a fallback value if the property doesn't exist. |
List<String> |
getNestedStringsEscaped(Node aNode,
String aNodePropertyName,
String aPropertyName)
Gets a
List of XML escaped property values from a "nested" Node's property. |
List<String> |
getNestedStringsEscaped(Node aNode,
String aNodePropertyName,
String aPropertyName,
List<String> aDefaultValue)
Gets a
List of property values from a "nested" Node's property with a fallback value if the property doesn't exist,
and returns it XML escaped. |
Node |
getNode(Node aNode,
String aPropertyName)
Gets a Node property from a Node.
|
Node |
getNode(Node aNode,
String aPropertyName,
Node aDefaultValue)
Gets a Node property from a Node with a fallback value if the property doesn't exist.
|
String |
getString(Node aNode,
String aPropertyName)
Gets a String property from a Node.
|
String |
getString(Node aNode,
String aPropertyName,
String aDefaultValue)
Gets a String property from a node with a fallback value if the property doesn't exist.
|
String |
getStringEscaped(Node aNode,
String aPropertyName)
Gets a String property from a Node and returns it XML escaped.
|
String |
getStringEscaped(Node aNode,
String aPropertyName,
String aDefaultValue)
Gets a String property from a Node, with a fallback value, and returns it XML escaped.
|
List<String> |
getStrings(Node aNode,
String aPropertyName)
Gets a
List of property values from a Node. |
List<String> |
getStrings(Node aNode,
String aPropertyName,
List<String> aDefaultValue)
Gets a
List of property values from a Node with a fallback value if the property doesn't exist. |
List<String> |
getStringsEscaped(Node aNode,
String aPropertyName)
Gets a
List of XML escaped property values from a Node. |
List<String> |
getStringsEscaped(Node aNode,
String aPropertyName,
List<String> aDefaultValue)
Gets a
List of XML escaped property values from a Node with a fallback value if the property doesn't exist. |
boolean |
hasProperty(Node aNode,
String aPropertyName)
Whether a Node has a property or not.
|
String getNestedString(Node aNode, String aNodePropertyName, String aPropertyName)
Node has a property that is a Node, and that "inner/nested" Node has a
String property).
Note! This method does not escape names (i.e. aNodePropertyName and aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the base Node that has a property that is a NodeaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the property for the "inner/nested" NodeString. If no property exists, null is returned.getNestedStringEscaped(javax.jcr.Node, String, String)String getNestedStringEscaped(Node aNode, String aNodePropertyName, String aPropertyName)
Node has a property that is a Node, and that "inner/nested" Node has a
String property).
This is a convenience method for getting a "nested" String property that also should be XML escaped. A String that should be included in the html output should typically always be XML escaped to be valid XHTML and avoid XSS problems.
This Velocity code:
#set ($endecUtil = ...)
#set ($propertyUtil = ...)
...
<p>
$endecUtil.escapeXML($propertyUtil.getNestedString($myNode, 'aNodeProperty', 'aProperty'))
</p>
would typically be replaced with this:
#set ($propertyUtil = ...)
...
<p>
$!propertyUtil.getNestedStringEscaped($myNode, 'aNodeProperty', 'aProperty')
</p>
Note! This method does not escape names (i.e. aNodePropertyName and aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the base Node that has a property that is a NodeaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the property for the "inner/nested" NodeString. If no property exists, null is returned.getNestedString(javax.jcr.Node, String, String),
EndecUtil.escapeXML(String)String getNestedString(Node aNode, String aNodePropertyName, String aPropertyName, String aDefaultValue)
Node has a property that is a Node, and that "inner/nested" Node has a
String property).
Note! This method does not escape names (i.e. aNodePropertyName and aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the base Node that has a property that is a NodeaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the property for the "inner/nested" NodeaDefaultValue - fallback value if no value existsString. If no property exists, aDefaultValue is returned.getNestedStringEscaped(javax.jcr.Node, String, String, String)String getNestedStringEscaped(Node aNode, String aNodePropertyName, String aPropertyName, String aDefaultValue)
Node has a property that is a Node, and that "inner/nested" Node
has a String property).
This is a convenience method for getting a "nested" String property that also should be XML escaped. A String that should be included in the html output should typically always be XML escaped to be valid XHTML and avoid XSS problems.
This Velocity code:
#set ($endecUtil = ...)
#set ($propertyUtil = ...)
...
<p>
$endecUtil.escapeXML($propertyUtil.getNestedString($myNode, 'aNodeProperty', 'aProperty', 'a default value'))
</p>
would typically be replaced with this:
#set ($propertyUtil = ...)
...
<p>
$propertyUtil.getNestedStringEscaped($myNode, 'aNodeProperty', 'aProperty', 'a default value')
</p>
Note! This method does not escape names (i.e. aNodePropertyName and aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the base Node that has a property that is a NodeaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the property for the "inner/nested" NodeaDefaultValue - a (non XML escaped) fallback value if no value existsString. If no property exists, aDefaultValue is XML escaped and returned.getNestedString(javax.jcr.Node, String, String, String),
EndecUtil.escapeXML(String)int getNestedInt(Node aNode, String aNodePropertyName, String aPropertyName)
Node has a property that is a Node, and that "inner/nested" Node
has an int/Integer property).
Note! This method does not escape names (i.e. aNodePropertyName and aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the base Node that has a property that is a NodeaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the property for the "inner/nested" Nodeint. If no property exists or it isn't compatible with an int, 0 is returned.int getNestedInt(Node aNode, String aNodePropertyName, String aPropertyName, int aDefaultValue)
Node has a property that is a Node, and that "inner/nested" Node
has an int/Integer property).
Note! This method does not escape names (i.e. aNodePropertyName and aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the base Node that has a property that is a NodeaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the property for the "inner/nested" NodeaDefaultValue - fallback value if no value existsint. If no property exists or it isn't compatible with an int,
aDefaultValue is returned.double getNestedDouble(Node aNode, String aNodePropertyName, String aPropertyName)
Node has a property that is a Node, and that "inner/nested" Node
has a double/Double property).
Note! This method does not escape names (i.e. aNodePropertyName and aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the base Node that has a property that is a NodeaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the property for the "inner/nested" Nodedouble. If no property exists or it isn't compatible with a double,
0.0 is returned.double getNestedDouble(Node aNode, String aNodePropertyName, String aPropertyName, double aDefaultValue)
Node has a property that is a Node, and that "inner/nested" Node
has a double/Double property).
Note! This method does not escape names (i.e. aNodePropertyName and aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the base Node that has a property that is a NodeaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the property for the "inner/nested" NodeaDefaultValue - fallback value if no value existsdouble. If no property exists or it isn't compatible with a double,
aDefaultValue is returned.boolean getNestedBoolean(Node aNode, String aNodePropertyName, String aPropertyName)
Node has a property that is a Node, and that "inner/nested" Node
has a Boolean property).
Note! This method does not escape names (i.e. aNodePropertyName and aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the base Node that has a property that is a NodeaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the property for the "inner/nested" Nodeboolean. If no property exists or it isn't compatible with a boolean,
false is returned.boolean getNestedBoolean(Node aNode, String aNodePropertyName, String aPropertyName, boolean aDefaultValue)
Node has a property that is a Node, and that "inner/nested" Node
has a Boolean property).
Note! This method does not escape names (i.e. aNodePropertyName and aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the base Node that has a property that is a NodeaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the property for the "inner/nested" NodeaDefaultValue - fallback value if no value existsboolean. If no property exists or it isn't compatible with a boolean,
aDefaultValue is returned.Node getNestedNode(Node aNode, String aNodePropertyName, String aPropertyName)
Node has a property that is a Node, and that "inner/nested" Node
has a Node property).
Note! This method does not escape names (i.e. aNodePropertyName and aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the base Node that has a property that is a NodeaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the property for the "inner/nested" NodeNode. If no property exists or it isn't a Node, null is returned.Node getNestedNode(Node aNode, String aNodePropertyName, String aPropertyName, Node aDefaultValue)
Node has a property that is a Node, and that "inner/nested" Node
has a Node property).
Note! This method does not escape names (i.e. aNodePropertyName and aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the base Node that has a property that is a NodeaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the property for the "inner/nested" NodeaDefaultValue - fallback value if no value existsNode. If no property exists or it isn't a Node, aDefaultValue is returned.Binary getBinary(Node aNode, String aPropertyName)
Ensure to always handle resources appropriately when working with Binary! If you get a stream via Binary.getStream(),
you must also close the stream when you are done.
Note! The Binary support is limited, see Property.getBinary() for more information!
Note! This method does not escape the property name (i.e. aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has a propertyaPropertyName - the name of the propertyBinary. If no property exists, null is returned.Binary getBinary(Node aNode, String aPropertyName, Binary aDefaultValue)
Ensure to always handle resources appropriately when working with Binary! If you get a stream via Binary.getStream(),
you must also close the stream when you are done.
Note! The Binary support is limited, see Property.getBinary() for more information!
Note! This method does not escape the property name (i.e. aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has a propertyaPropertyName - the name of the propertyaDefaultValue - fallback value if no value existsBinary. If no property exists, aDefaultValue is returned.Binary getNestedBinary(Node aNode, String aNodePropertyName, String aPropertyName)
Node has a property that is a Node, and that "inner/nested" Node
has a Binary property).
Ensure to always handle resources appropriately when working with Binary! If you get a stream via Binary.getStream(),
you must also close the stream when you are done.
Note! The Binary support is limited, see Property.getBinary() for more information!
Note! This method does not escape names (i.e. aNodePropertyName and aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the base Node that has a property that is a NodeaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the Binary property for the "inner/nested" NodeBinary. If no property exists or it isn't a Binary,
null is returned.Binary getNestedBinary(Node aNode, String aNodePropertyName, String aPropertyName, Binary aDefaultValue)
Node has a property that is a Node, and that "inner/nested" Node
has a Binary property).
Ensure to always handle resources appropriately when working with Binary! If you get a stream via Binary.getStream(),
you must also close the stream when you are done.
Note! The Binary support is limited, see Property.getBinary() for more information!
Note! This method does not escape names (i.e. aNodePropertyName and aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the base Node that has a property that is a NodeaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the Binary property for the "inner/nested" NodeaDefaultValue - fallback value if no value existsBinary. If no property exists or it isn't a Binary, aDefaultValue is returned.String getString(Node aNode, String aPropertyName)
Note! This method does not escape the property name (i.e. aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has a propertyaPropertyName - the name of the propertyString. If no property exists, null is returned.getStringEscaped(javax.jcr.Node, String)String getStringEscaped(Node aNode, String aPropertyName)
This is a convenience method for getting a String property that also should be XML escaped. A String that should be included in the html output should typically always be XML escaped to be valid XHTML and avoid XSS problems.
This Velocity code:
#set ($endecUtil = ...)
#set ($propertyUtil = ...)
...
<p>
$endecUtil.escapeXML($propertyUtil.getString($myNode, 'aProperty'))
</p>
would typically be replaced with this:
#set ($propertyUtil = ...)
...
<p>
$!propertyUtil.getStringEscaped($myNode, 'aProperty')
</p>
Note! This method does not escape the property name (i.e. aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has a propertyaPropertyName - the name of the propertyString. If no property exists, null is returned.getString(javax.jcr.Node, String),
EndecUtil.escapeXML(String)String getString(Node aNode, String aPropertyName, String aDefaultValue)
Note! This method does not escape the property name (i.e. aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has a propertyaPropertyName - the name of the propertyaDefaultValue - fallback value if no value existsString. If no property exists, aDefaultValue is returned.getStringEscaped(javax.jcr.Node, String, String)String getStringEscaped(Node aNode, String aPropertyName, String aDefaultValue)
This is a convenience method for getting a String property that also should be XML escaped. A String that should be included in the html output should typically always be XML escaped to be valid XHTML and avoid XSS problems.
This Velocity code:
#set ($endecUtil = ...)
#set ($propertyUtil = ...)
...
<p>
$endecUtil.escapeXML($propertyUtil.getString($myNode, 'aProperty', 'a default value'))
</p>
would typically be replaced with this:
#set ($propertyUtil = ...)
...
<p>
$propertyUtil.getStringEscaped($myNode, 'aProperty', 'a default value')
</p>
Note! This method does not escape the property name (i.e. aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has a propertyaPropertyName - the name of the propertyaDefaultValue - a (non XML escaped) fallback value if no value existsString. If no property exists, aDefaultValue is XML escaped and returned.getString(javax.jcr.Node, String, String),
EndecUtil.escapeXML(String)int getInt(Node aNode, String aPropertyName)
Note! This method does not escape the property name (i.e. aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has a propertyaPropertyName - the name of the propertyint value for aPropertyName. If no property exists or it isn't compatible with an int, 0 is returned.int getInt(Node aNode, String aPropertyName, int aDefaultValue)
Note! This method does not escape the property name (i.e. aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has a propertyaPropertyName - the name of the propertyaDefaultValue - fallback value if no value existsint value for aPropertyName. If no property exists or it isn't compatible with an int,
aDefaultValue is returned.double getDouble(Node aNode, String aPropertyName)
Note! This method does not escape the property name (i.e. aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has a propertyaPropertyName - the name of the propertydouble value for aPropertyName. If no property exists or it isn't compatible with a double,
0.0 is returned.double getDouble(Node aNode, String aPropertyName, double aDefaultValue)
Note! This method does not escape the property name (i.e. aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has a propertyaPropertyName - the name of the propertyaDefaultValue - fallback value if no value existsdouble value for aPropertyName. If no property exists or it isn't compatible with a double,
aDefaultValue is returned.boolean getBoolean(Node aNode, String aPropertyName)
Note! This method does not escape the property name (i.e. aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has a propertyaPropertyName - the name of the propertyboolean. If no property exists or it isn't compatible with a boolean,
false is returned.boolean getBoolean(Node aNode, String aPropertyName, boolean aDefaultValue)
Note! This method does not escape the property name (i.e. aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has a propertyaPropertyName - the name of the propertyaDefaultValue - fallback value if no value existsboolean. If no property exists or it isn't compatible with a boolean,
aDefaultValue is returned.Node getNode(Node aNode, String aPropertyName)
Note! This method does not escape the property name (i.e. aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has a propertyaPropertyName - the name of the propertyNode. If no property exists or it isn't a Node, null is returned.Node getEnabledNode(Node aNode, String aEnablingPropertyName, String aNodePropertyName)
In some Sitevision portlet configs there are a "boolean" property that enables a "Node" property and the "Node" might be null.
This is a convenience method for such cases. In Velocity, code like this:
#set ($startPage = ...) ## Ensure start page value...
#if ($propertyUtil.getBoolean($portlet, 'useCustomStartPage'))
#set ($customStartPage = $scriptUtil.getNonNull(${propertyUtil.getNode($portlet, 'customStartPage')}))
#if ($customStartPage)
#set ($startPage = $customStartPage)
#end
#end
would typically be replaced with this:
#set ($startPage = $scriptUtil.getNonNull(${propertyUtil.getEnabledNode($portlet, 'useCustomStartPage', 'customStartPage')}))
#if (!$startPage)
#set ($startPage = ...) ## Set default start page value if no custom start page was set...
#end
Note! This method does not escape names
(i.e. aEnablingPropertyName and aNodePropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has the propertiesaEnablingPropertyName - the name of the boolean property that enables the Node denoted by aPropertyNameaNodePropertyName - the name of the propertyNode. If no property exists or it isn't a Node,
null is returned.
A Node will never be returned if aEnablingPropertyName doesn't exist, isn't compatible with a
boolean or isn't true.getEnabledNode(javax.jcr.Node, String, String, javax.jcr.Node)Node getEnabledNode(Node aNode, String aEnablingPropertyName, String aNodePropertyName, Node aDefaultValue)
Note! This method does not escape names
(i.e. aEnablingPropertyName and aNodePropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has the propertiesaEnablingPropertyName - the name of the boolean property that enables the Node denoted by aPropertyNameaNodePropertyName - the name of the propertyaDefaultValue - fallback value if no value existsNode. If no property exists or it isn't a Node,
aDefaultValue is returned.
If aEnablingPropertyName doesn't exist, isn't compatible with a boolean or isn't true,
aDefaultValue is returned.getEnabledNode(javax.jcr.Node, String, String)String getEnabledString(Node aNode, String aEnablingPropertyName, String aStringPropertyName)
In some Sitevision portlet configs there are a "boolean" property that enables a "String" property and the "String" might
be null. This is a convenience method for such cases. In Velocity, code like this:
#set ($name = ...) ## Set default name...
#if ($propertyUtil.getBoolean($portlet, 'useCustomName'))
#set ($customName = $scriptUtil.getNonNull(${propertyUtil.getNode($portlet, 'customName')}))
#if ($customName)
#set ($name = $customName)
#end
#end
would typically be replaced with this:
#set ($name = $scriptUtil.getNonNull(${propertyUtil.getEnabledString($portlet, 'useCustomName', 'customName')}))
#if (!$name)
#set ($name = ...) ## Set default name if no custom name was set...
#end
Note! This method does not escape names
(i.e. aEnablingPropertyName and aStringPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has the propertiesaEnablingPropertyName - the name of the boolean property that enables the String denoted by aStringPropertyNameaStringPropertyName - the name of the String propertyString. If no property exists, null is returned.
Null will always be returned if aEnablingPropertyName doesn't exist, isn't compatible with a boolean
or isn't true.getEnabledString(javax.jcr.Node, String, String, String)String getEnabledString(Node aNode, String aEnablingPropertyName, String aStringPropertyName, String aDefaultValue)
Note! This method does not escape names
(i.e. aEnablingPropertyName and aStringPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has the propertiesaEnablingPropertyName - the name of the boolean property that enables the String denoted by aStringPropertyNameaStringPropertyName - the name of the String propertyaDefaultValue - fallback value to return if no value existString. If no property exists, aDefaultValue is returned.
aDefaultValue will always be returned if aEnablingPropertyName doesn't exist, isn't compatible with a
boolean or isn't true.getEnabledString(javax.jcr.Node, String, String)String getEnabledStringEscaped(Node aNode, String aEnablingPropertyName, String aStringPropertyName)
In some Sitevision portlet configs there are a "boolean" property that enables a "String" property and the "String"
might be null. This is a convenience method for such cases where you want the value XML escaped. In Velocity, code like this:
#set ($endecUtil = ...)
#set ($escapedName = ...) ## Set default escaped name...
#if ($propertyUtil.getBoolean($portlet, 'useCustomName'))
#set ($customName = $scriptUtil.getNonNull(${propertyUtil.getNode($portlet, 'customName')}))
#if ($customName)
#set ($escapedName = $endecUtil.escapeXML($customName))
#end
#end
would typically be replaced with this:
#set ($escapedName = $scriptUtil.getNonNull(${propertyUtil.getEnabledStringEscaped($portlet, 'useCustomName', 'customName')}))
#if (!$escapedName)
#set ($escapedName = ...) ## Set default escaped name if no custom name was set...
#end
Note! This method does not escape names
(i.e. aEnablingPropertyName and aStringPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has the propertiesaEnablingPropertyName - the name of the boolean property that enables the String denoted by aStringPropertyNameaStringPropertyName - the name of the String propertyString. If no property exists, null is returned.
Null will always be returned if aEnablingPropertyName doesn't exist, isn't compatible with a boolean
or isn't true.getEnabledStringEscaped(javax.jcr.Node, String, String, String)String getEnabledStringEscaped(Node aNode, String aEnablingPropertyName, String aStringPropertyName, String aDefaultValue)
Note! This method does not escape names
(i.e. aEnablingPropertyName and aStringPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has the propertiesaEnablingPropertyName - the name of the boolean property that enables the String denoted by aStringPropertyNameaStringPropertyName - the name of the String propertyaDefaultValue - the (non XML escaped) fallback value to return if no value existString. If no property exists, aDefaultValue is
XML escaped and returned.
aDefaultValue will always be XML escaped and returned if aEnablingPropertyName doesn't exist,
isn't compatible with a boolean or isn't true.getEnabledStringEscaped(javax.jcr.Node, String, String)Calendar getCalendar(Node aNode, String aPropertyName)
Note! This method does not escape the property name (i.e. aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has a propertyaPropertyName - the name of the propertyCalendar. If no property exists or it isn't a Calendar,
null is returned.Calendar getCalendar(Node aNode, String aPropertyName, Calendar aDefaultValue)
Note! This method does not escape the property name (i.e. aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has a propertyaPropertyName - the name of the propertyaDefaultValue - fallback value if no value existsCalendar. If no property exists or it isn't compatible with a Calendar,
aDefaultValue is returned.Calendar getNestedCalendar(Node aNode, String aNodePropertyName, String aPropertyName)
Node has a property that is a Node, and that "inner/nested" Node
has a Calendar/Date property).
Note! The name of this method might seem awkward since a Calendar is returned, but this is to resemble the pattern of a
javax.jcr.Node that has the method getDate() that returns a Calendar.
Note! This method does not escape names (i.e. aNodePropertyName and aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the base Node that has a property that is a NodeaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the Calendar property for the "inner/nested" NodeCalendar. If no property exists or it isn't a Calendar,
null is returned.Calendar getNestedCalendar(Node aNode, String aNodePropertyName, String aPropertyName, Calendar aDefaultValue)
Node has a property that is a Node, and that "inner/nested" Node
has a Calendar/Date property).
Note! This method does not escape names (i.e. aNodePropertyName and aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the base Node that has a property that is a NodeaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the Calendar property for the "inner/nested" NodeaDefaultValue - fallback value if no value existsCalendar. If no property exists or it isn't a Calendar,
aDefaultValue is returned.Node getNode(Node aNode, String aPropertyName, Node aDefaultValue)
Note! This method does not escape the property name (i.e. aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has a propertyaPropertyName - the name of the propertyaDefaultValue - fallback value if no value existsNode. If no property exists or it isn't a Node, aDefaultValue is returned.List<String> getStrings(Node aNode, String aPropertyName)
List of property values from a Node.
Note! This method does not escape the property name (i.e. aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has a propertyaPropertyName - the name of the propertyList. If no property exists, null is returned.getStringsEscaped(javax.jcr.Node, String)List<String> getStringsEscaped(Node aNode, String aPropertyName)
List of XML escaped property values from a Node.
This is a convenience method for getting a list of property values that also should be XML escaped. Strings that should be included in the html output should typically always be XML escaped to be valid XHTML and avoid XSS problems.
This Velocity code:
#set ($endecUtil = ...)
#set ($propertyUtil = ...)
...
#set ($valueList = $propertyUtil.getStrings($myNode, 'aProperty'))
<ul>
#foreach ($value in $valueList)
<li>
$endecUtil.escapeXML($value)
</li>
#end
</ul>
would typically be replaced with this:
#set ($propertyUtil = ...)
...
#set ($escapedValueList = $propertyUtil.getStringsEscaped($myNode, 'aProperty'))
<ul>
#foreach ($escapedValue in $escapedValueList)
<li>
$escapedValue
</li>
#end
</ul>
Note! This method does not escape the property name (i.e. aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has a propertyaPropertyName - the name of the propertyList.
If no property exists, null is returned.getString(javax.jcr.Node, String),
EndecUtil.escapeXML(String)List<String> getStrings(Node aNode, String aPropertyName, List<String> aDefaultValue)
List of property values from a Node with a fallback value if the property doesn't exist.
Note! This method does not escape the property name (i.e. aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has a propertyaPropertyName - the name of the propertyaDefaultValue - fallback value if no value existsList. If no property exists, aDefaultValue is returned.getStringsEscaped(javax.jcr.Node, String, java.util.List)List<String> getStringsEscaped(Node aNode, String aPropertyName, List<String> aDefaultValue)
List of XML escaped property values from a Node with a fallback value if the property doesn't exist.
This is a convenience method for getting a list of property values that also should be XML escaped. Strings that should be included in the html output should typically always be XML escaped to be valid XHTML and avoid XSS problems.
This Velocity code:
#set ($endecUtil = ...)
#set ($propertyUtil = ...)
#set ($myDefaultList = ...)
...
#set ($valueList = $propertyUtil.getStrings($myNode, 'aProperty', $myDefaultList))
<ul>
#foreach ($value in $valueList)
<li>
$endecUtil.escapeXML($value)
</li>
#end
</ul>
would typically be replaced with this:
#set ($propertyUtil = ...)
#set ($myDefaultList = ...)
...
#set ($escapedValueList = $propertyUtil.getStringsEscaped($myNode, 'aProperty', $myDefaultList))
<ul>
#foreach ($escapedValue in $escapedValueList)
<li>
$escapedValue
</li>
#end
</ul>
Note! This method does not escape the property name (i.e. aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node that has a propertyaPropertyName - the name of the propertyaDefaultValue - fallback list if no value exists. Note! The actual fallback list is never returned
but it's values might be used. If the fallback list are about to be returned, a copy of it will be created and
all values from the fallback list will be XML escaped and added to the new list before it is returned.List.
If no property exists, aDefaultValue is returned.getString(javax.jcr.Node, String, String),
EndecUtil.escapeXML(String)List<String> getNestedStrings(Node aNode, String aNodePropertyName, String aPropertyName)
List of property values from a "nested" Node's property.
(i.e. the base Node has a property that is a Node, and that "inner/nested" Node
has a String property).
Note! This method does not escape names (i.e. aNodePropertyName and aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the base Node that has a property that is a NodeaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the property for the "inner/nested" NodeList. If no property exists, null is returned.List<String> getNestedStringsEscaped(Node aNode, String aNodePropertyName, String aPropertyName)
List of XML escaped property values from a "nested" Node's property.
(i.e. the base Node has a property that is a Node, and that "inner/nested" Node
has a String property).
This is a convenience method for getting a list of property values that also should be XML escaped. Strings that should be included in the html output should typically always be XML escaped to be valid XHTML and avoid XSS problems.
This Velocity code:
#set ($endecUtil = ...)
#set ($propertyUtil = ...)
...
#set ($valueList = $propertyUtil.getNestedStrings($myNode, 'aNodeProperty', 'aProperty'))
<ul>
#foreach ($value in $valueList)
<li>
$endecUtil.escapeXML($value)
</li>
#end
</ul>
would typically be replaced with this:
#set ($propertyUtil = ...)
...
#set ($escapedValueList = $propertyUtil.getNestedStringsEscaped($myNode, 'aNodeProperty', 'aProperty'))
<ul>
#foreach ($escapedValue in $escapedValueList)
<li>
$escapedValue
</li>
#end
</ul>
Note! This method does not escape names (i.e. aNodePropertyName and aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the base Node that has a property that is a NodeaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the property for the "inner/nested" NodeList. If no property exists, null is returned.getNestedStrings(javax.jcr.Node, String, String),
EndecUtil.escapeXML(String)List<String> getNestedStrings(Node aNode, String aNodePropertyName, String aPropertyName, List<String> aDefaultValue)
List of property values from a "nested" Node's property with a fallback value if the property doesn't exist.
(i.e. the base Node has a property that is a Node, and that "inner/nested" Node
has a String property).
Note! This method does not escape names (i.e. aNodePropertyName and aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the base Node that has a property that is a NodeaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the property for the "inner/nested" NodeaDefaultValue - fallback value if no value existsList. If no property exists, aDefaultValue is returned.List<String> getNestedStringsEscaped(Node aNode, String aNodePropertyName, String aPropertyName, List<String> aDefaultValue)
List of property values from a "nested" Node's property with a fallback value if the property doesn't exist,
and returns it XML escaped.
(i.e. the base Node has a property that is a Node, and that "inner/nested" Node
has a String property).
This is a convenience method for getting a list of property values that also should be XML escaped. Strings that should be included in the html output should typically always be XML escaped to be valid XHTML and avoid XSS problems.
This Velocity code:
#set ($endecUtil = ...)
#set ($propertyUtil = ...)
#set ($myDefaultList = ...)
...
#set ($valueList = $propertyUtil.getNestedStrings($myNode, 'aNodeProperty', 'aProperty', $myDefaultList))
<ul>
#foreach ($value in $valueList)
<li>
$endecUtil.escapeXML($value)
</li>
#end
</ul>
would typically be replaced with this:
#set ($propertyUtil = ...)
#set ($myDefaultList = ...)
...
#set ($escapedValueList = $propertyUtil.getNestedStringsEscaped($myNode, 'aNodeProperty', 'aProperty', $myDefaultList))
<ul>
#foreach ($escapedValue in $escapedValueList)
<li>
$escapedValue
</li>
#end
</ul>
Note! This method does not escape names (i.e. aNodePropertyName and aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the base Node that has a property that is a NodeaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the property for the "inner/nested" NodeaDefaultValue - fallback list if no value exists. Note! The actual fallback list is never returned,
but it's values might be used.
If the fallback list are about to be returned, a copy of it will be created and all values from the fallback list will
be XML escaped and added to the new list before it is returned.List. If no property exists, aDefaultValue
is XML escaped and returned.getNestedStrings(javax.jcr.Node, String, String, java.util.List),
EndecUtil.escapeXML(String)boolean hasProperty(Node aNode, String aPropertyName)
This is a lenient method for checking if a property exists on a Node without having to catch a potential exception from JCR.
This method is typically more efficient than its JCR counterpart Node.hasProperty(String) method.
Note! This method does not escape the property name (i.e. aPropertyName).
Illegal characters in node names and property names must always be escaped, typically via
EndecUtil.escapeJcrName(String).
For best performance - never escape a name if you are certain that it doesn't contain any illegal characters.
Sitevision model properties never contain illegal characters. Though, depending on configuration "dynamic" ones
(e.g. metadata properties) might contain illegal characters.
aNode - the Node to check for the propertyaPropertyName - name of the property to check forSitevision - Content Management Made Easy
Sitevision is an advanced Java enterprise portal product that implements Java Content Repository (JSR 283).
Copyright© 2008-2026 Sitevision AB, all rights reserved.