public class SQLDocumentProxy extends Object implements SQLDocument
Document.BlobAccessor, Document.WriteContext| Modifier and Type | Field and Description |
|---|---|
static String |
CHANGE_TOKEN_PROXY_SEP |
BINARY_TEXT_SYS_PROP, FULLTEXT_JOBID_SYS_PROP, SIMPLE_TEXT_SYS_PROP| Modifier | Constructor and Description |
|---|---|
protected |
SQLDocumentProxy(Document proxy,
Document target) |
| 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() |
boolean |
equals(Object other) |
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 |
getChangeToken()
Gets the current change token for this document.
|
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.
|
List<Document> |
getChildren()
Gets 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.
|
Node |
getNode()
Returns the node with info about the hierarchy location.
|
Document |
getParent()
Gets the parent document, or
null if this is the root document. |
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 simple property value.
|
protected static String |
getProxyChangeToken(String proxyToken,
String targetToken) |
String |
getRepositoryName()
Gets the repository in which the document lives.
|
protected String |
getSchema(String xpath) |
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.
|
Object |
getValue(String xpath)
Gets a property value.
|
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.
|
Document.WriteContext |
getWriteContext()
Gets a write context for the current 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.
|
int |
hashCode() |
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.
|
protected boolean |
isPropertyForProxy(String xpath)
Checks if the given property should be resolved on the proxy or the target.
|
boolean |
isProxy()
Checks whether or not this document is a proxy.
|
boolean |
isReadOnly()
Checks whether this document is readonly or not.
|
boolean |
isRetentionActive()
Checks whether this document is under active retention.
|
protected boolean |
isSchemaForProxy(String schema)
Checks if the given schema should be resolved on the proxy or the target.
|
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 |
markUserChange()
Marks the document as being modified by a user change.
|
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 simple property value.
|
void |
setReadOnly(boolean readonly)
Sets this document as readonly or not.
|
void |
setRetentionActive(boolean retentionActive)
Sets or unsets this document as under active retention.
|
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 |
setValue(String xpath,
Object value)
Sets a property value.
|
String |
toString() |
boolean |
validateUserVisibleChangeToken(String userVisibleChangeToken)
Validates that the passed user-visible change token is compatible with the one for this document.
|
void |
visitBlobs(Consumer<Document.BlobAccessor> blobVisitor)
Visits all the blobs of this document and calls the passed blob visitor on each one.
|
boolean |
writeDocumentPart(DocumentPart dp,
Document.WriteContext writeContext)
Writes a
DocumentPart to storage. |
public static final String CHANGE_TOKEN_PROXY_SEP
protected SQLDocumentProxy(Document proxy, Document target)
protected boolean isSchemaForProxy(String schema)
protected boolean isPropertyForProxy(String xpath)
public Node getNode()
SQLDocumentgetNode in interface SQLDocumentpublic boolean isProxy()
Documentpublic String getUUID()
Documentpublic String getName()
Documentpublic Long getPos()
Documentpublic Document getParent()
Documentnull if this is the root document.public String getPath()
Documentpublic void remove()
Documentpublic DocumentType getType()
Documentpublic String getRepositoryName()
DocumentgetRepositoryName in interface Documentpublic Session getSession()
DocumentgetSession in interface Documentpublic boolean isFolder()
Documentpublic void setReadOnly(boolean readonly)
DocumentsetReadOnly in interface Documentpublic boolean isReadOnly()
DocumentisReadOnly in interface Documentpublic void readDocumentPart(DocumentPart dp) throws PropertyException
DocumentDocumentPart from storage.
Reading data is done by DocumentPart because of per-proxy schemas.
readDocumentPart in interface DocumentPropertyExceptionpublic Map<String,Serializable> readPrefetch(ComplexType complexType, Set<String> xpaths) throws PropertyException
Document
Reading data is done by ComplexType because of per-proxy schemas.
readPrefetch in interface DocumentPropertyExceptionpublic Document.WriteContext getWriteContext()
DocumentgetWriteContext in interface Documentpublic boolean writeDocumentPart(DocumentPart dp, Document.WriteContext writeContext) throws PropertyException
DocumentDocumentPart to storage.
Writing data is done by DocumentPart because of per-proxy schemas.
writeDocumentPart in interface Documenttrue if something changedPropertyExceptionpublic void setSystemProp(String name, Serializable value)
DocumentsetSystemProp in interface Documentpublic <T extends Serializable> T getSystemProp(String name, Class<T> type)
DocumentgetSystemProp in interface Documentpublic String getChangeToken()
DocumentgetChangeToken in interface Documentprotected static String getProxyChangeToken(String proxyToken, String targetToken)
public boolean validateUserVisibleChangeToken(String userVisibleChangeToken)
DocumentvalidateUserVisibleChangeToken in interface Documentfalse if the change token is not validpublic void markUserChange()
DocumentThis causes an additional change token increment and check during save.
markUserChange in interface Documentpublic Set<String> getAllFacets()
DocumentgetAllFacets in interface Documentpublic String[] getFacets()
Documentpublic boolean hasFacet(String facet)
Documentpublic boolean addFacet(String facet)
DocumentDoes nothing if the facet was already present on the document.
public boolean removeFacet(String facet)
DocumentIt's not possible to remove a facet coming from the document type.
removeFacet in interface Documentfacet - the facet nametrue if the facet was removed, or false if it isn't present or is present on the type or
does not exitpublic void setRetentionActive(boolean retentionActive)
DocumentsetRetentionActive in interface Documentpublic boolean isRetentionActive()
DocumentisRetentionActive in interface Documentpublic String getLifeCyclePolicy()
DocumentgetLifeCyclePolicy in interface Documentpublic void setLifeCyclePolicy(String policy)
DocumentsetLifeCyclePolicy in interface Documentpolicy - the life cycle policypublic String getLifeCycleState()
DocumentgetLifeCycleState in interface Documentpublic void setCurrentLifeCycleState(String state)
DocumentsetCurrentLifeCycleState in interface Documentstate - the life cycle statepublic void followTransition(String transition) throws LifeCycleException
DocumentThis will update the life cycle state of the document.
followTransition in interface Documenttransition - the name of the transition to followLifeCycleExceptionpublic Collection<String> getAllowedStateTransitions()
DocumentgetAllowedStateTransitions in interface Documentpublic Lock getLock()
Documentpublic Lock setLock(Lock lock)
Documentpublic Lock removeLock(String owner)
DocumentremoveLock in interface Documentnull if there was no lock or if removal succeeded, or a lock if it blocks removal due to owner
mismatchpublic boolean isVersion()
Documentpublic Document getBaseVersion()
Document
Returns null for a checked out document or a version or a proxy.
getBaseVersion in interface Documentnullpublic String getVersionSeriesId()
DocumentgetVersionSeriesId in interface Documentpublic Document getSourceDocument()
DocumentFor a version, it's the working copy.
For a proxy, it's the version the proxy points to.
getSourceDocument in interface Documentpublic Document checkIn(String label, String checkinComment)
Documentpublic boolean isCheckedOut()
DocumentisCheckedOut in interface Documenttrue if the document is checked out, or false otherwisepublic boolean isLatestVersion()
DocumentisLatestVersion in interface Documenttrue if this is the latest version, or false otherwisepublic boolean isMajorVersion()
DocumentisMajorVersion in interface Documenttrue if this is a major version, or false otherwisepublic boolean isLatestMajorVersion()
DocumentisLatestMajorVersion in interface Documenttrue if this is the latest major version, or false otherwisepublic boolean isVersionSeriesCheckedOut()
DocumentisVersionSeriesCheckedOut in interface Documenttrue if there is a checked out working copypublic String getVersionLabel()
DocumentgetVersionLabel in interface Documentpublic String getCheckinComment()
DocumentgetCheckinComment in interface Documentnull if it's not a version or a proxypublic Document getWorkingCopy()
DocumentgetWorkingCopy in interface Documentpublic Calendar getVersionCreationDate()
DocumentgetVersionCreationDate in interface Documentnull if it's not a version or a proxypublic void restore(Document version)
Documentpublic List<String> getVersionsIds()
DocumentgetVersionsIds in interface Documentpublic Document getVersion(String label)
DocumentgetVersion in interface Documentlabel - the version labelpublic List<Document> getVersions()
DocumentgetVersions in interface Documentpublic Document getLastVersion()
Document
Returns null if there is no version at all.
getLastVersion in interface Documentnull if there is no versionpublic Document getChild(String name)
Document
Throws DocumentNotFoundException if the document could not be found.
public List<Document> getChildren()
DocumentReturns an empty list for non-folder documents.
getChildren in interface Documentpublic List<String> getChildrenIds()
DocumentReturns an empty list for non-folder documents.
getChildrenIds in interface Documentpublic boolean hasChild(String name)
Document
Returns false for non-folder documents.
public boolean hasChildren()
Document
Returns false for non-folder documents.
hasChildren in interface Documenttrue if the document has children, false otherwisepublic Document addChild(String name, String typeName)
DocumentThrows an error if this document is not a folder.
public void orderBefore(String src, String dest)
Document
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.
orderBefore in interface Documentsrc - the document to movedest - the document before which to place the source documentpublic Document getTargetDocument()
DocumentgetTargetDocument in interface Documentpublic void setTargetDocument(Document target)
DocumentsetTargetDocument in interface Documentpublic Serializable getPropertyValue(String name)
Document
For more generic properties described by an xpath, use Document.getValue(java.lang.String) instead.
getPropertyValue in interface Documentname - the name of the property to getnull if the property is not setDocument.getValue(java.lang.String)public void setPropertyValue(String name, Serializable value)
Document
For more generic properties described by an xpath, use Document.setValue(java.lang.String, java.lang.Object) instead.
setPropertyValue in interface Documentname - the name of the property to setvalue - the value to setDocument.setValue(java.lang.String, java.lang.Object)public Object getValue(String xpath) throws PropertyException
Document
The xpath may point to a partial path, in which case the value may be a complex List or Map.
getValue in interface Documentxpath - the xpath of the property to setnull if the property is not setPropertyException - if the property does not existpublic void setValue(String xpath, Object value) throws PropertyException
Document
The xpath may point to a partial path, in which case the value may be a complex List or Map.
setValue in interface Documentxpath - the xpath of the property to setvalue - the value to setPropertyException - if the property does not exist or the value is of the wrong typepublic void visitBlobs(Consumer<Document.BlobAccessor> blobVisitor) throws PropertyException
DocumentvisitBlobs in interface DocumentPropertyExceptionCopyright © 2018 Nuxeo. All rights reserved.