Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.core.storage.sql.coremodel
Class SQLDocumentProxy

java.lang.Object
  extended by org.nuxeo.ecm.core.storage.sql.coremodel.SQLDocumentProxy
All Implemented Interfaces:
Document, DocumentContainer, DocumentProxy, Lockable, Property, PropertyContainer, SQLDocument, VersionableDocument

public class SQLDocumentProxy
extends java.lang.Object
implements SQLDocument, DocumentProxy

A proxy is a shortcut to a target document (a version or normal document).

Author:
Florent Guillaume

Field Summary
 
Fields inherited from interface org.nuxeo.ecm.core.storage.sql.coremodel.SQLDocument
BINARY_TEXT_SYS_PROP
 
Method Summary
 Document addChild(java.lang.String name, java.lang.String typeName)
          Creates a new child document given its typename.
 Document checkIn(java.lang.String label, java.lang.String checkinComment)
          Creates a new version.
 void checkOut()
           
 void checkWritable()
          Raises an exception if the document is read-only.
 boolean equals(java.lang.Object other)
           
 java.util.Map<java.lang.String,java.lang.Object> exportFlatMap(java.lang.String[] schemas)
          Exports a flat view of properties in this document.
 java.util.Map<java.lang.String,java.lang.Object> exportMap(java.lang.String schemaName)
           
 java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> exportMap(java.lang.String[] schemas)
          Exports the properties belonging to the given schemas as a java Map.
 boolean followTransition(java.lang.String transition)
          Follows a given life cycle transition.
 Property getACLProperty()
          Returns the property holding the ACL.
 java.util.Collection<java.lang.String> getAllowedStateTransitions()
          Returns the allowed state transitions for this document.
 Document getBaseVersion()
          Gets the version to which a checked in document is linked.
 boolean getBoolean(java.lang.String name)
          Gets the value of a scalar property as a boolean.
 java.lang.String getCheckinComment()
           
 Document getChild(java.lang.String name)
          Gets a child document given its name.
 java.util.Iterator<Document> getChildren()
          Gets an iterator over the children of the document.
 DocumentIterator getChildren(int start)
           
 java.util.List<java.lang.String> getChildrenIds()
          Gets a list of the children ids.
 Blob getContent(java.lang.String name)
          Gets the value of the named content property.
 java.util.Calendar getDate(java.lang.String name)
          Gets the value of a scalar property as a date.
 java.util.List<java.lang.String> getDirtyFields()
          Returns fields that were modified.
 double getDouble(java.lang.String name)
          Gets the value of a scalar property as a double.
 java.util.Calendar getLastModified()
          Gets the last modification time on this document.
 Document getLastVersion()
          Gets the last version of this document.
 java.lang.String getLifeCyclePolicy()
          Returns the life cycle policy of this document.
 java.lang.String getLifeCycleState()
          Returns the life cycle of the document.
 java.lang.String getLock()
          Gets the lock key if a lock exists on the current object.
 long getLong(java.lang.String name)
          Gets the value of a scalar property as a long.
 java.lang.String getName()
          Gets the name of this document.
 Node getNode()
          Returns the node with info about the hierarchy location.
 Document getParent()
          Gets the parent document or null if this is the root document.
 java.lang.String getPath()
          Gets the path of this document.
 java.util.Collection<Property> getProperties()
          Gets the collection of the sub properties in this container.
 Property getProperty(java.lang.String name)
          Gets a property given its name.
 java.util.Iterator<Property> getPropertyIterator()
          Gets an iterator over all existing properties in this container.
 java.lang.Object getPropertyValue(java.lang.String name)
          Generic method to retrieve a property value.
 Repository getRepository()
          Returns the repository in which the document lives.
 Session getSession()
          Gets the session that owns this document.
 Document getSourceDocument()
          Gets the head ("live") version of this document.
 java.lang.String getString(java.lang.String name)
          Gets the value of a scalar property as a string.
