org.apache.jackrabbit.core
Class PropertyImpl

java.lang.Object
  extended by org.apache.jackrabbit.core.ItemImpl
      extended by org.apache.jackrabbit.core.PropertyImpl
All Implemented Interfaces:
javax.jcr.Item, javax.jcr.Property

public class PropertyImpl
extends ItemImpl
implements javax.jcr.Property

PropertyImpl implements the Property interface.


Field Summary
 
Fields inherited from class org.apache.jackrabbit.core.ItemImpl
id, itemMgr, rep, session, stateMgr, STATUS_DESTROYED, STATUS_INVALIDATED, STATUS_MODIFIED, STATUS_NORMAL
 
Method Summary
 void accept(javax.jcr.ItemVisitor visitor)
          
protected  void checkSetValue(boolean multipleValues)
          Checks various pre-conditions that are common to all setValue() methods.
 boolean getBoolean()
           
 Calendar getDate()
           
 javax.jcr.nodetype.PropertyDefinition getDefinition()
          
 double getDouble()
           
 long getLength()
           
protected  long getLength(InternalValue value)
          Determines the length of the given value.
 long[] getLengths()
           
 long getLong()
           
 String getName()
          
 javax.jcr.Node getNode()
           
protected  ItemState getOrCreateTransientItemState()
           
 javax.jcr.Node getParent()
          
 Name getQName()
          Same as Item.getName() except that this method returns a Name instead of a String.
 InputStream getStream()
           
 String getString()
           
 int getType()
           
 javax.jcr.Value getValue()
           
 javax.jcr.Value[] getValues()
           
 InternalValue internalGetValue()
          Returns the internal value of a single-valued property.
 InternalValue[] internalGetValues()
          Returns the internal values of a multi-valued property.
protected  void internalSetValue(InternalValue[] values, int type)
           
 boolean isNode()
          
protected  void makePersistent()
           
protected  void onRedefine(PropDefId defId)
           
protected  void restoreTransient(PropertyState transientState)
           
 void setValue(boolean value)
           
 void setValue(Calendar value)
           
 void setValue(double value)
           
 void setValue(InputStream value)
           
 void setValue(long value)
           
 void setValue(Name name)
          Same as Property.setValue(String) except that this method takes a Name instead of a String value.
 void setValue(Name[] names)
          Same as Property.setValue(String[]) except that this method takes an array of Name instead of String values.
 void setValue(javax.jcr.Node target)
           
 void setValue(String value)
           
 void setValue(String[] strings)
           
 void setValue(javax.jcr.Value value)
           
 void setValue(javax.jcr.Value[] values)
          
 void setValue(javax.jcr.Value[] values, int valueType)
          Sets the values of this property.
 String toString()
          Return a string representation of this property for diagnostic purposes.
 
Methods inherited from class org.apache.jackrabbit.core.ItemImpl
getAncestor, getDepth, getId, getPath, getPrimaryPath, getSession, internalRemove, isModified, isNew, isSame, isTransactionalNew, isTransient, refresh, remove, safeGetJCRPath, sanityCheck, save, setRemoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.jcr.Item
getAncestor, getDepth, getPath, getSession, isModified, isNew, isSame, refresh, remove, save
 

Method Detail

getOrCreateTransientItemState

protected ItemState getOrCreateTransientItemState()
                                           throws javax.jcr.RepositoryException
Specified by:
getOrCreateTransientItemState in class ItemImpl
Throws:
javax.jcr.RepositoryException

makePersistent

protected void makePersistent()
                       throws javax.jcr.InvalidItemStateException
Specified by:
makePersistent in class ItemImpl
Throws:
javax.jcr.InvalidItemStateException

restoreTransient

protected void restoreTransient(PropertyState transientState)
                         throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

onRedefine

protected void onRedefine(PropDefId defId)
                   throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

getLength

protected long getLength(InternalValue value)
                  throws javax.jcr.RepositoryException
Determines the length of the given value.

Parameters:
value - value whose length should be determined
Returns:
the length of the given value
Throws:
javax.jcr.RepositoryException - if an error occurs
See Also:
Property.getLength(), Property.getLengths()

checkSetValue

protected void checkSetValue(boolean multipleValues)
                      throws javax.jcr.ValueFormatException,
                             javax.jcr.version.VersionException,
                             javax.jcr.lock.LockException,
                             javax.jcr.nodetype.ConstraintViolationException,
                             javax.jcr.RepositoryException
Checks various pre-conditions that are common to all setValue() methods. The checks performed are:

Parameters:
multipleValues - flag indicating whether the property is about to be set to an array of values
Throws:
javax.jcr.ValueFormatException - if a single-valued property is set to an array of values (and vice versa)
javax.jcr.version.VersionException - if the parent node is not checked-out
javax.jcr.lock.LockException - if the parent node is locked by somebody else
javax.jcr.nodetype.ConstraintViolationException - if the property is protected
javax.jcr.RepositoryException - if another error occurs
See Also:
Property.setValue(javax.jcr.Value)

internalSetValue

protected void internalSetValue(InternalValue[] values,
                                int type)
                         throws javax.jcr.nodetype.ConstraintViolationException,
                                javax.jcr.RepositoryException
Parameters:
values -
type -
Throws:
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.RepositoryException

setValue

public void setValue(Name name)
              throws javax.jcr.ValueFormatException,
                     javax.jcr.version.VersionException,
                     javax.jcr.lock.LockException,
                     javax.jcr.nodetype.ConstraintViolationException,
                     javax.jcr.RepositoryException
Same as Property.setValue(String) except that this method takes a Name instead of a String value.

Parameters:
name -
Throws:
javax.jcr.ValueFormatException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.RepositoryException

setValue

public void setValue(Name[] names)
              throws javax.jcr.ValueFormatException,
                     javax.jcr.version.VersionException,
                     javax.jcr.lock.LockException,
                     javax.jcr.nodetype.ConstraintViolationException,
                     javax.jcr.RepositoryException
Same as Property.setValue(String[]) except that this method takes an array of Name instead of String values.

Parameters:
names -
Throws:
javax.jcr.ValueFormatException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.RepositoryException

getQName

public Name getQName()
Same as Item.getName() except that this method returns a Name instead of a String.

Specified by:
getQName in class ItemImpl
Returns:
the name of this item as Name

internalGetValues

public InternalValue[] internalGetValues()
                                  throws javax.jcr.RepositoryException
Returns the internal values of a multi-valued property.

Returns:
array of values
Throws:
javax.jcr.ValueFormatException - if this property is not multi-valued
javax.jcr.RepositoryException

internalGetValue

public InternalValue internalGetValue()
                               throws javax.jcr.RepositoryException
Returns the internal value of a single-valued property.

Returns:
value
Throws:
javax.jcr.ValueFormatException - if this property is not single-valued
javax.jcr.RepositoryException

getValues

public javax.jcr.Value[] getValues()
                            throws javax.jcr.RepositoryException
Specified by:
getValues in interface javax.jcr.Property
Throws:
javax.jcr.RepositoryException

getValue

public javax.jcr.Value getValue()
                         throws javax.jcr.RepositoryException
Specified by:
getValue in interface javax.jcr.Property
Throws:
javax.jcr.RepositoryException

getString

public String getString()
                 throws javax.jcr.RepositoryException
Specified by:
getString in interface javax.jcr.Property
Throws:
javax.jcr.RepositoryException

getStream

public InputStream getStream()
                      throws javax.jcr.RepositoryException
Specified by:
getStream in interface javax.jcr.Property
Throws:
javax.jcr.RepositoryException

getLong

public long getLong()
             throws javax.jcr.RepositoryException
Specified by:
getLong in interface javax.jcr.Property
Throws:
javax.jcr.RepositoryException

getDouble

public double getDouble()
                 throws javax.jcr.RepositoryException
Specified by:
getDouble in interface javax.jcr.Property
Throws:
javax.jcr.RepositoryException

getDate

public Calendar getDate()
                 throws javax.jcr.RepositoryException
Specified by:
getDate in interface javax.jcr.Property
Throws:
javax.jcr.RepositoryException

getBoolean

public boolean getBoolean()
                   throws javax.jcr.RepositoryException
Specified by:
getBoolean in interface javax.jcr.Property
Throws:
javax.jcr.RepositoryException

getNode

public javax.jcr.Node getNode()
                       throws javax.jcr.ValueFormatException,
                              javax.jcr.RepositoryException
Specified by:
getNode in interface javax.jcr.Property
Throws:
javax.jcr.ValueFormatException
javax.jcr.RepositoryException

setValue

public void setValue(Calendar value)
              throws javax.jcr.RepositoryException
