info.magnolia.cms.core
Class AbstractNodeData

java.lang.Object
  extended by info.magnolia.cms.core.AbstractNodeData
All Implemented Interfaces:
NodeData, Cloneable
Direct Known Subclasses:
BinaryNodeData, DefaultNodeData, NonExistingNodeData

public abstract class AbstractNodeData
extends Object
implements NodeData

Implementing some default behavior.

Version:
$Id$
Author:
pbaerfuss

Field Summary
protected  String name
           
protected  Content parent
           
 
Fields inherited from interface info.magnolia.cms.core.NodeData
MULTIVALUE_FALSE, MULTIVALUE_TRUE, MULTIVALUE_UNDEFINED
 
Constructor Summary
protected AbstractNodeData(Content parent, String name)
           
 
Method Summary
 String getAttribute(String name)
          get attribute, available only if NodeData is of type Binary.
 Collection<String> getAttributeNames()
          get all attribute names.
protected abstract  Content getContentFromJCRReference()
          Specific implementation for retrieving the referenced node when using a property of type REFERENCE.
 String getHandle()
          get a handle representing path relative to the content repository.
 HierarchyManager getHierarchyManager()
           
 String getName()
           
 Content getParent()
          returns Parent node.
 Content getReferencedContent()
          Returns the Content that this NodeData references (if its type is PropertyType.REFERENCE).
protected  Content getReferencedContent(HierarchyManager hm)
           
 Content getReferencedContent(String repositoryId)
          Same as NodeData.getReferencedContent() but achieves the referenced node from a different workspace.
 String getString(String lineBreak)
          Returns the String representation of the value: decodes like breaks with the specified regular expression.
 boolean isGranted(long permissions)
          checks for the allowed access rights.
 int isMultiValue()
          for multi-value controls.
 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 setParent(Content parent)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface info.magnolia.cms.core.NodeData
delete, getBoolean, getContentLength, getDate, getDouble, getJCRProperty, getLong, getStream, getString, getType, getValue, getValues, isExist, refresh, save, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue
 

Field Detail

name

protected String name

parent

protected Content parent
Constructor Detail

AbstractNodeData

protected AbstractNodeData(Content parent,
                           String name)
Method Detail

getHierarchyManager

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

getName

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

getHandle

public 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

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.

getString

public String getString(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

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

setParent

public void setParent(Content parent)

getReferencedContent

public Content getReferencedContent(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

getReferencedContent

public Content getReferencedContent()
                             throws 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

protected Content getReferencedContent(HierarchyManager hm)
                                throws javax.jcr.PathNotFoundException,
                                       javax.jcr.RepositoryException
Throws:
javax.jcr.PathNotFoundException
javax.jcr.RepositoryException

getContentFromJCRReference

protected abstract Content getContentFromJCRReference()
                                               throws javax.jcr.RepositoryException
Specific implementation for retrieving the referenced node when using a property of type REFERENCE.

Throws:
javax.jcr.RepositoryException

isMultiValue

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

Specified by:
isMultiValue in interface NodeData
Returns:

getAttribute

public String getAttribute(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 Collection<String> 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

setAttribute

public void setAttribute(String name,
                         String value)
                  throws javax.jcr.RepositoryException,
                         AccessDeniedException,
                         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
UnsupportedOperationException - if its not a Binary type

setAttribute

public void setAttribute(String name,
                         Calendar value)
                  throws javax.jcr.RepositoryException,
                         AccessDeniedException,
                         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
UnsupportedOperationException - if its not a Binary type

toString

public String toString()
Overrides:
toString in class Object


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