<T extends java.io.Serializable>
T
getSystemProp(java.lang.String name, java.lang.Class<T> type)
          Get system property of the specified type.
 Document getTargetDocument()
          Gets the document (version or live document) to which this proxy points.
 DocumentType getType()
          Gets this document's type.
 java.lang.String getUUID()
          Gets this document's UUID.
 java.lang.Object getValue()
          Gets the value of this property.
 Document getVersion(java.lang.String label)
          Gets a version of this document, given its label.
 java.util.Calendar getVersionCreationDate()
           
 java.lang.String getVersionLabel()
           
 java.util.List<Document> getVersions()
           
 java.lang.String getVersionSeriesId()
          Gets the version series id.
 java.util.List<java.lang.String> getVersionsIds()
          Gets the list of version ids for this document.
 Document getWorkingCopy()
           
 boolean hasChild(java.lang.String name)
          Tests if the document has the named child.
 boolean hasChildren()
          Tests if the document has any children.
 int hashCode()
           
 boolean hasVersions()
          Tells the caller if this document has versions or not.
 void importFlatMap(java.util.Map<java.lang.String,java.lang.Object> map)
          Imports a flat map of properties into this document.
 void importMap(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> map)
          Imports the tree properties from the given Java Map.
 boolean isCheckedOut()
           
 boolean isFolder()
          Tests whether this document represent a folder or a leaf document.
 boolean isLatestMajorVersion()
           
 boolean isLatestVersion()
           
 boolean isLocked()
          Tests if the current object is locked.
 boolean isMajorVersion()
           
 boolean isNull()
          Tests whether or not this property is null.
 boolean isPropertySet(java.lang.String name)
          Tests whether the property at the given path exists (the property may be either a scalar or a composite one).
 boolean isProxy()
          Checks whether or not this doc is a proxy document.
 boolean isVersion()
          Checks whether or not this doc is a version document.
 boolean isVersionSeriesCheckedOut()
           
 void orderBefore(java.lang.String src, java.lang.String dest)
          Orders the given source child before the destination child.
 void readDocumentPart(DocumentPart dp)
          Load document part properties from storage and fill them inside the given document part.
 void remove()
          Removes this document and all its children, if any.
 void removeChild(java.lang.String name)
          Removes the child having the given name If this is not a folder does nothing.
 void removeProperty(java.lang.String name)
          Removes the property with the given name.
 Document resolvePath(java.lang.String path)
          Resolves a document given its relative path to the current document.
 void restore(Document version)
          Replaces current version with version specified.
 void save()
          Saves any modification done on this document or its children.
 void setBoolean(java.lang.String name, boolean value)
          Sets the scalar property value to the given boolean value.
 void setContent(java.lang.String name, Blob value)
          Sets the content property to the given value.
 void setCurrentLifeCycleState(java.lang.String state)
          Sets the lifecycle state of the document.
 void setDate(java.lang.String name, java.util.Calendar value)
          Sets the scalar property value to the given date value.
 void setDouble(java.lang.String name, double value)
          Set the scalar property value to the given double value.
 void setLifeCyclePolicy(java.lang.String policy)
          Sets the life cycle policy of this document.
 void setLock(java.lang.String key)
          Sets a lock on the current document.
 void setLong(java.lang.String name, long value)
          Sets the scalar property value to the given long value.
 void setNull()
          Nullify this property.
 void setPropertyValue(java.lang.String name, java.lang.Object value)
          Generic method to set a property value.
 void setString(java.lang.String name, java.lang.String value)
          Sets the scalar property value to the given string value.
<T extends java.io.Serializable>
void
setSystemProp(java.lang.String name, T value)
          Set a system property which is a property of by the built-in node type ECM_SYSTEM_ANY.
 void setTargetDocument(Document target)
          Sets the document (version or live document) to which this proxy points.
 void setValue(java.lang.Object value)
          Sets the value of this property.
 java.lang.String toString()
           
 java.lang.String unlock()
          Removes the lock on the object if any exists, otherwise do nothing.
 void writeDocumentPart(DocumentPart dp)
          Read modifications in the given document part and write them on storage.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getNode

public Node getNode()
Description copied from interface: SQLDocument
Returns the node with info about the hierarchy location.

Specified by:
getNode in interface SQLDocument

getACLProperty

public Property getACLProperty()
                        throws DocumentException
Description copied from interface: SQLDocument
Returns the property holding the ACL.

Specified by:
getACLProperty in interface SQLDocument
Throws:
DocumentException

checkWritable

public void checkWritable()
                   throws DocumentException
Description copied from interface: SQLDocument
Raises an exception if the document is read-only.

Specified by:
checkWritable in interface SQLDocument
Throws:
DocumentException

isProxy

public boolean isProxy()
Description copied from interface: Document
Checks whether or not this doc is a proxy document.

