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:
Item, Property

public class PropertyImpl
extends ItemImpl
implements Property

PropertyImpl implements the Property interface.


Field Summary
 
Fields inherited from class org.apache.jackrabbit.core.ItemImpl
id, itemMgr, sessionContext, stateMgr, STATUS_DESTROYED, STATUS_INVALIDATED, STATUS_MODIFIED, STATUS_NORMAL
 
Fields inherited from interface javax.jcr.Property
JCR_ACTIVITY, JCR_AUTOCREATED, JCR_BASE_VERSION, JCR_CHILD_VERSION_HISTORY, JCR_CONFIGURATION, JCR_CONTENT, JCR_COPIED_FROM, JCR_CREATED, JCR_CREATED_BY, JCR_CURRENT_LIFECYCLE_STATE, JCR_DATA, JCR_DEFAULT_PRIMARY_TYPE, JCR_DEFAULT_VALUES, JCR_DESCRIPTION, JCR_ENCODING, JCR_FROZEN_MIXIN_TYPES, JCR_FROZEN_PRIMARY_TYPE, JCR_FROZEN_UUID, JCR_HAS_ORDERABLE_CHILD_NODES, JCR_HOST, JCR_ID, JCR_IS_ABSTRACT, JCR_IS_CHECKED_OUT, JCR_IS_MIXIN, JCR_LANGUAGE, JCR_LAST_MODIFIED, JCR_LAST_MODIFIED_BY, JCR_LIFECYCLE_POLICY, JCR_LOCK_IS_DEEP, JCR_LOCK_OWNER, JCR_MANDATORY, JCR_MERGE_FAILED, JCR_MIMETYPE, JCR_MIXIN_TYPES, JCR_MULTIPLE, JCR_NAME, JCR_NODE_TYPE_NAME, JCR_ON_PARENT_VERSION, JCR_PATH, JCR_PORT, JCR_PREDECESSORS, JCR_PRIMARY_ITEM_NAME, JCR_PRIMARY_TYPE, JCR_PROTECTED, JCR_PROTOCOL, JCR_REPOSITORY, JCR_REQUIRED_PRIMARY_TYPES, JCR_REQUIRED_TYPE, JCR_ROOT, JCR_SAME_NAME_SIBLINGS, JCR_STATEMENT, JCR_SUCCESSORS, JCR_SUPERTYPES, JCR_TITLE, JCR_UUID, JCR_VALUE_CONSTRAINTS, JCR_VERSION_HISTORY, JCR_VERSIONABLE_UUID, JCR_WORKSPACE
 
Method Summary
 void accept(ItemVisitor visitor)
          
protected  void checkSetValue(boolean multipleValues)
          Checks various pre-conditions that are common to all setValue() methods.
 Binary getBinary()
          Wrapper around getValue()
 boolean getBoolean()
          Wrapper around getValue()
 Calendar getDate()
          Wrapper around getValue()
 BigDecimal getDecimal()
          Wrapper around getValue()
 PropertyDefinition getDefinition()
          
 double getDouble()
          Wrapper around getValue()
 long getLength()
          
protected  long getLength(InternalValue value)
          Determines the length of the given value.
 long[] getLengths()
          
 long getLong()
          Wrapper around getValue()
 String getName()
          
 Node getNode()
           
protected  ItemState getOrCreateTransientItemState()
           
 Node getParent()
          
 Property getProperty()
           
 Name getQName()
          Same as Item.getName() except that this method returns a Name instead of a String.
 InputStream getStream()
          Wrapper around getValue()
 String getString()
          Wrapper around getValue()
 int getType()
          
 Value getValue()
           
 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 isMultiple()
          
 boolean isNode()
          
protected  void makePersistent()
           
protected  void onRedefine(QPropertyDefinition def)
           
