public class SQLDocumentProxy extends Object implements SQLDocument, DocumentProxy
BINARY_TEXT_SYS_PROP, FULLTEXT_JOBID_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() |
void |
checkWritable()
Raises an exception if the document is read-only.
|
boolean |
equals(Object other) |
Map<String,Object> |
exportFlatMap(String[] schemas)
Exports a flat view of properties in this document.
|
Map<String,Object> |
exportMap(String schemaName) |
Map<String,Map<String,Object>> |
exportMap(String[] schemas)
Exports the properties belonging to the given schemas as a java Map.
|
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.
|
boolean |
getBoolean(String name)
Gets the value of a scalar property as a
boolean. |
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.
|
Blob |
getContent(String name)
Gets the value of the named content property.
|
Calendar |
getDate(String name)
Gets the value of a scalar property as a
date. |
List<String> |
getDirtyFields()
Returns fields that were modified.
|
double |
getDouble(String name)
Gets the value of a scalar property as a
double. |
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.
|
long |
getLong(String name)
Gets the value of a scalar property as a
long. |
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.
|
Collection<Property> |
getProperties()
Gets the collection of the sub properties in this container.
|
Property |
getProperty(String name)
Gets a property given its name.
|
Iterator<Property> |
getPropertyIterator()
Gets an iterator over all existing properties in this container.
|
Object |
getPropertyValue(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.
|
String |
getString(String name)
Gets the value of a scalar property as a
string. |
<T extends Serializable> |
getSystemProp(String name,
Class<T> type)
Get system property of the specified type.
|
Document |
getTargetDocument()
Gets the document (version or live document) to which this proxy points.
|
DocumentType |
getType()
Gets this document's type.
|
String |
getUUID()
Gets this document's UUID.
|
Object |
getValue()
Gets the value of this property.
|
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.
|
void |
importFlatMap(Map<String,Object> map)
Imports a flat map of properties into this document.
|
void |
importMap(Map<String,Map<String,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 |
isMajorVersion() |
boolean |
isNull()
Tests whether or not this property is null.
|
boolean |
isPropertySet(String name)
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(String src,
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(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.
|
void |
removeProperty(String name)
Removes the property with the given name.
|
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 |
setBoolean(String name,
boolean value)
Sets the scalar property value to the given boolean value.
|
void |
setContent(String name,
Blob value)
Sets the content property to the given value.
|
void |
setCurrentLifeCycleState(String state)
Sets the lifecycle state of the document.
|
void |
setDate(String name,
Calendar value)
Sets the scalar property value to the given date value.
|
void |
setDouble(String name,
double value)
Set the scalar property value to the given double value.
|
void |
setLifeCyclePolicy(String policy)
Sets the life cycle policy of this document.
|
Lock |
setLock(Lock lock)
Sets a lock on the current document.
|
void |
setLong(String name,
long value)
Sets the scalar property value to the given long value.
|
void |
setNull()
Nullify this property.
|
void |
setPropertyValue(String name,
Object value)
Generic method to set a property value.
|
void |
setString(String name,
String value)
Sets the scalar property value to the given string value.
|
<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.
|
void |
setTargetDocument(Document target)
Sets the document (version or live document) to which this proxy points.
|
void |
setValue(Object value)
Sets the value of this property.
|
String |
toString() |
void |
writeDocumentPart(DocumentPart dp)
Read modifications in the given document part and write them on storage.
|
public Node getNode()
SQLDocumentgetNode in interface SQLDocumentpublic Property getACLProperty() throws DocumentException
SQLDocumentgetACLProperty in interface SQLDocumentDocumentExceptionpublic void checkWritable()
throws DocumentException
SQLDocumentcheckWritable in interface SQLDocumentDocumentExceptionpublic boolean isProxy()
Documentpublic String getName() throws DocumentException
DocumentgetName in interface DocumentgetName in interface PropertyDocumentException - if any exception occurredpublic String getUUID()
Documentpublic Document getParent() throws DocumentException
DocumentgetParent in interface DocumentDocumentExceptionpublic String getPath() throws DocumentException
DocumentgetPath in interface DocumentDocumentExceptionpublic void remove()
throws DocumentException
Documentremove in interface DocumentDocumentException - if an error occurspublic DocumentType getType()
Documentpublic Repository getRepository()
DocumentgetRepository in interface Documentpublic Session getSession()
DocumentgetSession in interface Documentpublic boolean isFolder()
Documentpublic Calendar getLastModified() throws DocumentException
DocumentgetLastModified in interface DocumentDocumentExceptionpublic void save()
throws DocumentException
DocumentFor some implementations this may do nothing if they are commiting modifications as they are done by calling the corresponding method.
save in interface DocumentDocumentException - if an error occurspublic void readDocumentPart(DocumentPart dp) throws Exception
DocumentreadDocumentPart in interface DocumentExceptionpublic void writeDocumentPart(DocumentPart dp) throws Exception
DocumentwriteDocumentPart in interface DocumentExceptionpublic <T extends Serializable> void setSystemProp(String name, T value) throws DocumentException
DocumentsetSystemProp in interface DocumentDocumentExceptionpublic <T extends Serializable> T getSystemProp(String name, Class<T> type) throws DocumentException
DocumentgetSystemProp in interface DocumentDocumentExceptionpublic Set<String> getAllFacets()
DocumentgetAllFacets in interface Documentpublic String[] getFacets()
Documentpublic boolean hasFacet(String facet)
Documentpublic boolean addFacet(String facet) throws DocumentException
DocumentDoes nothing if the facet was already present on the document.
addFacet in interface Documentfacet - 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
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 exitDocumentExceptionpublic String getLifeCyclePolicy() throws LifeCycleException
DocumentgetLifeCyclePolicy in interface DocumentLifeCycleExceptionpublic void setLifeCyclePolicy(String policy) throws LifeCycleException
DocumentsetLifeCyclePolicy in interface Documentpolicy - the policyLifeCycleExceptionpublic String getLifeCycleState() throws LifeCycleException
DocumentgetLifeCycleState in interface DocumentLifeCycleExceptionorg.nuxeo.ecm.core.lifecyclepublic void setCurrentLifeCycleState(String state) throws LifeCycleException
DocumentsetCurrentLifeCycleState in interface Documentstate - the stateLifeCycleExceptionpublic boolean followTransition(String transition) throws LifeCycleException
DocumentThis will update the current life cycle of the document.
followTransition in interface Documenttransition - the name of the transition to followLifeCycleExceptionpublic Collection<String> getAllowedStateTransitions() throws LifeCycleException
DocumentgetAllowedStateTransitions in interface DocumentLifeCycleExceptionpublic Lock getLock() throws DocumentException
LockablegetLock in interface LockableDocumentExceptionpublic Lock setLock(Lock lock) throws DocumentException
LockablesetLock in interface Lockablelock - the lock to setDocumentExceptionpublic Lock removeLock(String owner) throws DocumentException
LockableremoveLock in interface Lockablenull if there was no lock or if removal succeeded, or a
lock if it blocks removal due to owner mismatchDocumentExceptionpublic boolean isVersion()
VersionableDocumentisVersion in interface VersionableDocumentpublic Document getBaseVersion() throws DocumentException
VersionableDocument
Returns null for a checked out document or a version or a proxy.
getBaseVersion in interface VersionableDocumentnullDocumentExceptionpublic String getVersionSeriesId() throws DocumentException
VersionableDocumentgetVersionSeriesId in interface VersionableDocumentDocumentExceptionpublic Document getSourceDocument() throws DocumentException
VersionableDocumentgetSourceDocument in interface VersionableDocumentDocumentExceptionpublic Document checkIn(String label, String checkinComment) throws DocumentException
VersionableDocumentcheckIn in interface VersionableDocumentlabel - the version labelcheckinComment - the checkin commentDocumentExceptionpublic void checkOut()
throws DocumentException
checkOut in interface VersionableDocumentDocumentExceptionpublic boolean isCheckedOut()
throws DocumentException
isCheckedOut in interface VersionableDocumentDocumentExceptionpublic boolean isLatestVersion()
throws DocumentException
isLatestVersion in interface VersionableDocumentDocumentExceptionpublic boolean isMajorVersion()
throws DocumentException
isMajorVersion in interface VersionableDocumentDocumentExceptionpublic boolean isLatestMajorVersion()
throws DocumentException
isLatestMajorVersion in interface VersionableDocumentDocumentExceptionpublic boolean isVersionSeriesCheckedOut()
throws DocumentException
isVersionSeriesCheckedOut in interface VersionableDocumentDocumentExceptionpublic String getVersionLabel() throws DocumentException
getVersionLabel in interface VersionableDocumentDocumentExceptionpublic String getCheckinComment() throws DocumentException
getCheckinComment in interface VersionableDocumentDocumentExceptionpublic Document getWorkingCopy() throws DocumentException
getWorkingCopy in interface VersionableDocumentDocumentExceptionpublic Calendar getVersionCreationDate() throws DocumentException
getVersionCreationDate in interface VersionableDocumentDocumentExceptionpublic void restore(Document version) throws DocumentException
VersionableDocumentrestore in interface VersionableDocumentversion - the version to replace withDocumentExceptionpublic List<String> getVersionsIds() throws DocumentException
VersionableDocumentgetVersionsIds in interface VersionableDocumentDocumentExceptionpublic Document getVersion(String label) throws DocumentException
VersionableDocumentgetVersion in interface VersionableDocumentlabel - the version labelDocumentExceptionpublic List<Document> getVersions() throws DocumentException
getVersions in interface VersionableDocumentDocumentExceptionpublic Document getLastVersion() throws DocumentException
VersionableDocumentgetLastVersion in interface VersionableDocumentDocumentExceptionpublic boolean hasVersions()
throws DocumentException
VersionableDocumentNeeded to know if we need to use checkin/checkout methods when changing a document.
hasVersions in interface VersionableDocumentDocumentExceptionpublic Document resolvePath(String path) throws DocumentException
DocumentContainerIf the path is absolute then it will be transformed in a relative path (i.e. the leading '/' removed).
resolvePath in interface DocumentContainerpath - the path relative to this documentDocumentExceptionpublic Document getChild(String name) throws DocumentException
DocumentContainerThrows 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 DocumentContainername - the name of the child to retrieveDocumentExceptionpublic Iterator<Document> getChildren() throws DocumentException
DocumentContainerThis operation silently ignores non-folder documents: if the document is not a folder then it returns an empty iterator.
getChildren in interface DocumentContainerDocumentExceptionpublic DocumentIterator getChildren(int start) throws DocumentException
getChildren in interface DocumentContainerDocumentExceptionpublic List<String> getChildrenIds() throws DocumentException
DocumentContainergetChildrenIds in interface DocumentContainerDocumentExceptionpublic boolean hasChild(String name) throws DocumentException
DocumentContainerThis operation silently ignores non-folder documents: If the document is not a folder then return false.
hasChild in interface DocumentContainername - the name of the child to testDocumentExceptionpublic boolean hasChildren()
throws DocumentException
DocumentContainerThis operation silently ignores non-folder documents: If the document is not a folder then returns false.
hasChildren in interface DocumentContainerDocumentExceptionpublic Document addChild(String name, String typeName) throws DocumentException
DocumentContainerThis operation throws an error if the current document is not a folder.
addChild in interface DocumentContainername - the name of the new child to createtypeName - the type of the child to createDocumentExceptionpublic void orderBefore(String src, String dest) throws DocumentException
DocumentContainerorderBefore in interface DocumentContainersrc - 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
DocumentContainerIf 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 DocumentContainername - the child nameDocumentExceptionpublic Document getTargetDocument()
DocumentProxygetTargetDocument in interface DocumentProxypublic void setTargetDocument(Document target) throws DocumentException
DocumentProxysetTargetDocument in interface DocumentProxyDocumentExceptionpublic boolean isPropertySet(String name) throws DocumentException
PropertyContainerisPropertySet in interface PropertyisPropertySet in interface PropertyContainername - the path to testDocumentException - if any error occurspublic Property getProperty(String name) throws DocumentException
PropertyContainerIf 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 PropertygetProperty in interface PropertyContainername - the property name to retrieveDocumentException - if any error occurspublic Collection<Property> getProperties() throws DocumentException
PropertyContainerThe returned properties are existing.
getProperties in interface PropertygetProperties in interface PropertyContainerDocumentException - if any error occurspublic Iterator<Property> getPropertyIterator() throws DocumentException
PropertyContainerThe returned properties are existing.
getPropertyIterator in interface PropertygetPropertyIterator in interface PropertyContainerDocumentException - if any error occurspublic Map<String,Object> exportFlatMap(String[] schemas) throws DocumentException
PropertyContainerIf the given schemas array is null then all schemas will be exported.
exportFlatMap in interface PropertyContainerDocumentException - if any error occurspublic Map<String,Map<String,Object>> exportMap(String[] schemas) throws DocumentException
PropertyContainerIf 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 PropertyContainerDocumentException - if any error occurspublic Map<String,Object> exportMap(String schemaName) throws DocumentException
exportMap in interface PropertyContainerDocumentExceptionpublic void importFlatMap(Map<String,Object> map) throws DocumentException
PropertyContainerimportFlatMap in interface PropertyContainerDocumentException - if any error occurspublic void importMap(Map<String,Map<String,Object>> map) throws DocumentException
PropertyContainerThe property tree is recursively traversed and all property exported as entry of the Map.
importMap in interface PropertyContainerDocumentException - if any error occurspublic List<String> getDirtyFields()
PropertyContainerXXX AT: compatibility method for NXP-666
getDirtyFields in interface PropertyContainerpublic Object getPropertyValue(String name) throws DocumentException
PropertyContainer
This is a shortcut for getProperty(String).getValue()
getPropertyValue in interface PropertyContainername - the name of the property to setnull if the property is not
set.DocumentException - if any error occursfor the list of supported value
objectspublic String getString(String name) throws DocumentException
PropertyContainerstring.
This is a shortcut for getScalar(name).getString()
getString in interface PropertyContainerDocumentException - if any error occursSimpleProperty#getString()};public boolean getBoolean(String name) throws DocumentException
PropertyContainerboolean.
This is a shortcut for getScalar(name).getBoolean()
getBoolean in interface PropertyContainerDocumentException - if any error occursSimpleProperty#getBoolean()};public long getLong(String name) throws DocumentException
PropertyContainerlong.
This is a shortcut for getScalar(name).getLong()
getLong in interface PropertyContainerDocumentException - if any error occursSimpleProperty#getLong()};public double getDouble(String name) throws DocumentException
PropertyContainerdouble.
This is a shortcut for getScalar(name).getDouble()
getDouble in interface PropertyContainerDocumentException - if any error occursSimpleProperty#getDouble()};public Calendar getDate(String name) throws DocumentException
PropertyContainerdate.
This is a shortcut for getScalar(name).getDate()
getDate in interface PropertyContainerDocumentException - if any error occursSimpleProperty#getDate()};public Blob getContent(String name) throws DocumentException
PropertyContainergetContent in interface PropertyContainerDocumentException - if any error occurspublic void setPropertyValue(String name, 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:
setPropertyValue in interface PropertyContainername - the name of the property to setvalue - the value to setDocumentException - if any error occurspublic void setString(String name, String value) throws DocumentException
PropertyContainerIf 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 PropertyContainerDocumentException - if any error occursSimpleProperty#setString(String)}public void setBoolean(String name, boolean value) throws DocumentException
PropertyContainerIf 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 PropertyContainerDocumentException - if any error occursSimpleProperty#setBoolean(boolean)}public void setLong(String name, long value) throws DocumentException
PropertyContainerIf 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 PropertyContainerDocumentException - if any error occursSimpleProperty#setLong(long)}public void setDouble(String name, double value) throws DocumentException
PropertyContainerIf 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 PropertyContainerDocumentException - if any error occursSimpleProperty#setDouble(double)}public void setDate(String name, Calendar value) throws DocumentException
PropertyContainerIf 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 PropertyContainerDocumentException - if any error occursSimpleProperty#setDate(Calendar)}public void setContent(String name, Blob value) throws DocumentException
PropertyContainerIf the property with that name doesn't exists, it will be created
setContent in interface PropertyContainerDocumentException - if any error occurspublic void removeProperty(String name) throws DocumentException
PropertyContainerremoveProperty in interface PropertyContainername - the property to removeDocumentException - if any error occurspublic Object getValue() throws DocumentException
PropertygetValue in interface PropertyDocumentExceptionpublic boolean isNull()
PropertyA null property means that it is defined by the container schema but was not yet set (so it may not exists as a persistent object)
If the property is null the first time a write operation is done on it the property will be created by the underlying storage
public void setNull()
throws DocumentException
PropertyThe property is set to null which may result in being removed from the storage (this aspect depends on the implementation)
setNull in interface PropertyDocumentExceptionpublic void setValue(Object value) throws DocumentException
PropertysetValue in interface Propertyvalue - the value to setDocumentExceptionCopyright © 2012 Nuxeo SA. All Rights Reserved.