Specified by:
isProxy in interface Document
Returns:
true if it's a proxy false otherwise

getName

public java.lang.String getName()
                         throws DocumentException
Description copied from interface: Document
Gets the name of this document.

Specified by:
getName in interface Document
Specified by:
getName in interface Property
Returns:
the document name. Cannot be null
Throws:
DocumentException - if any exception occurred

getUUID

public java.lang.String getUUID()
Description copied from interface: Document
Gets this document's UUID.

Specified by:
getUUID in interface Document
Returns:
the document UUID (cannot be null)

getParent

public Document getParent()
                   throws DocumentException
Description copied from interface: Document
Gets the parent document or null if this is the root document.

Specified by:
getParent in interface Document
Returns:
the parent document or null if this is the root document
Throws:
DocumentException

getPath

public java.lang.String getPath()
                         throws DocumentException
Description copied from interface: Document
Gets the path of this document.

Specified by:
getPath in interface Document
Returns:
the path
Throws:
DocumentException

remove

public void remove()
            throws DocumentException
Description copied from interface: Document
Removes this document and all its children, if any.

Specified by:
remove in interface Document
Throws:
DocumentException - if an error occurs

getType

public DocumentType getType()
Description copied from interface: Document
Gets this document's type.

Specified by:
getType in interface Document
Specified by:
getType in interface Property
Returns:
the document type (cannot be null)

getRepository

public Repository getRepository()
Description copied from interface: Document
Returns the repository in which the document lives.

Specified by:
getRepository in interface Document
Returns:
a Repository instance.

getSession

public Session getSession()
Description copied from interface: Document
Gets the session that owns this document.

Specified by:
getSession in interface Document
Returns:
the session

isFolder

public boolean isFolder()
Description copied from interface: Document
Tests whether this document represent a folder or a leaf document.

Specified by:
isFolder in interface Document
Returns:
true if the document is a folder document, false otherwise

getLastModified

public java.util.Calendar getLastModified()
                                   throws DocumentException
Description copied from interface: Document
Gets the last modification time on this document.

Specified by:
getLastModified in interface Document
Returns:
last modification time
Throws:
DocumentException

save

public void save()
          throws DocumentException
Description copied from interface: Document
Saves any modification done on this document or its children.

For some implementations this may do nothing if they are commiting modifications as they are done by calling the corresponding method.

Specified by:
save in interface Document
Throws:
DocumentException - if an error occurs

readDocumentPart

public void readDocumentPart(DocumentPart dp)
                      throws java.lang.Exception
Description copied from interface: Document
Load document part properties from storage and fill them inside the given document part.

Specified by:
readDocumentPart in interface Document
Throws:
java.lang.Exception

writeDocumentPart

public void writeDocumentPart(DocumentPart dp)
                       throws java.lang.Exception
Description copied from interface: Document
Read modifications in the given document part and write them on storage.

Specified by:
writeDocumentPart in interface Document
Throws:
java.lang.Exception

setSystemProp

public <T extends java.io.Serializable> void setSystemProp(java.lang.String name,
                                                           T value)
                   throws DocumentException
Description copied from interface: Document
Set a system property which is a property of by the built-in node type ECM_SYSTEM_ANY.

Specified by:
setSystemProp in interface Document
Throws:
DocumentException

getSystemProp

public <T extends java.io.Serializable> T getSystemProp(java.lang.String name,
                                                        java.lang.Class<T> type)
                                             throws DocumentException
Description copied from interface: Document
Get system property of the specified type.

Specified by:
getSystemProp in interface Document
Returns:
Throws:
DocumentException

getLifeCyclePolicy

public java.lang.String getLifeCyclePolicy()
                                    throws LifeCycleException
Description copied from interface: Document
Returns the life cycle policy of this document.

Specified by:
getLifeCyclePolicy in interface Document
Returns:
the life cycle policy name of this document as a string
Throws:
LifeCycleException

setLifeCyclePolicy

public void setLifeCyclePolicy(java.lang.String policy)
                        throws LifeCycleException
Description copied from interface: Document
Sets the life cycle policy of this document.

Specified by:
setLifeCyclePolicy in interface Document
Parameters:
policy - the policy
Throws:
LifeCycleException

getLifeCycleState

public java.lang.String getLifeCycleState()
                                   throws LifeCycleException
