|
Nuxeo Enterprise Platform 5.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.nuxeo.ecm.core.model.MockDocument
public class MockDocument
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 . |
|
|
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. |
|
|
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 |
---|
public java.lang.String uuid
public java.lang.String creator
public java.lang.String lock
public boolean checkedout
Constructor Detail |
---|
public MockDocument(java.lang.String uuid, java.lang.String creator)
Method Detail |
---|
public java.lang.String getName() throws DocumentException
Document
getName
in interface Document
DocumentException
- if any exception occurredpublic java.lang.String getUUID()
Document
getUUID
in interface Document
public Session getSession()
Document
getSession
in interface Document
public DocumentType getType()
Document
getType
in interface Document
public java.lang.String getPath() throws DocumentException
Document
getPath
in interface Document
DocumentException
public Repository getRepository()
Document
getRepository
in interface Document
public void setLifeCyclePolicy(java.lang.String policy)
Document
setLifeCyclePolicy
in interface Document
policy
- the policypublic void setCurrentLifeCycleState(java.lang.String state)
Document
setCurrentLifeCycleState
in interface Document
state
- the statepublic boolean followTransition(java.lang.String transition) throws LifeCycleException
Document
This will update the current life cycle of the document.
followTransition
in interface Document
transition
- the name of the transition to follow
LifeCycleException
public java.util.Collection<java.lang.String> getAllowedStateTransitions() throws LifeCycleException
Document
getAllowedStateTransitions
in interface Document
LifeCycleException
public Document getBaseVersion() throws DocumentException
VersionableDocument
Returns null
for a checked out document or a version or a proxy.
getBaseVersion
in interface VersionableDocument
null
DocumentException
public java.lang.String getLifeCycleState() throws LifeCycleException
Document
getLifeCycleState
in interface Document
LifeCycleException
org.nuxeo.ecm.core.lifecycle
public java.util.Calendar getLastModified() throws DocumentException
Document
getLastModified
in interface Document
DocumentException
public java.lang.String getLifeCyclePolicy() throws LifeCycleException
Document
getLifeCyclePolicy
in interface Document
LifeCycleException
public Document getParent() throws DocumentException
Document
getParent
in interface Document
DocumentException
public <T extends java.io.Serializable> T getSystemProp(java.lang.String name, java.lang.Class<T> type) throws DocumentException
Document
getSystemProp
in interface Document
DocumentException
public boolean isFolder()
Document
isFolder
in interface Document
public boolean isProxy()
Document
isProxy
in interface Document
public void remove() throws DocumentException
Document
remove
in interface Document
DocumentException
- if an error occurspublic void save() throws DocumentException
Document
For some implementations this may do nothing if they are commiting modifications as they are done by calling the corresponding method.
save
in interface Document
DocumentException
- if an error occurspublic <T extends java.io.Serializable> void setSystemProp(java.lang.String name, T value) throws DocumentException
Document
setSystemProp
in interface Document
DocumentException
public Document checkIn(java.lang.String label, java.lang.String description) throws DocumentException
VersionableDocument
checkIn
in interface VersionableDocument
label
- the version labeldescription
- the checkin comment
DocumentException
public void checkOut() throws DocumentException
checkOut
in interface VersionableDocument
DocumentException
public Document getLastVersion() throws DocumentException
VersionableDocument
getLastVersion
in interface VersionableDocument
DocumentException
public Document getSourceDocument() throws DocumentException
VersionableDocument
getSourceDocument
in interface VersionableDocument
DocumentException
public java.util.List<java.lang.String> getVersionsIds() throws DocumentException
VersionableDocument
getVersionsIds
in interface VersionableDocument
DocumentException
public Document getVersion(java.lang.String label) throws DocumentException
VersionableDocument
getVersion
in interface VersionableDocument
label
- the version label
DocumentException
public java.util.List<Document> getVersions() throws DocumentException
getVersions
in interface VersionableDocument
DocumentException
public boolean hasVersions() throws DocumentException
VersionableDocument
Needed to know if we need to use checkin/checkout methods when changing a document.
hasVersions
in interface VersionableDocument
DocumentException
public boolean isCheckedOut() throws DocumentException
isCheckedOut
in interface VersionableDocument
DocumentException
public boolean isVersion()
VersionableDocument
isVersion
in interface VersionableDocument
public java.lang.String getVersionSeriesId() throws DocumentException
VersionableDocument
getVersionSeriesId
in interface VersionableDocument
DocumentException
public void restore(Document version) throws DocumentException
VersionableDocument
restore
in interface VersionableDocument
version
- the version to replace with
DocumentException
public Document addChild(java.lang.String name, java.lang.String typeName) throws DocumentException
DocumentContainer
This operation throws an error if the current document is not a folder.
addChild
in interface DocumentContainer
name
- the name of the new child to createtypeName
- the type of the child to create
DocumentException
public Document getChild(java.lang.String name) throws DocumentException
DocumentContainer
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.
getChild
in interface DocumentContainer
name
- the name of the child to retrieve
DocumentException
public java.util.Iterator<Document> getChildren() throws DocumentException
DocumentContainer
This operation silently ignores non-folder documents: if the document is not a folder then it returns an empty iterator.
getChildren
in interface DocumentContainer
DocumentException
public DocumentIterator getChildren(int start) throws DocumentException
getChildren
in interface DocumentContainer
DocumentException
public java.util.List<java.lang.String> getChildrenIds() throws DocumentException
DocumentContainer
getChildrenIds
in interface DocumentContainer
DocumentException
public boolean hasChild(java.lang.String name) throws DocumentException
DocumentContainer
This operation silently ignores non-folder documents: If the document is not a folder then return false.
hasChild
in interface DocumentContainer
name
- the name of the child to test
DocumentException
public boolean hasChildren() throws DocumentException
DocumentContainer
This operation silently ignores non-folder documents: If the document is not a folder then returns false.
hasChildren
in interface DocumentContainer
DocumentException
public void removeChild(java.lang.String name) throws DocumentException
DocumentContainer
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
removeChild
in interface DocumentContainer
name
- the child name
DocumentException
public Document resolvePath(java.lang.String relPath) throws DocumentException
DocumentContainer
If the path is absolute then it will be transformed in a relative path (i.e. the leading '/' removed).
resolvePath
in interface DocumentContainer
relPath
- the path relative to this document
DocumentException
public java.util.Map<java.lang.String,java.lang.Object> exportFlatMap(java.lang.String[] schemas) throws DocumentException
PropertyContainer
If the given schemas array is null then all schemas will be exported.
exportFlatMap
in interface PropertyContainer
DocumentException
- if any error occurspublic java.util.Map<java.lang.String,java.lang.Object> exportMap(java.lang.String schemaName) throws DocumentException
exportMap
in interface PropertyContainer
DocumentException
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> exportMap(java.lang.String[] schemas) throws DocumentException
PropertyContainer
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
exportMap
in interface PropertyContainer
DocumentException
- if any error occurspublic boolean getBoolean(java.lang.String name) throws DocumentException
PropertyContainer
boolean
.
This is a shortcut for getScalar(name).getBoolean()
getBoolean
in interface PropertyContainer
DocumentException
- if any error occursSimpleProperty#getBoolean()};
public Blob getContent(java.lang.String name) throws DocumentException
PropertyContainer
getContent
in interface PropertyContainer
DocumentException
- if any error occurspublic java.util.Calendar getDate(java.lang.String name) throws DocumentException
PropertyContainer
date
.
This is a shortcut for getScalar(name).getDate()
getDate
in interface PropertyContainer
DocumentException
- if any error occursSimpleProperty#getDate()};
public java.util.List<java.lang.String> getDirtyFields()
PropertyContainer
XXX AT: compatibility method for NXP-666
getDirtyFields
in interface PropertyContainer
public double getDouble(java.lang.String name) throws DocumentException
PropertyContainer
double
.
This is a shortcut for getScalar(name).getDouble()
getDouble
in interface PropertyContainer
DocumentException
- if any error occursSimpleProperty#getDouble()};
public long getLong(java.lang.String name) throws DocumentException
PropertyContainer
long
.
This is a shortcut for getScalar(name).getLong()
getLong
in interface PropertyContainer
DocumentException
- if any error occursSimpleProperty#getLong()};
public java.util.Collection<Property> getProperties() throws DocumentException
PropertyContainer
The returned properties are existing.
getProperties
in interface PropertyContainer
DocumentException
- if any error occurspublic Property getProperty(java.lang.String name) throws DocumentException
PropertyContainer
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.
getProperty
in interface PropertyContainer
name
- the property name to retrieve
DocumentException
- if any error occurspublic java.util.Iterator<Property> getPropertyIterator() throws DocumentException
PropertyContainer
The returned properties are existing.
getPropertyIterator
in interface PropertyContainer
DocumentException
- if any error occurspublic java.lang.Object getPropertyValue(java.lang.String name) throws DocumentException
PropertyContainer
This is a shortcut for getProperty(String).getValue()
getPropertyValue
in interface PropertyContainer
name
- the name of the property to set
null
if the property is not
set.
DocumentException
- if any error occursfor the list of supported value
objects
public java.lang.String getString(java.lang.String name) throws DocumentException
PropertyContainer
string
.
This is a shortcut for getScalar(name).getString()
getString
in interface PropertyContainer
DocumentException
- if any error occursSimpleProperty#getString()};
public void importFlatMap(java.util.Map<java.lang.String,java.lang.Object> map) throws DocumentException
PropertyContainer
importFlatMap
in interface PropertyContainer
DocumentException
- if any error occurspublic void importMap(java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> map) throws DocumentException
PropertyContainer
The property tree is recursively traversed and all property exported as entry of the Map.
importMap
in interface PropertyContainer
DocumentException
- if any error occurspublic boolean isPropertySet(java.lang.String path) throws DocumentException
PropertyContainer
isPropertySet
in interface PropertyContainer
path
- the path to test
DocumentException
- if any error occurspublic void removeProperty(java.lang.String name) throws DocumentException
PropertyContainer
removeProperty
in interface PropertyContainer
name
- the property to remove
DocumentException
- if any error occurspublic void setBoolean(java.lang.String name, boolean value) throws DocumentException
PropertyContainer
If the property with that name doesn't exists, it will be created.
This is a shortcut to create or set boolean properties.
setBoolean
in interface PropertyContainer
DocumentException
- if any error occursSimpleProperty#setBoolean(boolean)}
public void setContent(java.lang.String name, Blob value) throws DocumentException
PropertyContainer
If the property with that name doesn't exists, it will be created
setContent
in interface PropertyContainer
DocumentException
- if any error occurspublic void setDate(java.lang.String name, java.util.Calendar value) throws DocumentException
PropertyContainer
If the property with that name doesn't exists, it will be created
This is a shortcut to create or set date properties.
setDate
in interface PropertyContainer
DocumentException
- if any error occursSimpleProperty#setDate(Calendar)}
public void setDouble(java.lang.String name, double value) throws DocumentException
PropertyContainer
If the property with that name doesn't exists, it will be created.
This is a shortcut to create or set double properties
setDouble
in interface PropertyContainer
DocumentException
- if any error occursSimpleProperty#setDouble(double)}
public void setLong(java.lang.String name, long value) throws DocumentException
PropertyContainer
If the property with that name doesn't exists, it will be created.
This is a shortcut to create or set long properties.
setLong
in interface PropertyContainer
DocumentException
- if any error occursSimpleProperty#setLong(long)}
public void setPropertyValue(java.lang.String name, java.lang.Object value) throws DocumentException
PropertyContainer
This is a shortcut for getProperty(String).setValue(Object)
The following type of objects can be used as values depending on the property type:
String
- for string properties
Boolean
- for boolean properties
Number
- for numeric (long and double) properties
Calendar
- for date properties
ContentSource
- for content properties
setPropertyValue
in interface PropertyContainer
name
- the name of the property to setvalue
- the value to set
DocumentException
- if any error occurspublic void setString(java.lang.String name, java.lang.String value) throws DocumentException
PropertyContainer
If the property with that name doesn't exists, it will be created.
This is a shortcut to create or set string properties.
setString
in interface PropertyContainer
DocumentException
- if any error occursSimpleProperty#setString(String)}
public java.lang.String getLock() throws DocumentException
Lockable
getLock
in interface Lockable
DocumentException
public boolean isLocked() throws DocumentException
Lockable
isLocked
in interface Lockable
DocumentException
public void setLock(java.lang.String key) throws DocumentException
Lockable
The lock key cannot be null.
setLock
in interface Lockable
key
- the lock key
DocumentException
public java.lang.String unlock() throws DocumentException
Lockable
unlock
in interface Lockable
DocumentException
public void readDocumentPart(DocumentPart dp) throws java.lang.Exception
Document
readDocumentPart
in interface Document
java.lang.Exception
public void writeDocumentPart(DocumentPart dp) throws java.lang.Exception
Document
writeDocumentPart
in interface Document
java.lang.Exception
public void orderBefore(java.lang.String src, java.lang.String dest) throws DocumentException
DocumentContainer
orderBefore
in interface DocumentContainer
src
- the document to movedest
- the document before which to place the source document
DocumentException
- if this document is not an orderable folder or any other exception occurspublic java.util.Calendar getVersionCreationDate() throws DocumentException
getVersionCreationDate
in interface VersionableDocument
DocumentException
public java.lang.String getVersionLabel() throws DocumentException
getVersionLabel
in interface VersionableDocument
DocumentException
public boolean isLatestVersion() throws DocumentException
isLatestVersion
in interface VersionableDocument
DocumentException
public boolean isMajorVersion() throws DocumentException
isMajorVersion
in interface VersionableDocument
DocumentException
public boolean isLatestMajorVersion() throws DocumentException
isLatestMajorVersion
in interface VersionableDocument
DocumentException
public boolean isVersionSeriesCheckedOut() throws DocumentException
isVersionSeriesCheckedOut
in interface VersionableDocument
DocumentException
public Document getWorkingCopy() throws DocumentException
getWorkingCopy
in interface VersionableDocument
DocumentException
public java.lang.String getCheckinComment() throws DocumentException
getCheckinComment
in interface VersionableDocument
DocumentException
|
Nuxeo Enterprise Platform 5.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |