public interface Document
Session
.Modifier and Type | Method and Description |
---|---|
Document |
addChild(String name,
String typeName)
Creates a new child document of the given type.
|
boolean |
addFacet(String facet)
Adds a facet to this document.
|
Document |
checkIn(String label,
String checkinComment)
Creates a new version.
|
void |
checkOut() |
void |
followTransition(String transition)
Follows a given life cycle transition.
|
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()
Gets the version check in comment of this document if it's a version or a proxy.
|
Document |
getChild(String name)
Gets a child document given its name.
|
Iterator<Document> |
getChildren()
Gets an iterator over the children of the document.
|
List<String> |
getChildrenIds()
Gets a list of the children ids.
|
String[] |
getFacets()
Gets the facets defined on this document instance.
|
Document |
getLastVersion()
Gets the last version of this document.
|
String |
getLifeCyclePolicy()
Gets the life cycle policy of this document.
|
String |
getLifeCycleState()
Gets the life cycle state of this document.
|
Lock |
getLock()
Gets the lock if one set on this document.
|
String |
getName()
Gets the name of this document.
|
Document |
getParent()
Gets the parent document, or
null if this is the root document. |
String |
getPath()
Gets the path of this document.
|
Long |
getPos()
Gets the document's position in its containing folder (if ordered).
|
Serializable |
getPropertyValue(String name)
Gets a property value.
|
String |
getRepositoryName()
Gets the repository in which the document lives.
|
Session |
getSession()
Gets the session that owns this document.
|
Document |
getSourceDocument()
Gets the source for this document.
|
<T extends Serializable> |
getSystemProp(String name,
Class<T> type)
Gets a system property.
|
Document |
getTargetDocument()
Gets the document (version or live document) to which this proxy points.
|
DocumentType |
getType()
Gets the type of this document.
|
String |
getUUID()
Gets this document's UUID.
|
Document |
getVersion(String label)
Gets a version of this document, given its label.
|
Calendar |
getVersionCreationDate()
Gets the version creation date of this document if it's a version or a proxy.
|
String |
getVersionLabel()
Gets the version label.
|
List<Document> |
getVersions()
Gets the versions for this document.
|
String |
getVersionSeriesId()
Gets the version series id.
|
List<String> |
getVersionsIds()
Gets the list of version ids for this document.
|
Document |
getWorkingCopy()
Gets the working copy for this document.
|
boolean |
hasChild(String name)
Checks whether this document has a child of the given name.
|
boolean |
hasChildren()
Tests if the document has any children.
|
boolean |
hasFacet(String facet)
Checks whether this document has a given facet, either from its type or added on the instance.
|
boolean |
isCheckedOut()
Checks whether this document is checked out.
|
boolean |
isFolder()
Checks whether this document is a folder.
|
boolean |
isLatestMajorVersion()
Checks whether this document is the latest major version.
|
boolean |
isLatestVersion()
Checks whether this document is the latest version.
|
boolean |
isMajorVersion()
Checks whether this document is a major version.
|
boolean |
isProxy()
Checks whether or not this document is a proxy.
|
boolean |
isReadOnly()
Checks whether this document is readonly or not.
|
boolean |
isVersion()
Checks whether this document is a version document.
|
boolean |
isVersionSeriesCheckedOut()
Checks if there is a checked out working copy for the version series of this document.
|
void |
orderBefore(String src,
String dest)
Orders the given source child before the destination child.
|
void |
readDocumentPart(DocumentPart dp)
Loads a
DocumentPart from storage. |
Map<String,Serializable> |
readPrefetch(ComplexType complexType,
Set<String> xpaths)
Reads a set of prefetched fields.
|
void |
remove()
Removes this document and all its children, if any.
|
boolean |
removeFacet(String facet)
Removes a facet from this document.
|
Lock |
removeLock(String owner)
Removes a lock from this document.
|
void |
restore(Document version)
Replaces this document's content with the version specified.
|
void |
setCurrentLifeCycleState(String state)
Sets the life cycle state of this document.
|
void |
setLifeCyclePolicy(String policy)
Sets the life cycle policy of this document.
|
Lock |
setLock(Lock lock)
Sets a lock on this document.
|
void |
setPropertyValue(String name,
Serializable value)
Sets a property value.
|
void |
setReadOnly(boolean readonly)
Sets this document as readonly or not.
|
void |
setSystemProp(String name,
Serializable value)
Sets a system property.
|
void |
setTargetDocument(Document target)
Sets the document (version or live document) to which this proxy points.
|
void |
writeDocumentPart(DocumentPart dp)
Writes a
DocumentPart to storage. |
Session getSession()
String getName()
Long getPos()
String getUUID()
Document getParent() throws DocumentException
null
if this is the root document.null
DocumentException
DocumentType getType()
String getPath() throws DocumentException
DocumentException
void setPropertyValue(String name, Serializable value) throws DocumentException
name
- the name of the property to setvalue
- the value to setDocumentException
Serializable getPropertyValue(String name) throws DocumentException
name
- the name of the property to getnull
if the property is not setDocumentException
boolean isFolder()
true
if the document is a folder, false
otherwisevoid setReadOnly(boolean readonly)
boolean isReadOnly()
void remove() throws DocumentException
DocumentException
String getLifeCycleState() throws LifeCycleException
LifeCycleException
void setCurrentLifeCycleState(String state) throws LifeCycleException
state
- the life cycle stateLifeCycleException
String getLifeCyclePolicy() throws LifeCycleException
LifeCycleException
void setLifeCyclePolicy(String policy) throws LifeCycleException
policy
- the life cycle policyLifeCycleException
void followTransition(String transition) throws LifeCycleException
This will update the life cycle state of the document.
transition
- the name of the transition to followLifeCycleException
Collection<String> getAllowedStateTransitions() throws LifeCycleException
LifeCycleException
boolean isProxy()
true
if this document is a proxy, false
otherwiseString getRepositoryName()
void setSystemProp(String name, Serializable value) throws DocumentException
DocumentException
<T extends Serializable> T getSystemProp(String name, Class<T> type) throws DocumentException
DocumentException
void readDocumentPart(DocumentPart dp) throws PropertyException
DocumentPart
from storage.
Reading data is done by DocumentPart
because of per-proxy schemas.
PropertyException
Map<String,Serializable> readPrefetch(ComplexType complexType, Set<String> xpaths) throws PropertyException
Reading data is done by ComplexType
because of per-proxy schemas.
PropertyException
void writeDocumentPart(DocumentPart dp) throws PropertyException
DocumentPart
to storage.
Writing data is done by DocumentPart
because of per-proxy schemas.
PropertyException
Set<String> getAllFacets()
String[] getFacets()
boolean hasFacet(String facet)
facet
- the facet nametrue
if the document has the facetboolean addFacet(String facet) throws DocumentException
Does nothing if the facet was already present on the document.
facet
- the facet nametrue
if the facet was added, or false
if it is already presentDocumentException
- if the facet does not existboolean removeFacet(String facet) throws DocumentException
It's not possible to remove a facet coming from the document type.
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
Lock setLock(Lock lock) throws DocumentException
lock
- the lock to setnull
if locking succeeded, or the existing lock if locking failedDocumentException
Lock removeLock(String owner) throws DocumentException
the
- owner to check, or null
for no checknull
if there was no lock or if removal succeeded, or a lock if it blocks removal due to owner
mismatchDocumentException
Lock getLock() throws DocumentException
null
if no lock is setDocumentException
Document getChild(String name) throws DocumentException
Throws NoSuchDocumentException
if the document could not be found.
name
- the name of the child to retrieveNoSuchDocumentException
- if the child does not existDocumentException
Iterator<Document> getChildren() throws DocumentException
Returns an empty iterator for non-folder documents.
DocumentException
List<String> getChildrenIds() throws DocumentException
Returns an empty list for non-folder documents.
DocumentException
boolean hasChild(String name) throws DocumentException
Returns false
for non-folder documents.
name
- the name of the child to checktrue
if the child exists, false
otherwiseDocumentException
boolean hasChildren() throws DocumentException
Returns false
for non-folder documents.
true
if the document has children, false
otherwiseDocumentException
Document addChild(String name, String typeName) throws DocumentException
Throws an error if this document is not a folder.
name
- the name of the new child to createtypeName
- the type of the child to createDocumentException
void orderBefore(String src, String dest) throws DocumentException
Both source and destination must be names that point to child documents of this 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.
src
- the document to movedest
- the document before which to place the source documentDocumentException
- if this document is not an orderable folderDocument checkIn(String label, String checkinComment) throws DocumentException
label
- the version labelcheckinComment
- the checkin commentDocumentException
void checkOut() throws DocumentException
DocumentException
List<String> getVersionsIds() throws DocumentException
DocumentException
List<Document> getVersions() throws DocumentException
DocumentException
Document getLastVersion() throws DocumentException
Returns null
if there is no version at all.
null
if there is no versionDocumentException
Document getSourceDocument() throws DocumentException
For a version, it's the working copy.
For a proxy, it's the version the proxy points to.
DocumentException
void restore(Document version) throws DocumentException
version
- the version to replace withDocumentException
Document getVersion(String label) throws DocumentException
label
- the version labelDocumentException
boolean isVersion()
true
if it's a version, false
otherwiseDocument getBaseVersion() throws DocumentException
Returns null
for a checked out document or a version or a proxy.
null
DocumentException
boolean isCheckedOut() throws DocumentException
true
if the document is checked out, or false
otherwiseDocumentException
Calendar getVersionCreationDate() throws DocumentException
null
if it's not a version or a proxyDocumentException
String getCheckinComment() throws DocumentException
null
if it's not a version or a proxyDocumentException
String getVersionSeriesId() throws DocumentException
DocumentException
String getVersionLabel() throws DocumentException
DocumentException
boolean isLatestVersion() throws DocumentException
true
if this is the latest version, or false
otherwiseDocumentException
boolean isMajorVersion() throws DocumentException
true
if this is a major version, or false
otherwiseDocumentException
boolean isLatestMajorVersion() throws DocumentException
true
if this is the latest major version, or false
otherwiseDocumentException
boolean isVersionSeriesCheckedOut() throws DocumentException
true
if there is a checked out working copyDocumentException
Document getWorkingCopy() throws DocumentException
DocumentException
Document getTargetDocument() throws DocumentException
DocumentException
void setTargetDocument(Document target) throws DocumentException
DocumentException
Copyright © 2015 Nuxeo SA. All rights reserved.