Description copied from interface: Document
Returns the life cycle of the document.

Specified by:
getLifeCycleState in interface Document
Returns:
the life cycle as a string
Throws:
LifeCycleException
See Also:
org.nuxeo.ecm.core.lifecycle

setCurrentLifeCycleState

public void setCurrentLifeCycleState(java.lang.String state)
                              throws LifeCycleException
Description copied from interface: Document
Sets the lifecycle state of the document.

Specified by:
setCurrentLifeCycleState in interface Document
Parameters:
state - the state
Throws:
LifeCycleException

followTransition

public boolean followTransition(java.lang.String transition)
                         throws LifeCycleException
Description copied from interface: Document
Follows a given life cycle transition.

This will update the current life cycle of the document.

Specified by:
followTransition in interface Document
Parameters:
transition - the name of the transition to follow
Returns:
a boolean representing the status if the operation
Throws:
LifeCycleException

getAllowedStateTransitions

public java.util.Collection<java.lang.String> getAllowedStateTransitions()
                                                                  throws LifeCycleException
Description copied from interface: Document
Returns the allowed state transitions for this document.

Specified by:
getAllowedStateTransitions in interface Document
Returns:
a collection of state transitions as string
Throws:
LifeCycleException

isLocked

public boolean isLocked()
                 throws DocumentException
Description copied from interface: Lockable
Tests if the current object is locked.

Specified by:
isLocked in interface Lockable
Returns:
true if locked false otherwise
Throws:
DocumentException

getLock

public java.lang.String getLock()
                         throws DocumentException
Description copied from interface: Lockable
Gets the lock key if a lock exists on the current object.

Specified by:
getLock in interface Lockable
Returns:
the lock key or null if no lock exists
Throws:
DocumentException

setLock

public void setLock(java.lang.String key)
             throws DocumentException
Description copied from interface: Lockable
Sets a lock on the current document.

The lock key cannot be null.

Specified by:
setLock in interface Lockable
Parameters:
key - the lock key
Throws:
DocumentException

unlock

public java.lang.String unlock()
                        throws DocumentException
Description copied from interface: Lockable
Removes the lock on the object if any exists, otherwise do nothing.

Specified by:
unlock in interface Lockable
Returns:
the key of the removed lock or null if the object was not locked
Throws:
DocumentException

isVersion

public boolean isVersion()
Description copied from interface: VersionableDocument
Checks whether or not this doc is a version document.

Specified by:
isVersion in interface VersionableDocument
Returns:
true if it's a version, false otherwise

getBaseVersion

public Document getBaseVersion()
                        throws DocumentException
Description copied from interface: VersionableDocument
Gets the version to which a checked in document is linked.

Returns null for a checked out document or a version or a proxy.

Specified by:
getBaseVersion in interface VersionableDocument
Returns:
the version, or null
Throws:
DocumentException

getVersionSeriesId

public java.lang.String getVersionSeriesId()
                                    throws DocumentException
Description copied from interface: VersionableDocument
Gets the version series id.

Specified by:
getVersionSeriesId in interface VersionableDocument
Returns:
the version series id
Throws:
DocumentException

getSourceDocument

public Document getSourceDocument()
                           throws DocumentException
Description copied from interface: VersionableDocument
Gets the head ("live") version of this document.

Specified by:
getSourceDocument in interface VersionableDocument
Returns:
Throws:
DocumentException

checkIn

public Document checkIn(java.lang.String label,
                        java.lang.String checkinComment)
                 throws DocumentException
Description copied from interface: VersionableDocument
Creates a new version.

Specified by:
checkIn in interface VersionableDocument
Parameters:
label - the version label
checkinComment - the checkin comment
Returns:
the created version
Throws:
DocumentException

checkOut

public void checkOut()
              throws DocumentException
Specified by:
checkOut in interface VersionableDocument
Throws:
DocumentException

isCheckedOut

public boolean isCheckedOut()
                     throws DocumentException
Specified by:
isCheckedOut in interface VersionableDocument
Throws:
DocumentException

isLatestVersion

public boolean isLatestVersion()
                        throws DocumentException
Specified by:
isLatestVersion in interface VersionableDocument
Throws:
DocumentException

isMajorVersion

public boolean isMajorVersion()
                       throws DocumentException
Specified by:
isMajorVersion in interface VersionableDocument
Throws:
DocumentException

isLatestMajorVersion

public boolean isLatestMajorVersion()
                             throws DocumentException
Specified by:
isLatestMajorVersion in interface VersionableDocument
Throws:
DocumentException

isVersionSeriesCheckedOut

public boolean isVersionSeriesCheckedOut()
                                  throws DocumentException
Specified by:
isVersionSeriesCheckedOut in interface VersionableDocument
Throws:
DocumentException

getVersionLabel

public java.lang.String getVersionLabel()
                                 throws DocumentException
Specified by:
getVersionLabel in interface VersionableDocument
Throws:
DocumentException

getCheckinComment

public java.lang.String getCheckinComment()
                                   throws DocumentException
Specified by:
getCheckinComment in interface VersionableDocument
Throws:
DocumentException

getWorkingCopy

public Document getWorkingCopy()
                        throws DocumentException
Specified by:
getWorkingCopy in interface VersionableDocument
Throws:
DocumentException

getVersionCreationDate

public java.util.Calendar getVersionCreationDate()
                                          throws DocumentException
Specified by:
getVersionCreationDate in interface VersionableDocument
Throws:
DocumentException

restore

public void restore(Document version)
             throws DocumentException
Description copied from interface: VersionableDocument
Replaces current version with version specified.

Specified by:
restore in interface VersionableDocument
Parameters:
version - the version to replace with
Throws:
DocumentException

getVersionsIds

public java.util.List<java.lang.String> getVersionsIds()
                                                throws DocumentException
Description copied from interface: VersionableDocument
Gets the list of version ids for this document.

Specified by:
getVersionsIds in interface VersionableDocument
Returns:
the list of version ids
Throws:
DocumentException

getVersion

public Document getVersion(java.lang.String label)
                    throws DocumentException
Description copied from interface: VersionableDocument
Gets a version of this document, given its label.

Specified by:
getVersion in interface VersionableDocument
Parameters:
label - the version label
Returns:
the version
Throws:
DocumentException

getVersions

public java.util.List<Document> getVersions()
                                     throws DocumentException
Specified by:
getVersions in interface VersionableDocument
Returns:
all versions of the document, empty list if there's no version
Throws:
DocumentException

getLastVersion

public Document getLastVersion()
                        throws DocumentException
Description copied from interface: VersionableDocument
Gets the last version of this document.

Specified by:
getLastVersion in interface VersionableDocument
Returns:
the last version
Throws:
DocumentException

hasVersions

public boolean hasVersions()
                    throws DocumentException
Description copied from interface: VersionableDocument
Tells the caller if this document has versions or not.

Needed to know if we need to use checkin/checkout methods when changing a document.

Specified by:
hasVersions in interface VersionableDocument
Returns:
true if there are versions
Throws:
DocumentException

resolvePath

public Document resolvePath(java.lang.String path)
                     throws DocumentException
Description copied from interface: DocumentContainer
Resolves a document given its relative path to the current document.

If the path is absolute then it will be transformed in a relative path (i.e. the leading '/' removed).

Specified by:
resolvePath in interface DocumentContainer
Parameters:
path - the path relative to this document
Returns:
the resolved document
Throws:
DocumentException

getChild

public Document getChild(java.lang.String name)
                  throws DocumentException
Description copied from interface: DocumentContainer
Gets a child document given its name.

Throws an exception if the document could not be found.

If the supplied name is null, returns the default child of the document if any, otherwise raises an exception.

Specified by:
getChild in interface DocumentContainer
Parameters:
name - the name of the child to retrieve
Returns:
the named child if exists, raises a NoSuchDocumentException otherwise
Throws:
DocumentException

getChildren

public java.util.Iterator<Document> getChildren()
                                         throws DocumentException
Description copied from interface: DocumentContainer
Gets an iterator over the children of the document.

This operation silently ignores non-folder documents: if the document is not a folder then it returns an empty iterator.

Specified by:
getChildren in interface DocumentContainer
Returns:
the children iterator
Throws:
DocumentException

getChildren

public DocumentIterator getChildren(int start)
                             throws DocumentException
Specified by:
getChildren in interface DocumentContainer
Throws:
DocumentException

getChildrenIds

public java.util.List<java.lang.String> getChildrenIds()
                                                throws DocumentException
Description copied from interface: DocumentContainer
Gets a list of the children ids.

Specified by:
getChildrenIds in interface DocumentContainer
Returns:
a list of children ids.
Throws:
DocumentException

hasChild

public boolean hasChild(java.lang.String name)
                 throws DocumentException
Description copied from interface: DocumentContainer
Tests if the document has the named child.

This operation silently ignores non-folder documents: If the document is not a folder then return false.

Specified by:
hasChild in interface DocumentContainer
Parameters:
name - the name of the child to test
Returns:
true if the named child exists, false otherwise
Throws:
DocumentException

hasChildren

public boolean hasChildren()
                    throws DocumentException
Description copied from interface: DocumentContainer
Tests if the document has any children.

This operation silently ignores non-folder documents: If the document is not a folder then returns false.

Specified by:
hasChildren in interface DocumentContainer
Returns:
true if document has children, false otherwise
Throws:
DocumentException

addChild

public Document addChild(java.lang.String name,
                         java.lang.String typeName)
                  throws DocumentException
Description copied from interface: DocumentContainer
Creates a new child document given its typename.

This operation throws an error if the current document is not a folder.

Specified by:
addChild in interface DocumentContainer
Parameters:
name - the name of the new child to create
typeName - the type of the child to create
Returns:
the newly created document
Throws:
DocumentException

orderBefore

public void orderBefore(java.lang.String src,
                        java.lang.String dest)
                 throws DocumentException
Description copied from interface: DocumentContainer
Orders the given source child before the destination child. Both source and destination must be names that point to child documents of the current document. The source document will be placed before the destination one. If destination is null the source document will be appended at the end of the children list.

Specified by:
orderBefore in interface DocumentContainer
Parameters:
src - the document to move
dest - the document before which to place the source document
Throws:
DocumentException - if this document is not an orderable folder or any other exception occurs

removeChild

public void removeChild(java.lang.String name)
                 throws DocumentException
Description copied from interface: DocumentContainer
Removes the child having the given name

If this is not a folder does nothing.

If this is a folder and no child exists with the given name then throws an exception

Specified by:
removeChild in interface DocumentContainer
Parameters:
name - the child name
Throws:
DocumentException

getTargetDocument

public Document getTargetDocument()
Description copied from interface: DocumentProxy
Gets the document (version or live document) to which this proxy points.

Specified by:
getTargetDocument in interface DocumentProxy

setTargetDocument

public void setTargetDocument(Document target)
                       throws DocumentException
Description copied from interface: DocumentProxy
Sets the document (version or live document) to which this proxy points.

Specified by:
setTargetDocument in interface DocumentProxy
Throws:
DocumentException

isPropertySet

public boolean isPropertySet(java.lang.String name)
                      throws DocumentException
Description copied from interface: PropertyContainer
Tests whether the property at the given path exists (the property may be either a scalar or a composite one).

Specified by:
isPropertySet in interface Property
Specified by:
isPropertySet in interface PropertyContainer
Parameters:
name - the path to test
Returns:
true if the property at the given path exists, false otherwise
Throws:
DocumentException - if any error occurs

getProperty

public Property getProperty(java.lang.String name)
                     throws DocumentException
Description copied from interface: PropertyContainer
Gets a property given its name.

