org.hippoecm.hst.provider.jcr
Class JCRValueProviderImpl

java.lang.Object
  extended by org.hippoecm.hst.provider.jcr.JCRValueProviderImpl
All Implemented Interfaces:
Serializable, JCRValueProvider, ValueProvider

public class JCRValueProviderImpl
extends Object
implements JCRValueProvider

See Also:
Serialized Form

Constructor Summary
JCRValueProviderImpl(javax.jcr.Node jcrNode)
           
JCRValueProviderImpl(javax.jcr.Node jcrNode, boolean lazyLoading)
          if lazyLoading is false, we'll actively fill all the properties of the jcr node in the properties map and fetch the canonical path
 
Method Summary
 void detach()
          Method for detaching the jcr node.
 void flush()
          Flushes all fetched data kept in instance variables
 Boolean getBoolean(String propertyName)
          Returns the boolean value of a node property
 Boolean[] getBooleans(String propertyName)
          Returns boolean array of the boolean values of a node property
 String getCanonicalPath()
          The canonical path can be a different location then ValueProvider.getPath() because the latter might give some virtual / mirrored path of the value provider
 Calendar getDate(String propertyName)
          Returns the Calendar value of a node property.
 Calendar[] getDates(String propertyName)
          Returns Calendar array of the Calendar values of a node property.
 Double getDouble(String propertyName)
          Returns the double value of a node property.
 Double[] getDoubles(String propertyName)
          Returns double array of the long values of a node property.
 String getIdentifier()
          We return the uuid of the jcr node.
 javax.jcr.Node getJcrNode()
          returns the Node that was used to create this value provider with or null when the node is already detached
 String getLocalizedName()
           
 Long getLong(String propertyName)
          Returns the long value of a node property.
 Long[] getLongs(String propertyName)
          Returns long array of the long values of a node property.
 String getName()
           
 javax.jcr.Node getParentJcrNode()
          returns the parent Node of this value provider or null when the node is detached.
 String getPath()
           
 Map<String,Object> getProperties()
          Returns all combined properties that are of type String, boolean, int, long, double or Calendar in a Map.
 PropertyMap getPropertyMap()
          Returns all combined properties that are of type String, boolean, int, long, double or Calendar in a PropertyMap.
 String getString(String propertyName)
          Returns the string value of a node property
 String[] getStrings(String propertyName)
          Returns String array of string values of a node property
 boolean hasProperty(String propertyName)
          Method returning true when the jcr node has the property
 boolean isDetached()
          Test whether the jcr node is detached or not
 boolean isNodeType(String nodeType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JCRValueProviderImpl

public JCRValueProviderImpl(javax.jcr.Node jcrNode)

JCRValueProviderImpl

public JCRValueProviderImpl(javax.jcr.Node jcrNode,
                            boolean lazyLoading)
if lazyLoading is false, we'll actively fill all the properties of the jcr node in the properties map and fetch the canonical path

Parameters:
jcrNode -
lazyLoading -
Method Detail

getJcrNode

public javax.jcr.Node getJcrNode()
Description copied from interface: JCRValueProvider
returns the Node that was used to create this value provider with or null when the node is already detached

Specified by:
getJcrNode in interface JCRValueProvider
Returns:
the jcr node

getParentJcrNode

public javax.jcr.Node getParentJcrNode()
Description copied from interface: JCRValueProvider
returns the parent Node of this value provider or null when the node is detached. If the node is the jcr rootNode, null will be returned

Specified by:
getParentJcrNode in interface JCRValueProvider
Returns:
the parent Node or null if the node is null or there is no parent

detach

public void detach()
Description copied from interface: JCRValueProvider
Method for detaching the jcr node. After calling this method, the jcr node is not available anymore

Specified by:
detach in interface JCRValueProvider

isDetached

public boolean isDetached()
Description copied from interface: JCRValueProvider
Test whether the jcr node is detached or not

Specified by:
isDetached in interface JCRValueProvider
Returns:
true if the node is detached

getName

public String getName()
Specified by:
getName in interface ValueProvider
Returns:
the name of the object used to create this valueprovider with

getLocalizedName

public String getLocalizedName()
Specified by:
getLocalizedName in interface JCRValueProvider
Returns:
the locallized name of the backing jcr node according HippoNode.getLocalizedName()

getPath

public String getPath()
Specified by:
getPath in interface ValueProvider
Returns:
the path of the object used to create this valueprovider with

getCanonicalPath

public String getCanonicalPath()
Description copied from interface: ValueProvider
The canonical path can be a different location then ValueProvider.getPath() because the latter might give some virtual / mirrored path of the value provider

Specified by:
getCanonicalPath in interface ValueProvider
Returns:
the canonical path of the object used to create this valueprovider with

getIdentifier

public String getIdentifier()
We return the uuid of the jcr node. If we cannot get the uuid, we return the canonical path

Specified by:
getIdentifier in interface ValueProvider
Returns:
the identifier of the object used to create this valueprovider with

isNodeType

public boolean isNodeType(String nodeType)
Specified by:
isNodeType in interface JCRValueProvider
Returns:
true when the underlying jcr node is of type nodeType

hasProperty

public boolean hasProperty(String propertyName)
Description copied from interface: ValueProvider
Method returning true when the jcr node has the property

Specified by:
hasProperty in interface ValueProvider
Returns:
true if the node has the propertyName

getString

public String getString(String propertyName)
Description copied from interface: ValueProvider
Returns the string value of a node property

Specified by:
getString in interface ValueProvider
Returns:
String value of the node property, or null if the property does not exist, or is multivalued, or is not of type string

getStrings

public String[] getStrings(String propertyName)
Description copied from interface: ValueProvider
Returns String array of string values of a node property

Specified by:
getStrings in interface ValueProvider
Returns:
String[] values of the node property, or an empty string array String[0] if the property does not exist, or is single-valued, or is not of type string

getDouble

public Double getDouble(String propertyName)
Description copied from interface: ValueProvider
Returns the double value of a node property.

Specified by:
getDouble in interface ValueProvider
Returns:
Double value of the node property. If the property does not exist, or is multivalued, or is not of type double, 0 is returned

getDoubles

public Double[] getDoubles(String propertyName)
Description copied from interface: ValueProvider
Returns double array of the long values of a node property.

Specified by:
getDoubles in interface ValueProvider
Returns:
Double array presentation of the node property. If the property does not exist, or is single-valued, or is not of type double, an empty array Double[0] is returned

getLong

public Long getLong(String propertyName)
Description copied from interface: ValueProvider
Returns the long value of a node property.

Specified by:
getLong in interface ValueProvider
Returns:
Long value of the node property. If the property does not exist, or is multivalued, or is not of type long, 0 is returned

getLongs

public Long[] getLongs(String propertyName)
Description copied from interface: ValueProvider
Returns long array of the long values of a node property.

Specified by:
getLongs in interface ValueProvider
Returns:
Long array presentation of the node property. If the property does not exist, or is single-valued, or is not of type long, an empty array Long[0] is returned

getDate

public Calendar getDate(String propertyName)
Description copied from interface: ValueProvider
Returns the Calendar value of a node property.

Specified by:
getDate in interface ValueProvider
Returns:
Calendar value of the node property. If the property does not exist, or is multivalued, or is not of type jcr DATE, null is returned

getDates

public Calendar[] getDates(String propertyName)
Description copied from interface: ValueProvider
Returns Calendar array of the Calendar values of a node property.

Specified by:
getDates in interface ValueProvider
Returns:
Calendar[] of the Calendar values of the node property. If the property does not exist, or is single-valued, or is not of type jcr DATE, an empty array Calendar[0] is returned

getBoolean

public Boolean getBoolean(String propertyName)
Description copied from interface: ValueProvider
Returns the boolean value of a node property

Specified by:
getBoolean in interface ValueProvider
Returns:
Boolean value of the node property. If the property does not exist, or is multivalued, or is not of type boolean, false is returned

getBooleans

public Boolean[] getBooleans(String propertyName)
Description copied from interface: ValueProvider
Returns boolean array of the boolean values of a node property

Specified by:
getBooleans in interface ValueProvider
Returns:
Boolean[] values of the node property. If the property does not exist, or is single-valued, or is not of type boolean, an empty boolean array Boolean[0] is returned

getProperties

public Map<String,Object> getProperties()
Description copied from interface: ValueProvider
Returns all combined properties that are of type String, boolean, int, long, double or Calendar in a Map.

Specified by:
getProperties in interface ValueProvider

getPropertyMap

public PropertyMap getPropertyMap()
Description copied from interface: ValueProvider
Returns all combined properties that are of type String, boolean, int, long, double or Calendar in a PropertyMap.

Specified by:
getPropertyMap in interface ValueProvider

flush

public void flush()
Description copied from interface: JCRValueProvider
Flushes all fetched data kept in instance variables

Specified by:
flush in interface JCRValueProvider


Copyright © 2008-2012 Hippo. All Rights Reserved.