public class SQLDocumentLive extends SQLComplexProperty implements SQLDocument
DC_ISSUED, RELATED_TEXT_RESOURCES
BINARY_TEXT_SYS_PROP, FULLTEXT_JOBID_SYS_PROP, SIMPLE_TEXT_SYS_PROP
Modifier and Type | Method and Description |
---|---|
Document |
addChild(String name,
String typeName)
Creates a new child document given its typename.
|
boolean |
addFacet(String facet)
Adds a facet to the document instance.
|
Document |
checkIn(String label,
String checkinComment)
Creates a new version.
|
void |
checkOut() |
boolean |
equals(Object other) |
boolean |
followTransition(String transition)
Follows a given life cycle transition.
|
Property |
getACLProperty()
Returns the property holding the ACL.
|
Set<String> |
getAllFacets()
Gets the facets available on this document (from the type and the
instance facets).
|
Collection<String> |
getAllowedStateTransitions()
Returns the allowed state transitions for this document.
|
Document |
getBaseVersion()
Gets the version to which a checked in document is linked.
|
String |
getCheckinComment() |
Document |
getChild(String name)
Gets a child document given its name.
|
Iterator<Document> |
getChildren()
Gets an iterator over the children of the document.
|
DocumentIterator |
getChildren(int start) |
List<String> |
getChildrenIds()
Gets a list of the children ids.
|
String[] |
getFacets()
Gets the facets defined on this document instance.
|
Calendar |
getLastModified()
Gets the last modification time on this document.
|
Document |
getLastVersion()
Gets the last version of this document.
|
String |
getLifeCyclePolicy()
Returns the life cycle policy of this document.
|
String |
getLifeCycleState()
Returns the life cycle of the document.
|
Lock |
getLock()
Gets the lock key if a lock exists on the current object.
|
Document |
getParent()
Gets the parent document or null if this is the root document.
|
String |
getPath()
Gets the path of this document.
|
Property |
getProperty(String name)
Gets the children property given its name.
|
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.
|
<T extends Serializable> |
getSystemProp(String name,
Class<T> type)
Get system property of the specified type.
|
DocumentType |
getType()
Gets the property type.
|
String |
getUUID()
Gets this document's UUID.
|
Document |
getVersion(String label)
Gets a version of this document, given its label.
|
Calendar |
getVersionCreationDate() |
String |
getVersionLabel() |
List<Document> |
getVersions() |
String |
getVersionSeriesId()
Gets the version series id.
|
List<String> |
getVersionsIds()
Gets the list of version ids for this document.
|
Document |
getWorkingCopy() |
boolean |
hasChild(String name)
Tests if the document has the named child.
|
boolean |
hasChildren()
Tests if the document has any children.
|
boolean |
hasFacet(String facet)
Checks if the document has a facet, either from its type or added on the
instance.
|
int |
hashCode() |
boolean |
hasVersions()
Tells the caller if this document has versions or not.
|
boolean |
isCheckedOut() |
boolean |
isFolder()
Tests whether this document represent a folder or a leaf document.
|
boolean |
isLatestMajorVersion() |
boolean |
isLatestVersion() |
boolean |
isMajorVersion() |
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(String src,
String dest)
Orders the given source child before the destination child.
|
void |
readDocumentPart(DocumentPart dp)
Reads into the
DocumentPart the values from this
SQLDocument . |
void |
remove()
Removes this document and all its children, if any.
|
void |
removeChild(String name)
Removes the child having the given name
|
boolean |
removeFacet(String facet)
Removes a facet from the document instance.
|
Lock |
removeLock(String owner)
Removes a lock on the current document.
|
Document |
resolvePath(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 |
setCurrentLifeCycleState(String state)
Sets the lifecycle state of the document.
|
void |
setLifeCyclePolicy(String policy)
Sets the life cycle policy of this document.
|
Lock |
setLock(Lock lock)
Sets a lock on the current document.
|
<T extends Serializable> |
setSystemProp(String name,
T value)
Set a system property which is a property of by the built-in node type
ECM_SYSTEM_ANY.
|
String |
toString() |
void |
writeDocumentPart(DocumentPart dp)
Writes into this
SQLDocument the values from the
DocumentPart . |
exportFlatMap, exportMap, exportMap, getBoolean, getContent, getDate, getDirtyFields, getDouble, getLong, getName, getNode, getProperties, getPropertyIterator, getPropertyValue, getString, getValue, importFlatMap, importMap, isPropertySet, removeProperty, setBoolean, setContent, setDate, setDouble, setLong, setPropertyValue, setString, setValue
checkWritable, isNull, isSpecialSystemProperty, setNull
checkWritable, getNode
exportFlatMap, exportMap, exportMap, getBoolean, getContent, getDate, getDirtyFields, getDouble, getLong, getProperties, getPropertyIterator, getPropertyValue, getString, importFlatMap, importMap, isPropertySet, removeProperty, setBoolean, setContent, setDate, setDouble, setLong, setPropertyValue, setString
getName, getProperties, getPropertyIterator, getValue, isNull, isPropertySet, setNull, setValue
public Property getACLProperty() throws DocumentException
SQLDocument
getACLProperty
in interface SQLDocument
DocumentException
public DocumentType getType()
Property
public Session getSession()
Document
getSession
in interface Document
public boolean isFolder()
Document
public String getUUID()
Document
public Document getParent() throws DocumentException
Document
getParent
in interface Document
DocumentException
public String getPath() throws DocumentException
Document
getPath
in interface Document
DocumentException
public Calendar getLastModified()
Document
getLastModified
in interface Document
public boolean isProxy()
Document
public Repository getRepository()
Document
getRepository
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 void readDocumentPart(DocumentPart dp) throws Exception
DocumentPart
the values from this
SQLDocument
.readDocumentPart
in interface Document
Exception
public Property getProperty(String name) throws DocumentException
Property
getProperty
in interface Property
getProperty
in interface PropertyContainer
getProperty
in class SQLComplexProperty
name
- the property nameDocumentException
- if any error occurspublic void writeDocumentPart(DocumentPart dp) throws Exception
SQLDocument
the values from the
DocumentPart
.writeDocumentPart
in interface Document
Exception
public <T extends Serializable> void setSystemProp(String name, T value) throws DocumentException
Document
setSystemProp
in interface Document
DocumentException
public <T extends Serializable> T getSystemProp(String name, Class<T> type) throws DocumentException
Document
getSystemProp
in interface Document
DocumentException
public String getLifeCyclePolicy() throws LifeCycleException
Document
getLifeCyclePolicy
in interface Document
LifeCycleException
public void setLifeCyclePolicy(String policy) throws LifeCycleException
Document
setLifeCyclePolicy
in interface Document
policy
- the policyLifeCycleException
public String getLifeCycleState() throws LifeCycleException
Document
getLifeCycleState
in interface Document
LifeCycleException
org.nuxeo.ecm.core.lifecycle
public void setCurrentLifeCycleState(String state) throws LifeCycleException
Document
setCurrentLifeCycleState
in interface Document
state
- the stateLifeCycleException
public boolean followTransition(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 followLifeCycleException
public Collection<String> getAllowedStateTransitions() throws LifeCycleException
Document
getAllowedStateTransitions
in interface Document
LifeCycleException
public Lock getLock() throws DocumentException
Lockable
getLock
in interface Lockable
DocumentException
public Lock setLock(Lock lock) throws DocumentException
Lockable
setLock
in interface Lockable
lock
- the lock to setDocumentException
public Lock removeLock(String owner) throws DocumentException
Lockable
removeLock
in interface Lockable
null
if there was no lock or if removal succeeded, or a
lock if it blocks removal due to owner mismatchDocumentException
public boolean isVersion()
VersionableDocument
isVersion
in interface VersionableDocument
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 String getVersionSeriesId() throws DocumentException
VersionableDocument
getVersionSeriesId
in interface VersionableDocument
DocumentException
public Document getSourceDocument() throws DocumentException
VersionableDocument
getSourceDocument
in interface VersionableDocument
DocumentException
public Document checkIn(String label, String checkinComment) throws DocumentException
VersionableDocument
checkIn
in interface VersionableDocument
label
- the version labelcheckinComment
- the checkin commentDocumentException
public void checkOut() throws DocumentException
checkOut
in interface VersionableDocument
DocumentException
public boolean isCheckedOut() throws DocumentException
isCheckedOut
in interface VersionableDocument
DocumentException
public boolean isMajorVersion() throws DocumentException
isMajorVersion
in interface VersionableDocument
DocumentException
public boolean isLatestVersion() throws DocumentException
isLatestVersion
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 String getVersionLabel() throws DocumentException
getVersionLabel
in interface VersionableDocument
DocumentException
public String getCheckinComment() throws DocumentException
getCheckinComment
in interface VersionableDocument
DocumentException
public Document getWorkingCopy() throws DocumentException
getWorkingCopy
in interface VersionableDocument
DocumentException
public Calendar getVersionCreationDate() throws DocumentException
getVersionCreationDate
in interface VersionableDocument
DocumentException
public void restore(Document version) throws DocumentException
VersionableDocument
restore
in interface VersionableDocument
version
- the version to replace withDocumentException
public List<String> getVersionsIds() throws DocumentException
VersionableDocument
getVersionsIds
in interface VersionableDocument
DocumentException
public Document getVersion(String label) throws DocumentException
VersionableDocument
getVersion
in interface VersionableDocument
label
- the version labelDocumentException
public List<Document> getVersions() throws DocumentException
getVersions
in interface VersionableDocument
DocumentException
public Document getLastVersion() throws DocumentException
VersionableDocument
getLastVersion
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 Document resolvePath(String path) 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
path
- the path relative to this documentDocumentException
public Document getChild(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 retrieveDocumentException
public 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 List<String> getChildrenIds() throws DocumentException
DocumentContainer
getChildrenIds
in interface DocumentContainer
DocumentException
public boolean hasChild(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 testDocumentException
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 Document addChild(String name, 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 createDocumentException
public void orderBefore(String src, String dest) throws DocumentException
DocumentContainer
orderBefore
in interface DocumentContainer
src
- the document to movedest
- the document before which to place the source documentDocumentException
- if this document is not an orderable folder or any other exception occurspublic void removeChild(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 nameDocumentException
public Set<String> getAllFacets()
Document
getAllFacets
in interface Document
public String[] getFacets()
Document
public boolean hasFacet(String facet)
Document
public boolean addFacet(String facet) throws DocumentException
Document
Does nothing if the facet was already present on the document.
addFacet
in interface Document
facet
- the facet nametrue
if the facet was added, or false
if it is
already presentDocumentException
- if the facet does not existpublic boolean removeFacet(String facet) throws DocumentException
Document
It's not possible to remove a facet coming from the document type.
removeFacet
in interface Document
facet
- the facet nametrue
if the facet was removed, or false
if it
isn't present or is present on the type or does not exitDocumentException
Copyright © 2013 Nuxeo SA. All Rights Reserved.