If the named property is specified by schema of the container object this method will always return a property object even if the property was not yet set (doesn't exists).

In this case the method Property.isNull() of the returned property will return true. If the property is not specified by any container schema the NoSuchPropertyException will be thrown returns non null even if the property corresponding to that name was not previously set. The returned object is a scalar, composite or list property.

Specified by:
getProperty in interface Property
Specified by:
getProperty in interface PropertyContainer
Parameters:
name - the property name to retrieve
Returns:
the property object
Throws:
DocumentException - if any error occurs

getProperties

public java.util.Collection<Property> getProperties()
                                             throws DocumentException
Description copied from interface: PropertyContainer
Gets the collection of the sub properties in this container.

The returned properties are existing.

Specified by:
getProperties in interface Property
Specified by:
getProperties in interface PropertyContainer
Returns:
the existing properties in this container
Throws:
DocumentException - if any error occurs

getPropertyIterator

public java.util.Iterator<Property> getPropertyIterator()
                                                 throws DocumentException
Description copied from interface: PropertyContainer
Gets an iterator over all existing properties in this container.

The returned properties are existing.

Specified by:
getPropertyIterator in interface Property
Specified by:
getPropertyIterator in interface PropertyContainer
Returns:
the existing properties in this container
Throws:
DocumentException - if any error occurs

exportFlatMap

public java.util.Map<java.lang.String,java.lang.Object> exportFlatMap(java.lang.String[] schemas)
                                                               throws DocumentException
Description copied from interface: PropertyContainer
Exports a flat view of properties in this document.

If the given schemas array is null then all schemas will be exported.

Specified by:
exportFlatMap in interface PropertyContainer
Returns:
Throws:
DocumentException - if any error occurs

exportMap

public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> exportMap(java.lang.String[] schemas)
                                                                                           throws DocumentException
Description copied from interface: PropertyContainer
Exports the properties belonging to the given schemas as a java Map.

If the given schemas array is null then all schemas will be exported

The properties are grouped by schemas

The property tree is recursively traversed and all property in that schema exported as entry of the Map

Specified by:
exportMap in interface PropertyContainer
Returns:
the exported properties as a java Map
Throws:
DocumentException - if any error occurs

exportMap

public java.util.Map<java.lang.String,java.lang.Object> exportMap(java.lang.String schemaName)
                                                           throws DocumentException
Specified by:
exportMap in interface PropertyContainer
Throws:
DocumentException

importFlatMap

public void importFlatMap(java.util.Map<java.lang.String,java.lang.Object> map)
                   throws DocumentException
Description copied from interface: PropertyContainer
Imports a flat map of properties into this document.

Specified by:
importFlatMap in interface PropertyContainer
Throws:
DocumentException - if any error occurs

importMap

public void importMap(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> map)
               throws DocumentException
Description copied from interface: PropertyContainer
Imports the tree properties from the given Java Map.

The property tree is recursively traversed and all property exported as entry of the Map.

Specified by:
importMap in interface PropertyContainer
Throws:
DocumentException - if any error occurs

getDirtyFields

public java.util.List<java.lang.String> getDirtyFields()
Description copied from interface: PropertyContainer
Returns fields that were modified.

XXX AT: compatibility method for NXP-666

Specified by:
getDirtyFields in interface PropertyContainer

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String name)
                                  throws DocumentException
Description copied from interface: PropertyContainer
Generic method to retrieve a property value.

This is a shortcut for getProperty(String).getValue()

Specified by:
getPropertyValue in interface PropertyContainer
Parameters:
name - the name of the property to set
Returns:
the property value or null if the property is not set.
Throws:
DocumentException - if any error occurs
See Also:
for the list of supported value objects

getString

public java.lang.String getString(java.lang.String name)
                           throws DocumentException
Description copied from interface: PropertyContainer
Gets the value of a scalar property as a string.

This is a shortcut for getScalar(name).getString()

Specified by:
getString in interface PropertyContainer
Throws:
DocumentException - if any error occurs
See Also:
SimpleProperty#getString()};

getBoolean

public boolean getBoolean(java.lang.String name)
                   throws DocumentException
Description copied from interface: PropertyContainer
Gets the value of a scalar property as a boolean.

This is a shortcut for getScalar(name).getBoolean()

Specified by:
getBoolean in interface PropertyContainer
Throws:
DocumentException - if any error occurs
See Also:
SimpleProperty#getBoolean()};

getLong

public long getLong(java.lang.String name)
             throws DocumentException
Description copied from interface: PropertyContainer
Gets the value of a scalar property as a long.

This is a shortcut for getScalar(name).getLong()

Specified by:
getLong in interface PropertyContainer
Throws:
DocumentException - if any error occurs
See Also:
SimpleProperty#getLong()};

getDouble

public double getDouble(java.lang.String name)
                 throws DocumentException
Description copied from interface: PropertyContainer
Gets the value of a scalar property as a double.

This is a shortcut for getScalar(name).getDouble()

Specified by:
getDouble in interface PropertyContainer
Throws:
DocumentException - if any error occurs
See Also:
SimpleProperty#getDouble()};

getDate

public java.util.Calendar getDate(java.lang.String name)
                           throws DocumentException
Description copied from interface: PropertyContainer
Gets the value of a scalar property as a date.

This is a shortcut for getScalar(name).getDate()

Specified by:
getDate in interface PropertyContainer
Throws:
DocumentException - if any error occurs
See Also:
SimpleProperty#getDate()};

getContent

public Blob getContent(java.lang.String name)
                throws DocumentException
Description copied from interface: PropertyContainer
Gets the value of the named content property.

Specified by:
getContent in interface PropertyContainer
Throws:
DocumentException - if any error occurs

setPropertyValue

public void setPropertyValue(java.lang.String name,
                             java.lang.Object value)
                      throws DocumentException
Description copied from interface: PropertyContainer
Generic method to set a property value.

This is a shortcut for getProperty(String).setValue(Object)

The following type of objects can be used as values depending on the property type:

Specified by:
setPropertyValue in interface PropertyContainer
Parameters:
name - the name of the property to set
value - the value to set
Throws:
DocumentException - if any error occurs

setString

public void setString(java.lang.String name,
                      java.lang.String value)
               throws DocumentException
Description copied from interface: PropertyContainer
Sets the scalar property value to the given string value.

If the property with that name doesn't exists, it will be created.

This is a shortcut to create or set string properties.

Specified by:
setString in interface PropertyContainer
Throws:
DocumentException - if any error occurs
See Also:
SimpleProperty#setString(String)}

setBoolean

public void setBoolean(java.lang.String name,
                       boolean value)
                throws DocumentException
Description copied from interface: PropertyContainer
Sets the scalar property value to the given boolean value.

If the property with that name doesn't exists, it will be created.

This is a shortcut to create or set boolean properties.

Specified by:
setBoolean in interface PropertyContainer
Throws:
DocumentException - if any error occurs
See Also:
SimpleProperty#setBoolean(boolean)}

setLong

public void setLong(java.lang.String name,
                    long value)
             throws DocumentException
Description copied from interface: PropertyContainer
Sets the scalar property value to the given long value.

If the property with that name doesn't exists, it will be created.

This is a shortcut to create or set long properties.

Specified by:
setLong in interface PropertyContainer
Throws:
DocumentException - if any error occurs
See Also:
SimpleProperty#setLong(long)}

setDouble

public void setDouble(java.lang.String name,
                      double value)
               throws DocumentException
Description copied from interface: PropertyContainer
Set the scalar property value to the given double value.

If the property with that name doesn't exists, it will be created.

This is a shortcut to create or set double properties

Specified by:
setDouble in interface PropertyContainer
Throws:
DocumentException - if any error occurs
See Also:
SimpleProperty#setDouble(double)}

setDate

public void setDate(java.lang.String name,
                    java.util.Calendar value)
             throws DocumentException
Description copied from interface: PropertyContainer
Sets the scalar property value to the given date value.

If the property with that name doesn't exists, it will be created

This is a shortcut to create or set date properties.

Specified by:
setDate in interface PropertyContainer
Throws:
DocumentException - if any error occurs
See Also:
SimpleProperty#setDate(Calendar)}

setContent

public void setContent(java.lang.String name,
                       Blob value)
                throws DocumentException
Description copied from interface: PropertyContainer
Sets the content property to the given value.

If the property with that name doesn't exists, it will be created

Specified by:
setContent in interface PropertyContainer
Throws:
DocumentException - if any error occurs

removeProperty

public void removeProperty(java.lang.String name)
                    throws DocumentException
Description copied from interface: PropertyContainer
Removes the property with the given name.

Specified by:
removeProperty in interface PropertyContainer
Parameters:
name - the property to remove
Throws:
DocumentException - if any error occurs

getValue

public java.lang.Object getValue()
                          throws DocumentException
Description copied from interface: Property
Gets the value of this property.

Specified by:
getValue in interface Property
Returns:
this property's value
Throws:
DocumentException

isNull

public boolean isNull()
Description copied from interface: Property
Tests whether or not this property is null.

A null property means that it is defined by the container schema but was not yet set (so it may not exists as a persistent object)

If the property is null the first time a write operation is done on it the property will be created by the underlying storage

Specified by:
isNull in interface Property
Returns:
true if the property is null, false otherwise

setNull

public void setNull()
             throws DocumentException
Description copied from interface: Property
Nullify this property.

The property is set to null which may result in being removed from the storage (this aspect depends on the implementation)

Specified by:
setNull in interface Property
Throws:
DocumentException

setValue

public void setValue(java.lang.Object value)
              throws DocumentException
Description copied from interface: Property
Sets the value of this property.

Specified by:
setValue in interface Property
Parameters:
value - the value to set
Throws:
DocumentException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.