protected  void restoreTransient(PropertyState transientState)
           
 void setValue(BigDecimal value)
          Wrapper around setValue(Value)
 void setValue(Binary value)
          Wrapper around setValue(Value)
 void setValue(boolean value)
          Wrapper around setValue(Value)
 void setValue(Calendar value)
          Wrapper around setValue(Value)
 void setValue(double value)
          Wrapper around setValue(Value)
 void setValue(InputStream value)
          Wrapper around setValue(Value)
 void setValue(long value)
          Wrapper around setValue(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(Node value)
          Wrapper around setValue(Value)
 void setValue(String value)
          Wrapper around setValue(Value)
 void setValue(String[] strings)
          Wrapper around setValue(Value[])
 void setValue(Value value)
           
 void setValue(Value[] values)
          
 void setValue(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, getQName, getSession, getType, getValueFactory, getValues, isModified, isNew, isSame, isTransactionalNew, isTransient, itemSanityCheck, perform, 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 RepositoryException
Specified by:
getOrCreateTransientItemState in class ItemImpl
Throws:
RepositoryException

makePersistent

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

restoreTransient

protected void restoreTransient(PropertyState transientState)
                         throws RepositoryException
Throws:
RepositoryException

onRedefine

protected void onRedefine(QPropertyDefinition def)
                   throws RepositoryException
Throws:
RepositoryException

getLength

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

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

checkSetValue

protected void checkSetValue(boolean multipleValues)
                      throws ValueFormatException,
                             VersionException,
                             LockException,
                             ConstraintViolationException,
                             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:
ValueFormatException - if a single-valued property is set to an array of values (and vice versa)
VersionException - if the parent node is not checked-out
LockException - if the parent node is locked by somebody else
ConstraintViolationException - if the property is protected
RepositoryException - if another error occurs
See Also:
Property.setValue(javax.jcr.Value)

internalSetValue

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

setValue

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

Parameters:
name -
Throws:
ValueFormatException
VersionException
LockException
ConstraintViolationException
RepositoryException

setValue

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

Parameters:
names -
Throws:
ValueFormatException
VersionException
LockException
ConstraintViolationException
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 RepositoryException
Returns the internal values of a multi-valued property.

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

internalGetValue

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

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

getValues

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

getValue

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

getString

public String getString()
                 throws RepositoryException
Wrapper around getValue()

Specified by:
getString in interface Property
Throws:
RepositoryException

getStream

public InputStream getStream()
                      throws RepositoryException
Wrapper around getValue()

Specified by:
getStream in interface Property
Throws:
RepositoryException

getLong

public long getLong()
             throws RepositoryException
Wrapper around getValue()

Specified by:
getLong in interface Property
Throws:
RepositoryException

getDouble

public double getDouble()
                 throws RepositoryException
Wrapper around getValue()

Specified by:
getDouble in interface Property
Throws:
RepositoryException

getDate

public Calendar getDate()
                 throws RepositoryException
Wrapper around getValue()

Specified by:
getDate in interface Property
Throws:
RepositoryException

getBoolean

public boolean getBoolean()
                   throws RepositoryException
Wrapper around getValue()

Specified by:
getBoolean in interface Property
Throws:
RepositoryException

getNode

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

getProperty

public Property getProperty()
                     throws RepositoryException
Specified by:
getProperty in interface Property
Throws:
RepositoryException

getDecimal

public BigDecimal getDecimal()
                      throws RepositoryException
Wrapper around getValue()

Specified by:
getDecimal in interface Property
Throws:
RepositoryException

setValue

public void setValue(BigDecimal value)
              throws RepositoryException
Wrapper around setValue(Value)

Specified by:
setValue in interface Property
Throws:
RepositoryException

getBinary

public Binary getBinary()
                 throws RepositoryException
Wrapper around getValue()

Specified by:
getBinary in interface Property
Throws:
RepositoryException

setValue

public void setValue(Binary value)
              throws RepositoryException
Wrapper around setValue(Value)

Specified by:
setValue in interface Property
Throws:
RepositoryException

setValue

public void setValue(Calendar value)
              throws RepositoryException
Wrapper around setValue(Value)

Specified by:
setValue in interface Property
Throws:
RepositoryException

setValue

public void setValue(double value)
              throws RepositoryException
Wrapper around setValue(Value)

Specified by:
setValue in interface Property
Throws:
RepositoryException

setValue

public void setValue(InputStream value)
              throws RepositoryException
Wrapper around setValue(Value)

Specified by:
setValue in interface Property
Throws:
RepositoryException

setValue

public void setValue(String value)
              throws RepositoryException
Wrapper around setValue(Value)

Specified by:
setValue in interface Property
Throws:
RepositoryException

setValue

public void setValue(String[] strings)
              throws RepositoryException
Wrapper around setValue(Value[])

Specified by:
setValue in interface Property
Throws:
RepositoryException

setValue

public void setValue(boolean value)
              throws RepositoryException
Wrapper around setValue(Value)

Specified by:
setValue in interface Property
Throws:
RepositoryException

setValue

public void setValue(Node value)
              throws RepositoryException
Wrapper around setValue(Value)

Specified by:
setValue in interface Property
Throws:
RepositoryException

setValue

public void setValue(long value)
              throws RepositoryException
Wrapper around setValue(Value)

Specified by:
setValue in interface Property
Throws:
RepositoryException

setValue

public void setValue(Value value)
              throws ValueFormatException,
                     VersionException,
                     LockException,
                     ConstraintViolationException,
                     RepositoryException
Specified by:
setValue in interface Property
Throws:
ValueFormatException
VersionException
LockException
ConstraintViolationException
RepositoryException

setValue

public void setValue(Value[] values)
              throws RepositoryException

Specified by:
setValue in interface Property
Throws:
RepositoryException

setValue

public void setValue(Value[] values,
                     int valueType)
              throws 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:
RepositoryException - if the property values could not be set

getLength

public long getLength()
               throws RepositoryException

Specified by:
getLength in interface Property
Throws:
RepositoryException

getLengths

public long[] getLengths()
                  throws RepositoryException

Specified by:
getLengths in interface Property
Throws:
RepositoryException

getDefinition

public PropertyDefinition getDefinition()
                                 throws RepositoryException

Specified by:
getDefinition in interface Property
Throws:
RepositoryException

getType

public int getType()
            throws RepositoryException

Specified by:
getType in interface Property
Throws:
RepositoryException

isMultiple

public boolean isMultiple()
                   throws RepositoryException

Specified by:
isMultiple in interface Property
Throws:
RepositoryException

isNode

public boolean isNode()

Specified by:
isNode in interface Item
Specified by:
isNode in class ItemImpl

getName

public String getName()
               throws RepositoryException

Specified by:
getName in interface Item
Specified by:
getName in class ItemImpl
Throws:
RepositoryException

accept

public void accept(ItemVisitor visitor)
            throws RepositoryException

Specified by:
accept in interface Item
Specified by:
accept in class ItemImpl
Throws:
RepositoryException

getParent

public Node getParent()
               throws RepositoryException

Specified by:
getParent in interface Item
Specified by:
getParent in class ItemImpl
Throws:
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-2010 The Apache Software Foundation. All Rights Reserved.