info.magnolia.cms.core
Class BinaryNodeData

java.lang.Object
  extended by info.magnolia.cms.core.AbstractNodeData
      extended by info.magnolia.cms.core.BinaryNodeData
All Implemented Interfaces:
NodeData, Cloneable

public class BinaryNodeData
extends AbstractNodeData

A node data hiding the fact that node datas of type BINARY are stored as nodes of type ItemType.NT_RESOURCE.

Version:
$Id$
Author:
pbaerfuss

Field Summary
 
Fields inherited from class info.magnolia.cms.core.AbstractNodeData
name
 
Fields inherited from interface info.magnolia.cms.core.NodeData
MULTIVALUE_FALSE, MULTIVALUE_TRUE, MULTIVALUE_UNDEFINED
 
Constructor Summary
protected BinaryNodeData(Content parent, String name)
           
 
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.
protected  javax.jcr.Node getBinaryNode(boolean createIfNotExisting)
           
 boolean getBoolean()
          Returns the boolean representation of the value.
protected  Content getContentFromJCRReference()
          Specific implementation for retrieving the referenced node when using a property of type REFERENCE.
 long getContentLength()
          returns size in bytes.
 Calendar getDate()
          Returns the Calendar representation of the value.
 double getDouble()
          Returns the double representation of the value.
 javax.jcr.Property getJCRProperty()
          Access to property at the JCR level.
 long getLong()
          Returns the long representation of the value.
 Content getReferencedContent()
          Returns the Content that this NodeData references (if its type is PropertyType.REFERENCE).
 Content getReferencedContent(String repositoryId)
          Same as NodeData.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.
 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.
 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[].
 
Methods inherited from class info.magnolia.cms.core.AbstractNodeData
getHandle, getHierarchyManager, getName, getParent, getReferencedContent, getString, isGranted, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BinaryNodeData

protected BinaryNodeData(Content parent,
                         String name)
Method Detail

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!

Returns:
Property

getBinaryNode

protected javax.jcr.Node getBinaryNode(boolean createIfNotExisting)

isExist

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

Returns:
boolean

getStream

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

Returns:
boolean

setValue

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

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

delete

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

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
Overrides:
setAttribute in class AbstractNodeData
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
Overrides:
setAttribute in class AbstractNodeData
Throws:
javax.jcr.RepositoryException
AccessDeniedException
UnsupportedOperationException - if its not a Binary type

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
Overrides:
getAttribute in class AbstractNodeData
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
Overrides:
getAttributeNames in class AbstractNodeData
Returns:
collection of attribute names
Throws:
javax.jcr.RepositoryException

getType

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

Returns:
PropertyType

getValue

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

Returns:
Value

getContentLength

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

Returns:
content length

isMultiValue

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

Specified by:
isMultiValue in interface NodeData
Overrides:
isMultiValue in class AbstractNodeData
Returns:

refresh

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

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.

Throws:
javax.jcr.RepositoryException

getReferencedContent

public Content getReferencedContent()
                             throws 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
Overrides:
getReferencedContent in class AbstractNodeData
Throws:
javax.jcr.RepositoryException

getReferencedContent

public Content getReferencedContent(String repositoryId)
                             throws 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
Overrides:
getReferencedContent in class AbstractNodeData
Throws:
javax.jcr.RepositoryException

getContentFromJCRReference

protected Content getContentFromJCRReference()
                                      throws javax.jcr.RepositoryException
Description copied from class: AbstractNodeData
Specific implementation for retrieving the referenced node when using a property of type REFERENCE.

Specified by:
getContentFromJCRReference in class AbstractNodeData
Throws:
javax.jcr.RepositoryException

getString

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

Returns:
String

getDate

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

Returns:
Calendar

getBoolean

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

Returns:
boolean

getDouble

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

Returns:
double

getLong

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

Returns:
long

getValues

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

Returns:
Value[]

setValue

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

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

setValue

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

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

setValue

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

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

setValue

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

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

setValue

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

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

setValue

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

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

setValue

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

Throws:
javax.jcr.RepositoryException

setValue

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

Throws:
javax.jcr.RepositoryException

setValue

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

Throws:
javax.jcr.RepositoryException


Copyright © 2003–2014 Magnolia International Ltd.. All rights reserved.