Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.core.model
Class MockDocument

java.lang.Object
  extended by org.nuxeo.ecm.core.model.MockDocument
All Implemented Interfaces:
Document, DocumentContainer, Lockable, PropertyContainer, VersionableDocument

public class MockDocument
extends java.lang.Object
implements Document

Author:
Anahide Tchertchian

Field Summary
 boolean checkedout
           
 java.lang.String creator
           
 java.lang.String lock
           
 java.lang.String uuid
           
 
Constructor Summary
MockDocument(java.lang.String uuid, java.lang.String creator)
           
 
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 description)
          Creates a new version.
 void checkOut()
           
 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.
 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.
 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.
 DocumentType getType()
          Gets this document's type.
 java.lang.String getUUID()
          Gets this document's UUID.
 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.
 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 isPropertySet(java.lang.String path)
          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 relPath)
          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 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.
 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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

uuid

public java.lang.String uuid

creator

public java.lang.String creator

lock

public java.lang.String lock

checkedout

public boolean checkedout
Constructor Detail

MockDocument

public MockDocument(java.lang.String uuid,
                    java.lang.String creator)
Method Detail

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
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)

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

getType

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

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

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

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.

setLifeCyclePolicy

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

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

setCurrentLifeCycleState

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

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

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

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

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

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

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

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

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

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

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

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

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

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

checkIn

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

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

checkOut

public void checkOut()
              throws DocumentException
Specified by:
checkOut in interface VersionableDocument
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

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

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

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

isCheckedOut

public boolean isCheckedOut()
                     throws DocumentException
Specified by:
isCheckedOut in interface VersionableDocument
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

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

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

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

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

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

resolvePath

public Document resolvePath(java.lang.String relPath)
                     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:
relPath - the path relative to this document
Returns:
the resolved document
Throws:
DocumentException

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.lang.Object> exportMap(java.lang.String schemaName)
                                                           throws DocumentException
Specified by:
exportMap in interface PropertyContainer
Throws:
DocumentException

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

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()};

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

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()};

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

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()};

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()};

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 PropertyContainer
Returns:
the existing properties in this container
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 PropertyContainer
Parameters:
name - the property name to retrieve
Returns:
the property object
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 PropertyContainer
Returns:
the existing properties in this container
Throws:
DocumentException - if any error occurs

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()};

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

isPropertySet

public boolean isPropertySet(java.lang.String path)
                      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 PropertyContainer
Parameters:
path - the path to test
Returns:
true if the property at the given path exists, false otherwise
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

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)}

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

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)}

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)}

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)}

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)}

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

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

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

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

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

getVersionCreationDate

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

getVersionLabel

public java.lang.String getVersionLabel()
                                 throws DocumentException
Specified by:
getVersionLabel 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

getWorkingCopy

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

getCheckinComment

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

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.