Copyright© 2008-2026 Sitevision AB, all rights reserved.
public interface VersionedPropertyUtil
This is an exotic sibling interface to PropertyUtil that can be used to extract property
values from another version than the one you are currently executing in. If you don't know what a version is or haven't
thought much about it, you would typically use the "normal" property extraction interface - PropertyUtil.
Performance note! PropertyUtil will always outperform VersionedPropertyUtil when executing
in the same version! (Tip! Use VersionUtil.getCurrentVersion() to check what
version you are currently executing in to decide if you should use PropertyUtil or VersionedPropertyUtil).
Note! Ensure to take the necessary precautions when using this interface. Even if a node exists in the version you are currently executing in, it might not exist in another version.
An example of a usecase where you actually might need to use this interface instead of PropertyUtil:
You have a function that depends on "Friendly URL" values. Since Friendly URLs only exist in the ONLINE ("published")
version, you might need this interface to ensure that your function will work properly in the OFFLINE version ("editing mode") as well.
Velocity excerpt below:
## Extract display name
#set ($propertyUtil = ...)
#set ($theName = $propertyUtil.getString($myNode, 'displayName'))
## Extract online URL when possible
#set ($theURL = '')
#set ($versionUtil = ...)
#if ($versionUtil.currentVersion != $versionUtil.ONLINE_VERSION)
#set ($versionedPropertyUtil = $sitevisionUtils.getVersionedPropertyUtil($versionUtil.ONLINE_VERSION))
#set ($theURL = $versionedPropertyUtil.getString($myNode.identifier, 'URL', ''))
#end
#if ($theURL == '')
#set ($theURL = $propertyUtil.getString($myNode, 'URL'))
#end
An instance of the Sitevision class implementing this interface can be obtained via
Utils.getVersionedPropertyUtil(int).
See Utils for how to obtain an instance of the Utils interface.
OfflineVersionPropertyUtil,
OnlineVersionPropertyUtil| Modifier and Type | Method and Description |
|---|---|
Binary |
getBinary(String aNodeIdentifier,
String aPropertyName)
Gets a Binary property from a potential Node in a specific version.
|
Binary |
getBinary(String aNodeIdentifier,
String aPropertyName,
Binary aDefaultValue)
Gets a Binary property from a potential Node in a specific version - with a fallback value if the property doesn't exist.
|
boolean |
getBoolean(String aNodeIdentifier,
String aPropertyName)
Gets a boolean property from a potential Node in a specific version.
|
boolean |
getBoolean(String aNodeIdentifier,
String aPropertyName,
boolean aDefaultValue)
Gets a boolean property from a potential Node in a specific version - with a fallback value if the property doesn't exist.
|
Calendar |
getCalendar(String aNodeIdentifier,
String aPropertyName)
Gets a Calendar property from a potential Node in a specific version.
|
Calendar |
getCalendar(String aNodeIdentifier,
String aPropertyName,
Calendar aDefaultValue)
Gets a Calendar property from a potential Node in a specific version - with a fallback value if the property doesn't exist.
|
double |
getDouble(String aNodeIdentifier,
String aPropertyName)
Gets a double property from a potential Node in a specific version.
|
double |
getDouble(String aNodeIdentifier,
String aPropertyName,
double aDefaultValue)
Gets a double property from a potential Node in a specific version - with a fallback value if the property doesn't exist.
|
int |
getInt(String aNodeIdentifier,
String aPropertyName)
Gets an int property from a potential Node in a specific version.
|
int |
getInt(String aNodeIdentifier,
String aPropertyName,
int aDefaultValue)
Gets an int property from a potential node in a specific version - with a fallback value if the property doesn't exist.
|
String |
getNestedString(String aNodeIdentifier,
String aNodePropertyName,
String aPropertyName)
Gets a String property from a potential "nested" Node's property in a specific version.
|
String |
getNestedString(String aNodeIdentifier,
String aNodePropertyName,
String aPropertyName,
String aDefaultValue)
Gets a String property from a potential "nested" Node's property in a specific version - with a fallback value if the property doesn't exist.
|
List<String> |
getNestedStrings(String aNodeIdentifier,
String aNodePropertyName,
String aPropertyName)
Gets a
List of property values from a potential "nested" Node's property in a specific version. |
List<String> |
getNestedStrings(String aNodeIdentifier,
String aNodePropertyName,
String aPropertyName,
List<String> aDefaultValue)
Gets a
List of property values from a potential "nested" Node's property in a specific version
- with a fallback value if the property doesn't exist. |
String |
getString(String aNodeIdentifier,
String aPropertyName)
Gets a String property from a potential Node in a specific version.
|
String |
getString(String aNodeIdentifier,
String aPropertyName,
String aDefaultValue)
Gets a String property from a potential Node in a specific version - with a fallback value if the property doesn't exist.
|
List<String> |
getStrings(String aNodeIdentifier,
String aPropertyName)
Gets a
List of property values from a potential Node in a specific version. |
List<String> |
getStrings(String aNodeIdentifier,
String aPropertyName,
List<String> aDefaultValue)
Gets a
List of property values from a potential Node in a specific version - with a fallback value if the property doesn't exist. |
boolean |
hasProperty(String aNodeIdentifier,
String aPropertyName)
Whether a potential Node in a specific version has a property or not.
|
String getString(String aNodeIdentifier, String aPropertyName)
Note! This method does not escape names (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.
aNodeIdentifier - the identifier (see Node.getIdentifier()) of a potential Node that has a propertyaPropertyName - the name of the propertyaPropertyName as String. If no node or property exists, null is returned.String getString(String aNodeIdentifier, String aPropertyName, String aDefaultValue)
Note! This method does not escape names (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.
aNodeIdentifier - the identifier (see Node.getIdentifier()) of a potential Node that has a propertyaPropertyName - the name of the propertyaDefaultValue - fallback value if no value existsaPropertyName as String. If no node or property exists, aDefaultValue is returned.String getNestedString(String aNodeIdentifier, 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.
aNodeIdentifier - the identifier (see Node.getIdentifier()) of a potential Node that has a propertyaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the property for the "inner/nested" NodeaPropertyName as String. If no node or property exists, null is returned.String getNestedString(String aNodeIdentifier, 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.
aNodeIdentifier - the identifier (see Node.getIdentifier()) of a potential Node that has a propertyaNodePropertyName - 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 existsaPropertyName as String. If no node or property exists, aDefaultValue is returned.List<String> getStrings(String aNodeIdentifier, String aPropertyName)
List of property values from a potential Node in a specific version.
Note! This method does not escape names (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.
aNodeIdentifier - the identifier (see Node.getIdentifier()) of a potential Node that has a propertyaPropertyName - the name of the propertyaPropertyName as String.
If the property is single valued a list with one element is returned. If no node or property exists, null is returned.List<String> getStrings(String aNodeIdentifier, String aPropertyName, List<String> aDefaultValue)
List of property values from a potential Node in a specific version - with a fallback value if the property doesn't exist.
Note! This method does not escape names (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.
aNodeIdentifier - the identifier (see Node.getIdentifier()) of a potential Node that has a propertyaPropertyName - the name of the propertyaDefaultValue - fallback value if no value existsaPropertyName as String.
If the property is single valued a list with one element is returned.
If no node or property exists, aDefaultValue is returned.List<String> getNestedStrings(String aNodeIdentifier, String aNodePropertyName, String aPropertyName)
List of property values from a potential "nested" Node's property in a specific version.
(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.
aNodeIdentifier - the identifier (see Node.getIdentifier()) of a potential Node that has a propertyaNodePropertyName - the name of the "inner/nested" Node that is a property on aNodeaPropertyName - the name of the property for the "inner/nested" NodeaPropertyName as String.
If the property is single valued a list with one element is returned. If no node or property exists, null is returned.List<String> getNestedStrings(String aNodeIdentifier, String aNodePropertyName, String aPropertyName, List<String> aDefaultValue)
List of property values from a potential "nested" Node's property in a specific version
- 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.
aNodeIdentifier - the identifier (see Node.getIdentifier()) of a potential Node that has a propertyaNodePropertyName - 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 existsaPropertyName as String.
If the property is single valued a list with one element is returned.
If no node or property exists, aDefaultValue is returned.int getInt(String aNodeIdentifier, String aPropertyName)
Note! This method does not escape names (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.
aNodeIdentifier - the identifier (see Node.getIdentifier()) of a potential Node that has a propertyaPropertyName - the name of the propertyint value for aPropertyName.
If no node or property exists or it isn't compatible with an int, 0 is returned.int getInt(String aNodeIdentifier, String aPropertyName, int aDefaultValue)
Note! This method does not escape names (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.
aNodeIdentifier - the identifier (see Node.getIdentifier()) of a potential Node that has a propertyaPropertyName - the name of the propertyaDefaultValue - fallback value if no value existsint value for aPropertyName.
If no node or property exists or it isn't compatible with an int, aDefaultValue is returned.boolean getBoolean(String aNodeIdentifier, String aPropertyName)
Note! This method does not escape names (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.
aNodeIdentifier - the identifier (see Node.getIdentifier()) of a potential Node that has a propertyaPropertyName - the name of the propertyaPropertyName as boolean.
If no node or property exists or it isn't compatible with a boolean, false is returned.boolean getBoolean(String aNodeIdentifier, String aPropertyName, boolean aDefaultValue)
Note! This method does not escape names (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.
aNodeIdentifier - the identifier (see Node.getIdentifier()) of a potential Node that has a propertyaPropertyName - the name of the propertyaDefaultValue - fallback value if no value existsaPropertyName as boolean.
If no node or property exists or it isn't compatible with a boolean, aDefaultValue is returned.Calendar getCalendar(String aNodeIdentifier, String aPropertyName)
Note! This method does not escape names (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.
aNodeIdentifier - the identifier (see Node.getIdentifier()) of a potential Node that has a propertyaPropertyName - the name of the propertyaPropertyName as Calendar.
If no node or property exists or it isn't a Calendar, null is returned.Calendar getCalendar(String aNodeIdentifier, String aPropertyName, Calendar aDefaultValue)
Note! This method does not escape names (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.
aNodeIdentifier - the identifier (see Node.getIdentifier()) of a potential Node that has a propertyaPropertyName - the name of the propertyaDefaultValue - fallback value if no value existsaPropertyName as Calendar.
If no node or property exists or it isn't compatible with a Calendar, aDefaultValue is returned.double getDouble(String aNodeIdentifier, String aPropertyName)
Note! This method does not escape names (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.
aNodeIdentifier - the identifier (see Node.getIdentifier()) of a potential Node that has a propertyaPropertyName - the name of the propertyaPropertyName as double.
If no node or property exists or it isn't a double, 0.0 is returned.double getDouble(String aNodeIdentifier, String aPropertyName, double aDefaultValue)
Note! This method does not escape names (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.
aNodeIdentifier - the identifier (see Node.getIdentifier()) of a potential Node that has a propertyaPropertyName - the name of the propertyaDefaultValue - fallback value if no value existsaPropertyName as double.
If no node or property exists or it isn't compatible with a double, aDefaultValue is returned.Binary getBinary(String aNodeIdentifier, 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 names (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.
aNodeIdentifier - the identifier (see Node.getIdentifier()) of a potential Node that has a propertyaPropertyName - the name of the propertyaPropertyName as Binary.
If no node or property exists or it isn't a Binary, null is returned.Binary getBinary(String aNodeIdentifier, 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 names (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.
aNodeIdentifier - the identifier (see Node.getIdentifier()) of a potential Node that has a propertyaPropertyName - the name of the propertyaDefaultValue - fallback value if no value existsaPropertyName as Binary.
if no node or property exists or it isn't compatible with a Binary, aDefaultValue is returned.boolean hasProperty(String aNodeIdentifier, String aPropertyName)
Note! This method does not escape names (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.
aNodeIdentifier - the identifier (see Node.getIdentifier()) of a potential 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.