info.magnolia.cms.core
Interface NodeData

All Superinterfaces:
Cloneable
All Known Implementing Classes:
AbstractNodeData, BinaryNodeData, DefaultNodeData, HTMLEncodingNodeDataWrapper, LazyNodeDataWrapper, NodeDataWrapper, NonExistingNodeData, SystemNodeDataWrapper

public interface NodeData
extends Cloneable

Represents a content value object. If the node data does not have any value isExist() returns false. As soon a value is set - null is not considered a value - the node data starts to exist. The various value read methods (getString(), getBoolean(), ..) will always return a value (default or null)

Version:
$Revision: $ ($Author: $)
Author:
gjoseph

Field Summary
static int MULTIVALUE_FALSE
           
static int MULTIVALUE_TRUE
           
static int MULTIVALUE_UNDEFINED
           
 
Method Summary
 void delete()
          Remove this path.
 String getAttribute(String name)
          get attribute, available only if NodeData is of type Binary.
 Collection<String> getAttributeNames()
          get all attribute names.
 boolean getBoolean()
          Returns the boolean representation of the value.
 long getContentLength()
          returns size in bytes.
 Calendar getDate()
          Returns the Calendar representation of the value.
 double getDouble()
          Returns the double representation of the value.
 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.
 String getName()
           
 Content getParent()
          returns Parent node.
 Content getReferencedContent()
          Returns the Content that this NodeData references (if its type is PropertyType.REFERENCE).
 Content getReferencedContent(String repositoryId)
          Same as getReferencedContent() but achieves the referenced node from a different workspace.
 InputStream getStream()
          Returns the InputStream representation of the value.
 String getString()
          Returns the String representation of the value.
 String getString(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.
 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(String name, Calendar value)
          set attribute, available only if NodeData is of type Binary.
 void setAttribute(String name, String value)
          set attribute, available only if NodeData is of type Binary.
 void setValue(boolean value)
          set value of type boolean.
 void setValue(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(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(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[].
 

Field Detail

MULTIVALUE_UNDEFINED

static final int MULTIVALUE_UNDEFINED
See Also:
Constant Field Values

MULTIVALUE_TRUE

static final int MULTIVALUE_TRUE
See Also:
Constant Field Values

MULTIVALUE_FALSE

static final int MULTIVALUE_FALSE
See Also:
Constant Field Values
Method Detail

getValue

javax.jcr.Value getValue()
Returns the value of this NodeData. One of type:

Returns:
Value

getValues

javax.jcr.Value[] getValues()
For multi-value properties.

Returns:
Value[]

getString

String getString(String lineBreak)
Returns the String representation of the value: decodes like breaks with the specified regular expression.

Parameters:
lineBreak - , regular expression
Returns:
String

getString

String getString()
Returns the String representation of the value.

Returns:
String

getLong

long getLong()
Returns the long representation of the value.

Returns:
long

getDouble

double getDouble()
Returns the double representation of the value.

Returns:
double

getDate

Calendar getDate()
Returns the Calendar representation of the value.

Returns:
Calendar

getBoolean

boolean getBoolean()
Returns the boolean representation of the value.

Returns:
boolean

getStream

InputStream getStream()
Returns the InputStream representation of the value.

Returns:
boolean

getReferencedContent

Content getReferencedContent()
                             throws javax.jcr.RepositoryException,
                                    javax.jcr.PathNotFoundException,
                                    javax.jcr.RepositoryException
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.

Throws:
javax.jcr.RepositoryException
javax.jcr.PathNotFoundException

getReferencedContent

Content getReferencedContent(String repositoryId)
                             throws javax.jcr.PathNotFoundException,
                                    javax.jcr.RepositoryException
Same as getReferencedContent() but achieves the referenced node from a different workspace.

Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException

getType

int getType()
Returns the type of this NodeData. One of:

Returns:
PropertyType

getName

String getName()
Returns:
atom name

getContentLength

long getContentLength()
returns size in bytes.

Returns:
content length

getJCRProperty

javax.jcr.Property getJCRProperty()
Access to property at the JCR level. Available only to be available, should not be used in normal circumstances!

Returns:
Property

setValue

void setValue(String value)
              throws javax.jcr.RepositoryException,
                     AccessDeniedException
set value of type String.

Parameters:
value - , string to be set
Throws:
javax.jcr.RepositoryException
AccessDeniedException

setValue

void setValue(int value)
              throws javax.jcr.RepositoryException,
                     AccessDeniedException
set value of type int.

Parameters:
value - , int value to be set
Throws:
javax.jcr.RepositoryException
AccessDeniedException

setValue

void setValue(long value)
              throws javax.jcr.RepositoryException,
                     AccessDeniedException
set value of type long.

Parameters:
value - , long value to be set
Throws:
javax.jcr.RepositoryException
AccessDeniedException

setValue

void setValue(InputStream value)
              throws javax.jcr.RepositoryException,
                     AccessDeniedException
set value of type InputStream.

Parameters:
value - , InputStream to be set
Throws:
javax.jcr.RepositoryException
AccessDeniedException

setValue

void setValue(double value)
              throws javax.jcr.RepositoryException,
                     AccessDeniedException
set value of type double.

Parameters:
value - , double value to be set
Throws:
javax.jcr.RepositoryException
AccessDeniedException

setValue

void setValue(boolean value)
              throws javax.jcr.RepositoryException,
                     AccessDeniedException
set value of type boolean.

Parameters:
value - , boolean value to be set
Throws:
javax.jcr.RepositoryException
AccessDeniedException

setValue

void setValue(Calendar value)
              throws javax.jcr.RepositoryException,
                     AccessDeniedException
set value of type Calendar.

Parameters:
value - , Calendar value to be set
Throws:
javax.jcr.RepositoryException
AccessDeniedException

setValue

void setValue(Content value)
              throws javax.jcr.RepositoryException,
                     AccessDeniedException
Sets a reference value.

Throws:
javax.jcr.RepositoryException
AccessDeniedException

setValue

void setValue(javax.jcr.Value value)
              throws javax.jcr.RepositoryException,
                     AccessDeniedException
set value of type Value.

Parameters:
value -
Throws:
javax.jcr.RepositoryException
AccessDeniedException

setValue

void setValue(javax.jcr.Value[] value)
              throws javax.jcr.RepositoryException,
                     AccessDeniedException
set value of type Value[].

Parameters:
value -
Throws:
javax.jcr.RepositoryException
AccessDeniedException

setAttribute

void setAttribute(String name,
                  String value)
                  throws javax.jcr.RepositoryException,
                         AccessDeniedException,
                         UnsupportedOperationException
set attribute, available only if NodeData is of type Binary.

Parameters:
name -
value -
Throws:
javax.jcr.RepositoryException
AccessDeniedException
UnsupportedOperationException - if its not a Binary type

setAttribute

void setAttribute(String name,
                  Calendar value)
                  throws javax.jcr.RepositoryException,
                         AccessDeniedException,
                         UnsupportedOperationException
set attribute, available only if NodeData is of type Binary.

Parameters:
name -
value -
Throws:
javax.jcr.RepositoryException
AccessDeniedException
UnsupportedOperationException - if its not a Binary type

getAttribute

String getAttribute(String name)
get attribute, available only if NodeData is of type Binary.

Parameters:
name -
Returns:
string value

getAttributeNames

Collection<String> getAttributeNames()
                                     throws javax.jcr.RepositoryException
get all attribute names.

Returns:
collection of attribute names
Throws:
javax.jcr.RepositoryException

isExist

boolean isExist()
checks if the atom exists in the repository.

Returns:
boolean

getHandle

String getHandle()
get a handle representing path relative to the content repository.

Returns:
String representing path (handle) of the content

save

void save()
          throws javax.jcr.RepositoryException
Persists all changes to the repository if validation succeeds.

Throws:
javax.jcr.RepositoryException

isGranted

boolean isGranted(long permissions)
checks for the allowed access rights.

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

delete

void delete()
            throws javax.jcr.RepositoryException
Remove this path.

Throws:
javax.jcr.RepositoryException

refresh

void refresh(boolean keepChanges)
             throws javax.jcr.RepositoryException
Refreshes current node keeping all changes.

Throws:
javax.jcr.RepositoryException
See Also:
Item.refresh(boolean)

isMultiValue

int isMultiValue()
for multi-value controls.

Returns:

getParent

Content getParent()
                  throws AccessDeniedException,
                         javax.jcr.ItemNotFoundException,
                         javax.jcr.AccessDeniedException,
                         javax.jcr.RepositoryException
returns Parent node.

Throws:
AccessDeniedException
javax.jcr.ItemNotFoundException
javax.jcr.RepositoryException

getHierarchyManager

HierarchyManager getHierarchyManager()


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