info.magnolia.cms.util
Class NodeDataWrapper

java.lang.Object
  extended by info.magnolia.cms.util.NodeDataWrapper
All Implemented Interfaces:
NodeData, java.lang.Cloneable
Direct Known Subclasses:
HTMLEncodingNodeDataWrapper, LazyNodeDataWrapper

public abstract class NodeDataWrapper
extends java.lang.Object
implements NodeData

Wraps a NodeData to which it delegates. Used to manipulate node datas.

Version:
$Id: NodeDataWrapper.java 47808 2011-07-28 09:16:08Z had $

Field Summary
 
Fields inherited from interface info.magnolia.cms.core.NodeData
MULTIVALUE_FALSE, MULTIVALUE_TRUE, MULTIVALUE_UNDEFINED
 
Constructor Summary
NodeDataWrapper()
           
NodeDataWrapper(NodeData wrappedNodeData)
           
 
Method Summary
 void delete()
          Remove this path.
 java.lang.String getAttribute(java.lang.String name)
          get attribute, available only if NodeData is of type Binary.
 java.util.Collection getAttributeNames()
          get all attribute names.
 boolean getBoolean()
          Returns the boolean representation of the value.
 long getContentLength()
          returns size in bytes.
 java.util.Calendar getDate()
          Returns the Calendar representation of the value.
 double getDouble()
          Returns the double representation of the value.
 java.lang.String getHandle()
          get a handle representing path relative to the content repository.
 HierarchyManager getHierarchyManager()
           
 javax.jcr.Property getJCRProperty()
          Access to property at the JCR level.
 long getLong()
          Returns the long representation of the value.
 java.lang.String getName()
           
 Content getParent()
          returns Parent node.
 Content getReferencedContent()
          Returns the Content that this NodeData references (if its type is PropertyType.REFERENCE).
 Content getReferencedContent(java.lang.String repositoryId)
          Same as NodeData.getReferencedContent() but achieves the referenced node from a different workspace.
 java.io.InputStream getStream()
          Returns the InputStream representation of the value.
 java.lang.String getString()
          Returns the String representation of the value.
 java.lang.String getString(java.lang.String lineBreak)
          Returns the String representation of the value: decodes like breaks with the specified regular expression.
 int getType()
          Returns the type of this NodeData.
 javax.jcr.Value getValue()
          Returns the value of this NodeData.
 javax.jcr.Value[] getValues()
          For multi-value properties.
 NodeData getWrappedNodeData()
           
 boolean isExist()
          checks if the atom exists in the repository.
 boolean isGranted(long permissions)
          checks for the allowed access rights.
 int isMultiValue()
          for multi-value controls.
 void refresh(boolean keepChanges)
          Refreshes current node keeping all changes.
 void save()
          Persists all changes to the repository if validation succeeds.
 void setAttribute(java.lang.String name, java.util.Calendar value)
          set attribute, available only if NodeData is of type Binary.
 void setAttribute(java.lang.String name, java.lang.String value)
          set attribute, available only if NodeData is of type Binary.
 void setValue(boolean value)
          set value of type boolean.
 void setValue(java.util.Calendar value)
          set value of type Calendar.
 void setValue(Content value)
          Sets a reference value.
 void setValue(double value)
          set value of type double.
 void setValue(java.io.InputStream value)
          set value of type InputStream.
 void setValue(int value)
          set value of type int.
 void setValue(long value)
          set value of type long.
 void setValue(java.lang.String value)
          set value of type String.
 void setValue(javax.jcr.Value value)
          set value of type Value.
 void setValue(javax.jcr.Value[] value)
          set value of type Value[].
 void setWrappedNodeData(NodeData wrappedNodeData)
           
 java.lang.String toString()
           
protected  Content wrap(Content content)
          Default implementation of content wrapping for cases where NodeData needs to return content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NodeDataWrapper

public NodeDataWrapper()

NodeDataWrapper

public NodeDataWrapper(NodeData wrappedNodeData)
Method Detail

getWrappedNodeData

public NodeData getWrappedNodeData()

setWrappedNodeData

public void setWrappedNodeData(NodeData wrappedNodeData)

wrap

protected Content wrap(Content content)
Default implementation of content wrapping for cases where NodeData needs to return content.

Parameters:
content -
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

delete

public void delete()
            throws javax.jcr.RepositoryException
Description copied from interface: NodeData
Remove this path.

Specified by:
delete in interface NodeData
Throws:
javax.jcr.RepositoryException

getAttribute

public java.lang.String getAttribute(java.lang.String name)
Description copied from interface: NodeData
get attribute, available only if NodeData is of type Binary.

Specified by:
getAttribute in interface NodeData
Returns:
string value

getAttributeNames

public java.util.Collection getAttributeNames()
                                       throws javax.jcr.RepositoryException
Description copied from interface: NodeData
get all attribute names.

Specified by:
getAttributeNames in interface NodeData
Returns:
collection of attribute names
Throws:
javax.jcr.RepositoryException

getBoolean

public boolean getBoolean()
Description copied from interface: NodeData
Returns the boolean representation of the value.

Specified by:
getBoolean in interface NodeData
Returns:
boolean

getContentLength

public long getContentLength()
Description copied from interface: NodeData
returns size in bytes.

Specified by:
getContentLength in interface NodeData
Returns:
content length

getDate

public java.util.Calendar getDate()
Description copied from interface: NodeData
Returns the Calendar representation of the value.

Specified by:
getDate in interface NodeData
Returns:
Calendar

getDouble

public double getDouble()
Description copied from interface: NodeData
Returns the double representation of the value.

Specified by:
getDouble in interface NodeData
Returns:
double

getHandle

public java.lang.String getHandle()
Description copied from interface: NodeData
get a handle representing path relative to the content repository.

Specified by:
getHandle in interface NodeData
Returns:
String representing path (handle) of the content

getHierarchyManager

public HierarchyManager getHierarchyManager()
Specified by:
getHierarchyManager in interface NodeData

getJCRProperty

public javax.jcr.Property getJCRProperty()
Description copied from interface: NodeData
Access to property at the JCR level. Available only to be available, should not be used in normal circumstances!

Specified by:
getJCRProperty in interface NodeData
Returns:
Property

getLong

public long getLong()
Description copied from interface: NodeData
Returns the long representation of the value.

Specified by:
getLong in interface NodeData
Returns:
long

getName

public java.lang.String getName()
Specified by:
getName in interface NodeData
Returns:
atom name

getParent

public Content getParent()
                  throws AccessDeniedException,
                         javax.jcr.ItemNotFoundException,
                         javax.jcr.AccessDeniedException,
                         javax.jcr.RepositoryException
Description copied from interface: NodeData
returns Parent node.

Specified by:
getParent in interface NodeData
Throws:
AccessDeniedException
javax.jcr.ItemNotFoundException
javax.jcr.RepositoryException

getReferencedContent

public Content getReferencedContent()
                             throws javax.jcr.RepositoryException,
                                    javax.jcr.PathNotFoundException,
                                    javax.jcr.RepositoryException
Description copied from interface: NodeData
Returns the Content that this NodeData references (if its type is PropertyType.REFERENCE). If it is of type PATH or STRING it tries to resolve the node by using the path. The path can be relative or absolute. If the property type is STRING, it tries finally to get the node by using the value as an uuid.

Specified by:
getReferencedContent in interface NodeData
Throws:
javax.jcr.RepositoryException
javax.jcr.PathNotFoundException

getReferencedContent

public Content getReferencedContent(java.lang.String repositoryId)
                             throws javax.jcr.PathNotFoundException,
                                    javax.jcr.RepositoryException
Description copied from interface: NodeData
Same as NodeData.getReferencedContent() but achieves the referenced node from a different workspace.

Specified by:
getReferencedContent in interface NodeData
Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException

getStream

public java.io.InputStream getStream()
Description copied from interface: NodeData
Returns the InputStream representation of the value.

Specified by:
getStream in interface NodeData
Returns:
boolean

getString

public java.lang.String getString()
Description copied from interface: NodeData
Returns the String representation of the value.

Specified by:
getString in interface NodeData
Returns:
String

getString

public java.lang.String getString(java.lang.String lineBreak)
Description copied from interface: NodeData
Returns the String representation of the value: decodes like breaks with the specified regular expression.

Specified by:
getString in interface NodeData
Parameters:
lineBreak - , regular expression
Returns:
String

getType

public int getType()
Description copied from interface: NodeData
Returns the type of this NodeData. One of:

Specified by:
getType in interface NodeData
Returns:
PropertyType

getValue

public javax.jcr.Value getValue()
Description copied from interface: NodeData
Returns the value of this NodeData. One of type:

Specified by:
getValue in interface NodeData
Returns:
Value

getValues

public javax.jcr.Value[] getValues()
Description copied from interface: NodeData
For multi-value properties.

Specified by:
getValues in interface NodeData
Returns:
Value[]

isExist

public boolean isExist()
Description copied from interface: NodeData
checks if the atom exists in the repository.

Specified by:
isExist in interface NodeData
Returns:
boolean

isGranted

public boolean isGranted(long permissions)
Description copied from interface: NodeData
checks for the allowed access rights.

Specified by:
isGranted in interface NodeData
Parameters:
permissions - as defined in javax.jcr.Permission
Returns:
true is the current user has specified access on this node.

isMultiValue

public int isMultiValue()
Description copied from interface: NodeData
for multi-value controls.

Specified by:
isMultiValue in interface NodeData
Returns:

refresh

public void refresh(boolean keepChanges)
             throws javax.jcr.RepositoryException
Description copied from interface: NodeData
Refreshes current node keeping all changes.

Specified by:
refresh in interface NodeData
Throws:
javax.jcr.RepositoryException
See Also:
Item.refresh(boolean)

save

public void save()
          throws javax.jcr.RepositoryException
Description copied from interface: NodeData
Persists all changes to the repository if validation succeeds.

Specified by:
save in interface NodeData
Throws:
javax.jcr.RepositoryException

setAttribute

public void setAttribute(java.lang.String name,
                         java.util.Calendar value)
                  throws javax.jcr.RepositoryException,
                         AccessDeniedException,
                         java.lang.UnsupportedOperationException
Description copied from interface: NodeData
set attribute, available only if NodeData is of type Binary.

Specified by:
setAttribute in interface NodeData
Throws:
javax.jcr.RepositoryException
AccessDeniedException
java.lang.UnsupportedOperationException - if its not a Binary type

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
                  throws javax.jcr.RepositoryException,
                         AccessDeniedException,
                         java.lang.UnsupportedOperationException
Description copied from interface: NodeData
set attribute, available only if NodeData is of type Binary.

Specified by:
setAttribute in interface NodeData
Throws:
javax.jcr.RepositoryException
AccessDeniedException
java.lang.UnsupportedOperationException - if its not a Binary type

setValue

public void setValue(boolean value)
              throws javax.jcr.RepositoryException,
                     AccessDeniedException
Description copied from interface: NodeData
set value of type boolean.

Specified by:
setValue in interface NodeData
Parameters:
value - , boolean value to be set
Throws:
javax.jcr.RepositoryException
AccessDeniedException

setValue

public void setValue(java.util.Calendar value)
              throws javax.jcr.RepositoryException,
                     AccessDeniedException
Description copied from interface: NodeData
set value of type Calendar.

Specified by:
setValue in interface NodeData
Parameters:
value - , Calendar value to be set
Throws:
javax.jcr.RepositoryException
AccessDeniedException

setValue

public void setValue(double value)
              throws javax.jcr.RepositoryException,
                     AccessDeniedException
Description copied from interface: NodeData
set value of type double.

Specified by:
setValue in interface NodeData
Parameters:
value - , double value to be set
Throws:
javax.jcr.RepositoryException
AccessDeniedException

setValue

public void setValue(java.io.InputStream value)
              throws javax.jcr.RepositoryException,
                     AccessDeniedException
Description copied from interface: NodeData
set value of type InputStream.

Specified by:
setValue in interface NodeData
Parameters:
value - , InputStream to be set
Throws:
javax.jcr.RepositoryException
AccessDeniedException

setValue

public void setValue(int value)
              throws javax.jcr.RepositoryException,
                     AccessDeniedException
Description copied from interface: NodeData
set value of type int.

Specified by:
setValue in interface NodeData
Parameters:
value - , int value to be set
Throws:
javax.jcr.RepositoryException
AccessDeniedException

setValue

public void setValue(long value)
              throws javax.jcr.RepositoryException,
                     AccessDeniedException
Description copied from interface: NodeData
set value of type long.

Specified by:
setValue in interface NodeData
Parameters:
value - , long value to be set
Throws:
javax.jcr.RepositoryException
AccessDeniedException

setValue

public void setValue(java.lang.String value)
              throws javax.jcr.RepositoryException,
                     AccessDeniedException
Description copied from interface: NodeData
set value of type String.

Specified by:
setValue in interface NodeData
Parameters:
value - , string to be set
Throws:
javax.jcr.RepositoryException
AccessDeniedException

setValue

public void setValue(Content value)
              throws javax.jcr.RepositoryException,
                     AccessDeniedException
Description copied from interface: NodeData
Sets a reference value.

Specified by:
setValue in interface NodeData
Throws:
javax.jcr.RepositoryException
AccessDeniedException

setValue

public void setValue(javax.jcr.Value value)
              throws javax.jcr.RepositoryException,
                     AccessDeniedException
Description copied from interface: NodeData
set value of type Value.

Specified by:
setValue in interface NodeData
Throws:
javax.jcr.RepositoryException
AccessDeniedException

setValue

public void setValue(javax.jcr.Value[] value)
              throws javax.jcr.RepositoryException,
                     AccessDeniedException
Description copied from interface: NodeData
set value of type Value[].

Specified by:
setValue in interface NodeData
Throws:
javax.jcr.RepositoryException
AccessDeniedException


Copyright © 2003-2011 Magnolia International Ltd.. All Rights Reserved.