com.webmethods.caf.jcr.faces.data
Class JcrNodeProvider

java.lang.Object
  extended by com.webmethods.caf.faces.bean.PageFlowScopeAdapter
      extended by com.webmethods.caf.jcr.faces.data.JcrNodeProvider
All Implemented Interfaces:
IPageFlowScopeAdapter, IContentProvider, IUpdateableContentProvider, Serializable

public class JcrNodeProvider
extends PageFlowScopeAdapter
implements IUpdateableContentProvider, Serializable

IUpdatableContentProvider implementation that wraps a JCR Node for codeless manipulation of a JCR node.

Since:
8.0
See Also:
Serialized Form

Field Summary
protected  Session jcrSession
          Reference to the active JCR session
protected  Node node
          Reference to the JCR node being wrapped
protected  String nodeId
          The node id of the JCR node
protected  String nodePath
          The node path of the JCR node
 
Fields inherited from class com.webmethods.caf.faces.bean.PageFlowScopeAdapter
fExpireWithPageFlow
 
Constructor Summary
JcrNodeProvider()
           
 
Method Summary
 Session getJcrSession()
          Returns the active JCR session
 Node getNode()
          Returns a reference to the JCR Node.
 String getNodeId()
          Returns the id of the JCR node
 String getNodePath()
          Returns the path of the JCR node
 Object[] getPropertyKeys()
          Returns list of properties supported by this content provider.
 Class getType(Object propertyKey)
          Returns java type of the given property
 Object getValue(Object propertyKey)
          Returns value of the given property
 boolean hasProperty(Object propertyKey)
          Checks if the given property is supported by this content provider
 boolean isReadOnly(Object propertyKey)
          Returns true if the given property is readonly.
 void setJcrSession(Session jcrSession)
          Sets the active JCR session
 void setNodeId(String id)
          Sets the id of the JCR node
 void setNodePath(String path)
          Sets the path of the JCR Node to use.
 void setValue(Object propertyKey, Object value)
          Sets new value of the given property
 
Methods inherited from class com.webmethods.caf.faces.bean.PageFlowScopeAdapter
getExpireWithPageFlow, setExpireWithPageFlow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.webmethods.caf.faces.data.IContentProvider
toString
 

Field Detail

jcrSession

protected transient Session jcrSession
Reference to the active JCR session


node

protected transient Node node
Reference to the JCR node being wrapped


nodeId

protected String nodeId
The node id of the JCR node


nodePath

protected String nodePath
The node path of the JCR node

Constructor Detail

JcrNodeProvider

public JcrNodeProvider()
Method Detail

getNodeId

public String getNodeId()
Returns the id of the JCR node

Returns:
the UUID of the JCR node

setNodeId

public void setNodeId(String id)
Sets the id of the JCR node

Parameters:
id - the uuid of the JCR node to use

setNodePath

public void setNodePath(String path)
Sets the path of the JCR Node to use. NOTE: if an Id is supplied, the path is not used.

Parameters:
path - the path of the JCR node to use

getNodePath

public String getNodePath()
Returns the path of the JCR node

Returns:
the path of the JCR node being used

getJcrSession

public Session getJcrSession()
Returns the active JCR session

Returns:
the JCR Session

setJcrSession

public void setJcrSession(Session jcrSession)
Sets the active JCR session

Parameters:
jcrSession - the JCR session to use

getNode

public Node getNode()
Returns a reference to the JCR Node.

Returns:
the JCR Node

getPropertyKeys

public Object[] getPropertyKeys()
Description copied from interface: IContentProvider
Returns list of properties supported by this content provider. Can return Object[0], never null.

Specified by:
getPropertyKeys in interface IContentProvider
Returns:
array of property keys which is typically of type String or Integer

hasProperty

public boolean hasProperty(Object propertyKey)
Description copied from interface: IContentProvider
Checks if the given property is supported by this content provider

Specified by:
hasProperty in interface IContentProvider
Parameters:
propertyKey - property key of type String or Integer
Returns:
true if property is supported

getType

public Class getType(Object propertyKey)
              throws PropertyNotFoundException
Description copied from interface: IContentProvider
Returns java type of the given property

Specified by:
getType in interface IContentProvider
Parameters:
propertyKey - the property key of type String or Integer
Returns:
property java Class
Throws:
PropertyNotFoundException - if property is not supported

getValue

public Object getValue(Object propertyKey)
                throws EvaluationException,
                       PropertyNotFoundException
Description copied from interface: IContentProvider
Returns value of the given property

Specified by:
getValue in interface IContentProvider
Parameters:
propertyKey - the property key of type String or Integer
Returns:
value of the property, can be null
Throws:
EvaluationException - if error during property evaluation
PropertyNotFoundException - if property is not supported

isReadOnly

public boolean isReadOnly(Object propertyKey)
                   throws EvaluationException,
                          PropertyNotFoundException
Description copied from interface: IUpdateableContentProvider

Returns true if the given property is readonly. If it is readonly, IUpdateableContentProvider.setValue(Object, Object) will definitely fail.

Specified by:
isReadOnly in interface IUpdateableContentProvider
Parameters:
propertyKey - property key of type String or Integer
Returns:
true if the property is readonly
Throws:
EvaluationException
PropertyNotFoundException

setValue

public void setValue(Object propertyKey,
                     Object value)
              throws EvaluationException,
                     PropertyNotFoundException
Description copied from interface: IUpdateableContentProvider

Sets new value of the given property

Specified by:
setValue in interface IUpdateableContentProvider
Parameters:
propertyKey - property key of type String or Integer
value - new property value
Throws:
EvaluationException - if error happens during property assigment
PropertyNotFoundException - if property is not found