Specified by:
setValue in interface javax.jcr.Property
Throws:
javax.jcr.RepositoryException

setValue

public void setValue(double value)
              throws javax.jcr.RepositoryException
Specified by:
setValue in interface javax.jcr.Property
Throws:
javax.jcr.RepositoryException

setValue

public void setValue(InputStream value)
              throws javax.jcr.RepositoryException
Specified by:
setValue in interface javax.jcr.Property
Throws:
javax.jcr.RepositoryException

setValue

public void setValue(String value)
              throws javax.jcr.RepositoryException
Specified by:
setValue in interface javax.jcr.Property
Throws:
javax.jcr.RepositoryException

setValue

public void setValue(String[] strings)
              throws javax.jcr.RepositoryException
Specified by:
setValue in interface javax.jcr.Property
Throws:
javax.jcr.RepositoryException

setValue

public void setValue(boolean value)
              throws javax.jcr.RepositoryException
Specified by:
setValue in interface javax.jcr.Property
Throws:
javax.jcr.RepositoryException

setValue

public void setValue(javax.jcr.Node target)
              throws javax.jcr.ValueFormatException,
                     javax.jcr.RepositoryException
Specified by:
setValue in interface javax.jcr.Property
Throws:
javax.jcr.ValueFormatException
javax.jcr.RepositoryException

setValue

public void setValue(long value)
              throws javax.jcr.RepositoryException
Specified by:
setValue in interface javax.jcr.Property
Throws:
javax.jcr.RepositoryException

setValue

public void setValue(javax.jcr.Value value)
              throws javax.jcr.ValueFormatException,
                     javax.jcr.version.VersionException,
                     javax.jcr.lock.LockException,
                     javax.jcr.nodetype.ConstraintViolationException,
                     javax.jcr.RepositoryException
Specified by:
setValue in interface javax.jcr.Property
Throws:
javax.jcr.ValueFormatException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.RepositoryException

setValue

public void setValue(javax.jcr.Value[] values)
              throws javax.jcr.ValueFormatException,
                     javax.jcr.version.VersionException,
                     javax.jcr.lock.LockException,
                     javax.jcr.nodetype.ConstraintViolationException,
                     javax.jcr.RepositoryException

Specified by:
setValue in interface javax.jcr.Property
Throws:
javax.jcr.ValueFormatException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.RepositoryException

setValue

public void setValue(javax.jcr.Value[] values,
                     int valueType)
              throws javax.jcr.RepositoryException
Sets the values of this property.

Parameters:
values - property values (possibly null)
valueType - default value type if not set in the node type, may be PropertyType.UNDEFINED
Throws:
javax.jcr.RepositoryException - if the property values could not be set

getLength

public long getLength()
               throws javax.jcr.RepositoryException
Specified by:
getLength in interface javax.jcr.Property
Throws:
javax.jcr.RepositoryException

getLengths

public long[] getLengths()
                  throws javax.jcr.RepositoryException
Specified by:
getLengths in interface javax.jcr.Property
Throws:
javax.jcr.RepositoryException

getDefinition

public javax.jcr.nodetype.PropertyDefinition getDefinition()
                                                    throws javax.jcr.RepositoryException

Specified by:
getDefinition in interface javax.jcr.Property
Throws:
javax.jcr.RepositoryException

getType

public int getType()
            throws javax.jcr.RepositoryException
Specified by:
getType in interface javax.jcr.Property
Throws:
javax.jcr.RepositoryException

isNode

public boolean isNode()

Specified by:
isNode in interface javax.jcr.Item
Specified by:
isNode in class ItemImpl

getName

public String getName()
               throws javax.jcr.RepositoryException

Specified by:
getName in interface javax.jcr.Item
Specified by:
getName in class ItemImpl
Throws:
javax.jcr.RepositoryException

accept

public void accept(javax.jcr.ItemVisitor visitor)
            throws javax.jcr.RepositoryException

Specified by:
accept in interface javax.jcr.Item
Specified by:
accept in class ItemImpl
Throws:
javax.jcr.RepositoryException

getParent

public javax.jcr.Node getParent()
                         throws javax.jcr.RepositoryException

Specified by:
getParent in interface javax.jcr.Item
Specified by:
getParent in class ItemImpl
Throws:
javax.jcr.RepositoryException

toString

public String toString()
Return a string representation of this property for diagnostic purposes.

Overrides:
toString in class ItemImpl
Returns:
"property /path/to/item"


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.