Class DBSDocument
- java.lang.Object
-
- org.nuxeo.ecm.core.storage.BaseDocument<State>
-
- org.nuxeo.ecm.core.storage.dbs.DBSDocument
-
- All Implemented Interfaces:
Document
public class DBSDocument extends BaseDocument<State>
Implementation of aDocumentfor Document-Based Storage. The document is stored as a JSON-like Map. The keys of the Map are the property names (including special names for system properties), and the values Map are Serializable values, either:- a scalar (String, Long, Double, Boolean, Calendar, Binary),
- an array of scalars,
- a List of Maps, recursively,
- or another Map, recursively.
- Since:
- 5.9.4
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.nuxeo.ecm.core.storage.BaseDocument
BaseDocument.BlobWriteContext<T extends StateAccessor>, BaseDocument.BlobWriteInfo<T extends StateAccessor>, BaseDocument.StateBlobAccessor, BaseDocument.Visit
-
Nested classes/interfaces inherited from interface org.nuxeo.ecm.core.model.Document
Document.BlobAccessor, Document.WriteContext
-
-
Field Summary
-
Fields inherited from class org.nuxeo.ecm.core.storage.BaseDocument
BLOB_DATA, BLOB_DIGEST, BLOB_ENCODING, BLOB_LENGTH, BLOB_MIME_TYPE, BLOB_NAME, DC_ISSUED, DC_MODIFIED, DC_PREFIX, EMPTY_STRING_ARRAY, FULLTEXT_BINARYTEXT_PROP, FULLTEXT_JOBID_PROP, FULLTEXT_SIMPLETEXT_PROP, HAS_LEGAL_HOLD_PROP, IS_FLEXIBLE_RECORD_PROP, IS_RECORD_PROP, IS_TRASHED_PROP, LIST_INDEX_PATTERN, LOCK_CREATED_PROP, LOCK_OWNER_PROP, MISC_LIFECYCLE_STATE_PROP, NO_DIRTY, NON_CANONICAL_INDEX, RELATED_TEXT, RELATED_TEXT_ID, RELATED_TEXT_RESOURCES, RETAIN_UNTIL_PROP, RETAINED_PROPERTIES_PROP, TOKEN_SEP, VERSION_WRITABLE_PROPS
-
-
Constructor Summary
Constructors Constructor Description DBSDocument(DBSDocumentState docState, DocumentType type, DBSSession session, boolean readonly)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DocumentaddChild(String name, String typeName)Creates a new child document of the given type.booleanaddFacet(String facet)Adds a facet to this document.DocumentcheckIn(String label, String checkinComment)Creates a new version.voidcheckOut()booleanequals(Object other)voidfollowTransition(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.DocumentgetBaseVersion()Gets the version to which a checked in document is linked.String[]getBlobKeys()StringgetChangeToken()Gets the current change token for this document.StringgetCheckinComment()Gets the version check in comment of this document if it's a version or a proxy.DocumentgetChild(String name)Gets a child document given its name.protected StategetChild(State state, String name, Type type)Gets a child state.protected List<State>getChildAsList(State state, String name)Gets a child state which is a list.protected StategetChildForWrite(State state, String name, Type type)Gets a child state into which we will want to write data.List<Document>getChildren()Gets the children of the document.List<String>getChildrenIds()Gets a list of the children ids.protected LockgetDocumentLock()Gets the lock from this recently created and unsaved document.String[]getFacets()Gets the facets defined on this document instance.DocumentgetLastVersion()Gets the last version of this document.StringgetLifeCyclePolicy()Gets the life cycle policy of this document.StringgetLifeCycleState()Gets the life cycle state of this document.StringgetName()Gets the name of this document.DocumentgetParent()Gets the parent document, ornullif this is the root document.StringgetPath()Gets the path of this document.LonggetPos()Gets the document's position in its containing folder (if ordered).SerializablegetPropertyValue(String name)Gets a simple property value.protected List<Schema>getProxySchemas()Gets the list of proxy schemas, if this is a proxy.protected static StringgetProxyUserVisibleChangeToken(String proxyToken, String targetToken)StringgetRepositoryName()Gets the repository in which the document lives.String[]getRetainedProperties()Gets the retained property xpaths of this document instance at the time it became a record.CalendargetRetainUntil()Gets the retention date for the document.protected StringgetSchema(String xpath)protected static Set<String>getSchemas(DocumentType type, List<Object> facets)SessiongetSession()Gets the session that owns this document.DocumentgetSourceDocument()Gets the source for this document.protected DBSDocumentStategetStateOrTarget()Gets the target state if this is a proxy, or the regular state otherwise.protected DBSDocumentStategetStateOrTarget(String xpath)protected DBSDocumentStategetStateOrTarget(Type type)protected DBSDocumentStategetStateOrTargetForSchema(String schema)Checks if the given schema should be resolved on the proxy or the target.<T extends Serializable>
TgetSystemProp(String name, Class<T> type)Gets a system property.DBSDocumentgetTargetDocument()Gets the document (version or live document) to which this proxy points.protected StringgetTargetDocumentId()DocumentTypegetType()Gets the type of this document.StringgetUUID()Gets this document's UUID.ObjectgetValue(String xpath)Gets a property value.DocumentgetVersion(String label)Gets a version of this document, given its label.CalendargetVersionCreationDate()Gets the version creation date of this document if it's a version or a proxy.StringgetVersionLabel()Gets the version label.List<Document>getVersions()Gets the versions for this document.StringgetVersionSeriesId()Gets the version series id.List<String>getVersionsIds()Gets the list of version ids for this document.DocumentgetWorkingCopy()Gets the working copy for this document.booleanhasChild(String name)Checks whether this document has a child of the given name.booleanhasChildren()Tests if the document has any children.booleanhasFacet(String facet)Checks whether this document has a given facet, either from its type or added on the instance.inthashCode()booleanhasLegalHold()Checks if the document has a legal hold set.protected StringinternalName(String name)Finds the internal name to use to refer to this property.booleanisCheckedOut()Checks whether this document is checked out.protected booleanisEqualOnVersion(Object ob, String key)booleanisFlexibleRecord()booleanisFolder()Checks whether this document is a folder.booleanisLatestMajorVersion()Checks whether this document is the latest major version.booleanisLatestVersion()Checks whether this document is the latest version.booleanisMajorVersion()Checks whether this document is a major version.booleanisProxy()Checks whether or not this document is a proxy.booleanisReadOnly()Checks whether this document is readonly or not.booleanisRecord()Checks if the document is a record.booleanisRetentionActive()Checks whether this document is under active retention.protected booleanisSchemaForProxy(String schema)booleanisVersion()Checks whether this document is a version document.booleanisVersionSeriesCheckedOut()Checks if there is a checked out working copy for the version series of this document.voidmakeFlexibleRecord()Turns the document into a flexible record.voidmakeRecord()Turns the document into an enforced record.protected voidmakeRecord(boolean flexible)voidmarkUserChange()Marks the document as being modified by a user change.voidorderBefore(String src, String dest)Orders the given source child before the destination child.voidreadDocumentPart(DocumentPart dp)Loads aDocumentPartfrom storage.voidremove()Removes this document and all its children, if any.voidremove(NuxeoPrincipal principal)Removes this document and all its children, if any.protected LockremoveDocumentLock(String owner)Removes a lock from this recently created and unsaved document.booleanremoveFacet(String facet)Removes a facet from this document.voidremoveSingleton()Removes this document only, without its children.StringreplaceBlobDigest(String key, String newKey, String newDigest)Visits the blobs of this document and, for those with a matching key, replace their key and digest with new ones.protected voidreplaceBlobDigest(Document.BlobAccessor accessor, String key, String newKey, String newDigest, org.apache.commons.lang3.mutable.MutableObject<String> oldDigestHolder)voidrestore(Document version)Replaces this document's content with the version specified.voidsetCurrentLifeCycleState(String lifeCycleState)Sets the life cycle state of this document.protected LocksetDocumentLock(Lock lock)Sets a lock on this recently created and unsaved document.voidsetLegalHold(boolean hold)Sets or removes a legal hold on the document (a record).voidsetLifeCyclePolicy(String policy)Sets the life cycle policy of this document.voidsetPropertyValue(String name, Serializable value)Sets a simple property value.voidsetReadOnly(boolean readonly)Sets this document as readonly or not.voidsetRetainUntil(Calendar retainUntil)Sets a retention date for the document (a record).voidsetRetentionActive(boolean retentionActive)Sets or unsets this document as under active retention.voidsetSystemProp(String name, Serializable value)Sets a system property.voidsetTargetDocument(Document target)Sets the document (version or live document) to which this proxy points.voidsetValue(String xpath, Object value)Sets a property value.StringtoString()protected List<State>updateList(State state, String name, Property property)Update a list.protected voidupdateList(State state, String name, Field field, String xpath, List<Object> values)Update a list.protected static booleanvalidateProxyChangeToken(String userVisibleChangeToken, DBSDocumentState proxyState, DBSDocumentState targetState)booleanvalidateUserVisibleChangeToken(String userVisibleChangeToken)Validates that the passed user-visible change token is compatible with the one for this document.voidvisitBlobs(Consumer<Document.BlobAccessor> blobVisitor)Visits all the blobs of this document and calls the passed blob visitor on each one.booleanwriteDocumentPart(DocumentPart dp, Document.WriteContext writeContext, boolean create)Writes aDocumentPartto storage.-
Methods inherited from class org.nuxeo.ecm.core.storage.BaseDocument
allowNewRetention, buildUserVisibleChangeToken, canonicalXPath, checkReadOnlyIgnoredWrite, clearDirtyFlags, getBlobInfo, getDocumentBlobManager, getLegacyChangeToken, getLock, getTopLevelSchema, getValueBlob, getValueComplex, getValueField, getValueObject, getWriteContext, isRetainable, isRetained, isUnderRetentionOrLegalHold, isVersionWritableProperty, notifySetRetainUntil, readComplexProperty, readComplexProperty, removeLock, setBlobInfo, setLock, setPropertyBlobData, setValueBlob, setValueBlob, setValueComplex, setValueField, setValueObject, typedArray, updateChangeToken, validateLegacyChangeToken, validateUserVisibleChangeToken, visitBlobs, writeComplexProperty, writeComplexProperty, writeDocumentPart
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.nuxeo.ecm.core.model.Document
isEnforcedRecord, writeDocumentPart
-
-
-
-
Field Detail
-
SYSPROP_FULLTEXT_SIMPLE
public static final String SYSPROP_FULLTEXT_SIMPLE
- See Also:
- Constant Field Values
-
SYSPROP_FULLTEXT_BINARY
public static final String SYSPROP_FULLTEXT_BINARY
- See Also:
- Constant Field Values
-
SYSPROP_FULLTEXT_JOBID
public static final String SYSPROP_FULLTEXT_JOBID
- See Also:
- Constant Field Values
-
SYSPROP_IS_TRASHED
public static final String SYSPROP_IS_TRASHED
- See Also:
- Constant Field Values
-
KEY_PREFIX
public static final String KEY_PREFIX
- See Also:
- Constant Field Values
-
KEY_ID
public static final String KEY_ID
- See Also:
- Constant Field Values
-
KEY_PARENT_ID
public static final String KEY_PARENT_ID
- See Also:
- Constant Field Values
-
KEY_ANCESTOR_IDS
public static final String KEY_ANCESTOR_IDS
- See Also:
- Constant Field Values
-
KEY_PRIMARY_TYPE
public static final String KEY_PRIMARY_TYPE
- See Also:
- Constant Field Values
-
KEY_MIXIN_TYPES
public static final String KEY_MIXIN_TYPES
- See Also:
- Constant Field Values
-
KEY_NAME
public static final String KEY_NAME
- See Also:
- Constant Field Values
-
KEY_POS
public static final String KEY_POS
- See Also:
- Constant Field Values
-
KEY_ACP
public static final String KEY_ACP
- See Also:
- Constant Field Values
-
KEY_ACL_NAME
public static final String KEY_ACL_NAME
- See Also:
- Constant Field Values
-
KEY_PATH_INTERNAL
public static final String KEY_PATH_INTERNAL
- See Also:
- Constant Field Values
-
KEY_ACL
public static final String KEY_ACL
- See Also:
- Constant Field Values
-
KEY_ACE_USER
public static final String KEY_ACE_USER
- See Also:
- Constant Field Values
-
KEY_ACE_PERMISSION
public static final String KEY_ACE_PERMISSION
- See Also:
- Constant Field Values
-
KEY_ACE_GRANT
public static final String KEY_ACE_GRANT
- See Also:
- Constant Field Values
-
KEY_ACE_CREATOR
public static final String KEY_ACE_CREATOR
- See Also:
- Constant Field Values
-
KEY_ACE_BEGIN
public static final String KEY_ACE_BEGIN
- See Also:
- Constant Field Values
-
KEY_ACE_END
public static final String KEY_ACE_END
- See Also:
- Constant Field Values
-
KEY_ACE_STATUS
public static final String KEY_ACE_STATUS
- See Also:
- Constant Field Values
-
KEY_READ_ACL
public static final String KEY_READ_ACL
- See Also:
- Constant Field Values
-
KEY_IS_RECORD
public static final String KEY_IS_RECORD
- Since:
- 11.1
- See Also:
- Constant Field Values
-
KEY_IS_FLEXIBLE_RECORD
public static final String KEY_IS_FLEXIBLE_RECORD
- Since:
- 2023.1
- See Also:
- Constant Field Values
-
KEY_RETAIN_UNTIL
public static final String KEY_RETAIN_UNTIL
- Since:
- 11.1
- See Also:
- Constant Field Values
-
KEY_HAS_LEGAL_HOLD
public static final String KEY_HAS_LEGAL_HOLD
- Since:
- 11.1
- See Also:
- Constant Field Values
-
KEY_IS_RETENTION_ACTIVE
@Deprecated public static final String KEY_IS_RETENTION_ACTIVE
Deprecated.since 11.1- See Also:
- Constant Field Values
-
KEY_IS_CHECKED_IN
public static final String KEY_IS_CHECKED_IN
- See Also:
- Constant Field Values
-
KEY_IS_VERSION
public static final String KEY_IS_VERSION
- See Also:
- Constant Field Values
-
KEY_IS_LATEST_VERSION
public static final String KEY_IS_LATEST_VERSION
- See Also:
- Constant Field Values
-
KEY_IS_LATEST_MAJOR_VERSION
public static final String KEY_IS_LATEST_MAJOR_VERSION
- See Also:
- Constant Field Values
-
KEY_MAJOR_VERSION
public static final String KEY_MAJOR_VERSION
- See Also:
- Constant Field Values
-
KEY_MINOR_VERSION
public static final String KEY_MINOR_VERSION
- See Also:
- Constant Field Values
-
KEY_VERSION_SERIES_ID
public static final String KEY_VERSION_SERIES_ID
- See Also:
- Constant Field Values
-
KEY_VERSION_CREATED
public static final String KEY_VERSION_CREATED
- See Also:
- Constant Field Values
-
KEY_VERSION_LABEL
public static final String KEY_VERSION_LABEL
- See Also:
- Constant Field Values
-
KEY_VERSION_DESCRIPTION
public static final String KEY_VERSION_DESCRIPTION
- See Also:
- Constant Field Values
-
KEY_BASE_VERSION_ID
public static final String KEY_BASE_VERSION_ID
- See Also:
- Constant Field Values
-
KEY_IS_PROXY
public static final String KEY_IS_PROXY
- See Also:
- Constant Field Values
-
KEY_PROXY_TARGET_ID
public static final String KEY_PROXY_TARGET_ID
- See Also:
- Constant Field Values
-
KEY_PROXY_VERSION_SERIES_ID
public static final String KEY_PROXY_VERSION_SERIES_ID
- See Also:
- Constant Field Values
-
KEY_PROXY_IDS
public static final String KEY_PROXY_IDS
- See Also:
- Constant Field Values
-
KEY_LIFECYCLE_POLICY
public static final String KEY_LIFECYCLE_POLICY
- See Also:
- Constant Field Values
-
KEY_LIFECYCLE_STATE
public static final String KEY_LIFECYCLE_STATE
- See Also:
- Constant Field Values
-
KEY_IS_TRASHED
public static final String KEY_IS_TRASHED
- Since:
- 10.1
- See Also:
- Constant Field Values
-
KEY_LOCK_OWNER
public static final String KEY_LOCK_OWNER
- See Also:
- Constant Field Values
-
KEY_LOCK_CREATED
public static final String KEY_LOCK_CREATED
- See Also:
- Constant Field Values
-
KEY_SYS_CHANGE_TOKEN
public static final String KEY_SYS_CHANGE_TOKEN
- See Also:
- Constant Field Values
-
KEY_CHANGE_TOKEN
public static final String KEY_CHANGE_TOKEN
- See Also:
- Constant Field Values
-
KEY_DC_MODIFIED
public static final String KEY_DC_MODIFIED
- See Also:
- Constant Field Values
-
KEY_BLOB_NAME
public static final String KEY_BLOB_NAME
- See Also:
- Constant Field Values
-
KEY_BLOB_MIME_TYPE
public static final String KEY_BLOB_MIME_TYPE
- See Also:
- Constant Field Values
-
KEY_BLOB_ENCODING
public static final String KEY_BLOB_ENCODING
- See Also:
- Constant Field Values
-
KEY_BLOB_DIGEST
public static final String KEY_BLOB_DIGEST
- See Also:
- Constant Field Values
-
KEY_BLOB_LENGTH
public static final String KEY_BLOB_LENGTH
- See Also:
- Constant Field Values
-
KEY_BLOB_DATA
public static final String KEY_BLOB_DATA
- See Also:
- Constant Field Values
-
KEY_BLOB_KEYS
public static final String KEY_BLOB_KEYS
- Since:
- 11.5
- See Also:
- Constant Field Values
-
KEY_RETAINED_PROPS
public static final String KEY_RETAINED_PROPS
- Since:
- 2021.32
- See Also:
- Constant Field Values
-
KEY_FULLTEXT_SIMPLE
public static final String KEY_FULLTEXT_SIMPLE
- See Also:
- Constant Field Values
-
KEY_FULLTEXT_BINARY
public static final String KEY_FULLTEXT_BINARY
- See Also:
- Constant Field Values
-
KEY_FULLTEXT_JOBID
public static final String KEY_FULLTEXT_JOBID
- See Also:
- Constant Field Values
-
KEY_FULLTEXT_SCORE
public static final String KEY_FULLTEXT_SCORE
- See Also:
- Constant Field Values
-
APPLICATION_OCTET_STREAM
public static final String APPLICATION_OCTET_STREAM
- See Also:
- Constant Field Values
-
PROP_UID_MAJOR_VERSION
public static final String PROP_UID_MAJOR_VERSION
- See Also:
- Constant Field Values
-
PROP_UID_MINOR_VERSION
public static final String PROP_UID_MINOR_VERSION
- See Also:
- Constant Field Values
-
PROP_MAJOR_VERSION
public static final String PROP_MAJOR_VERSION
- See Also:
- Constant Field Values
-
PROP_MINOR_VERSION
public static final String PROP_MINOR_VERSION
- See Also:
- Constant Field Values
-
FACETED_TAG
public static final String FACETED_TAG
- Since:
- 9.3
- See Also:
- Constant Field Values
-
FACETED_TAG_LABEL
public static final String FACETED_TAG_LABEL
- Since:
- 9.3
- See Also:
- Constant Field Values
-
INITIAL_SYS_CHANGE_TOKEN
public static final Long INITIAL_SYS_CHANGE_TOKEN
-
INITIAL_CHANGE_TOKEN
public static final Long INITIAL_CHANGE_TOKEN
-
id
protected final String id
-
docState
protected final DBSDocumentState docState
-
type
protected final DocumentType type
-
session
protected final DBSSession session
-
readonly
protected boolean readonly
-
CHANGE_TOKEN_PROXY_SEP
public static final String CHANGE_TOKEN_PROXY_SEP
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DBSDocument
public DBSDocument(DBSDocumentState docState, DocumentType type, DBSSession session, boolean readonly)
-
-
Method Detail
-
getType
public DocumentType getType()
Description copied from interface:DocumentGets the type of this document.- Returns:
- the document type
-
getSession
public Session getSession()
Description copied from interface:DocumentGets the session that owns this document.- Returns:
- the session
-
getRepositoryName
public String getRepositoryName()
Description copied from interface:DocumentGets the repository in which the document lives.- Returns:
- the repository name.
-
getProxySchemas
protected List<Schema> getProxySchemas()
Description copied from class:BaseDocumentGets the list of proxy schemas, if this is a proxy.- Specified by:
getProxySchemasin classBaseDocument<State>- Returns:
- the proxy schemas, or
null
-
getUUID
public String getUUID()
Description copied from interface:DocumentGets this document's UUID.- Returns:
- the document UUID
-
getName
public String getName()
Description copied from interface:DocumentGets the name of this document.- Returns:
- the document name
-
getPos
public Long getPos()
Description copied from interface:DocumentGets the document's position in its containing folder (if ordered).- Returns:
- the position
-
getParent
public Document getParent()
Description copied from interface:DocumentGets the parent document, ornullif this is the root document.- Returns:
- the parent document, or
null
-
isProxy
public boolean isProxy()
Description copied from interface:DocumentChecks whether or not this document is a proxy.- Returns:
trueif this document is a proxy,falseotherwise
-
isVersion
public boolean isVersion()
Description copied from interface:DocumentChecks whether this document is a version document.- Returns:
trueif it's a version,falseotherwise
-
getPath
public String getPath()
Description copied from interface:DocumentGets the path of this document.- Returns:
- the path
-
getChild
public Document getChild(String name)
Description copied from interface:DocumentGets a child document given its name.Throws
DocumentNotFoundExceptionif the document could not be found.- Parameters:
name- the name of the child to retrieve- Returns:
- the child if exists
-
getChildren
public List<Document> getChildren()
Description copied from interface:DocumentGets the children of the document.- Returns:
- the children
-
getChildrenIds
public List<String> getChildrenIds()
Description copied from interface:DocumentGets a list of the children ids.- Returns:
- a list of children ids.
-
hasChild
public boolean hasChild(String name)
Description copied from interface:DocumentChecks whether this document has a child of the given name.- Parameters:
name- the name of the child to check- Returns:
trueif the child exists,falseotherwise
-
hasChildren
public boolean hasChildren()
Description copied from interface:DocumentTests if the document has any children.- Returns:
trueif the document has children,falseotherwise
-
addChild
public Document addChild(String name, String typeName)
Description copied from interface:DocumentCreates a new child document of the given type.- Parameters:
name- the name of the new child to createtypeName- the type of the child to create- Returns:
- the newly created document
-
orderBefore
public void orderBefore(String src, String dest)
Description copied from interface:DocumentOrders the given source child before the destination child.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.- Parameters:
src- the document to movedest- the document before which to place the source document
-
getPropertyValue
public Serializable getPropertyValue(String name)
Description copied from interface:DocumentGets a simple property value.For more generic properties described by an xpath, use
Document.getValue(java.lang.String)instead.- Parameters:
name- the name of the property to get- Returns:
- the property value or
nullif the property is not set - See Also:
Document.getValue(java.lang.String)
-
setPropertyValue
public void setPropertyValue(String name, Serializable value)
Description copied from interface:DocumentSets a simple property value.For more generic properties described by an xpath, use
Document.setValue(java.lang.String, java.lang.Object)instead.- Parameters:
name- the name of the property to setvalue- the value to set- See Also:
Document.setValue(java.lang.String, java.lang.Object)
-
getChild
protected State getChild(State state, String name, Type type)
Description copied from class:BaseDocumentGets a child state.- Specified by:
getChildin classBaseDocument<State>- Parameters:
state- the parent statename- the child nametype- the child's type- Returns:
- the child state, or
nullif it doesn't exist
-
getChildForWrite
protected State getChildForWrite(State state, String name, Type type) throws PropertyException
Description copied from class:BaseDocumentGets a child state into which we will want to write data.Creates it if needed.
- Specified by:
getChildForWritein classBaseDocument<State>- Parameters:
state- the parent statename- the child nametype- the child's type- Returns:
- the child state, never
null - Throws:
PropertyException
-
getChildAsList
protected List<State> getChildAsList(State state, String name)
Description copied from class:BaseDocumentGets a child state which is a list.- Specified by:
getChildAsListin classBaseDocument<State>- Parameters:
state- the parent statename- the child name- Returns:
- the child state, never
null
-
updateList
protected void updateList(State state, String name, Field field, String xpath, List<Object> values)
Description copied from class:BaseDocumentUpdate a list.- Specified by:
updateListin classBaseDocument<State>- Parameters:
state- the parent statename- the child namefield- the list element typexpath- the xpath of this listvalues- the values
-
updateList
protected List<State> updateList(State state, String name, Property property) throws PropertyException
Description copied from class:BaseDocumentUpdate a list.- Specified by:
updateListin classBaseDocument<State>- Parameters:
state- the parent statename- the child nameproperty- the property- Returns:
- the list of states to write
- Throws:
PropertyException
-
getValue
public Object getValue(String xpath) throws PropertyException
Description copied from interface:DocumentGets a property value.The xpath may point to a partial path, in which case the value may be a complex
ListorMap.- Parameters:
xpath- the xpath of the property to set- Returns:
- the property value or
nullif the property is not set - Throws:
PropertyException- if the property does not exist
-
setValue
public void setValue(String xpath, Object value) throws PropertyException
Description copied from interface:DocumentSets a property value.The xpath may point to a partial path, in which case the value may be a complex
ListorMap.- Parameters:
xpath- the xpath of the property to setvalue- the value to set- Throws:
PropertyException- if the property does not exist or the value is of the wrong type
-
visitBlobs
public void visitBlobs(Consumer<Document.BlobAccessor> blobVisitor) throws PropertyException
Description copied from interface:DocumentVisits all the blobs of this document and calls the passed blob visitor on each one.- Throws:
PropertyException
-
replaceBlobDigest
public String replaceBlobDigest(String key, String newKey, String newDigest)
Description copied from interface:DocumentVisits the blobs of this document and, for those with a matching key, replace their key and digest with new ones.- Parameters:
key- the bob key to look fornewKey- the new keynewDigest- the new digest- Returns:
- the old digest if at least one replacement was done,
nullotherwise
-
replaceBlobDigest
protected void replaceBlobDigest(Document.BlobAccessor accessor, String key, String newKey, String newDigest, org.apache.commons.lang3.mutable.MutableObject<String> oldDigestHolder)
-
makeFlexibleRecord
public void makeFlexibleRecord()
Description copied from interface:DocumentTurns the document into a flexible record.A record is a document with specific capabilities related to mandatory retention until a given date, and legal holds.
If the document is already a flexible record, this method has no effect. An enforced record cannot be turned into a flexible record.
The permission "MakeRecord" is required.
- See Also:
Document.isFlexibleRecord()
-
makeRecord
public void makeRecord()
Description copied from interface:DocumentTurns the document into an enforced record.A record is a document with specific capabilities related to mandatory retention until a given date, and legal holds. In addition, its main blob receives special treatment from the document blob manager to make sure it's never shared with another blob at the storage level, and is deleted as soon as the record is deleted.
If the document is already a record, this method has no effect.
The permission "MakeRecord" is required.
- See Also:
Document.isRecord()
-
makeRecord
protected void makeRecord(boolean flexible)
-
isRecord
public boolean isRecord()
Description copied from interface:DocumentChecks if the document is a record.- Returns:
trueif the document is a record,falseotherwise- See Also:
Document.makeRecord()
-
isFlexibleRecord
public boolean isFlexibleRecord()
- Returns:
trueif the document is a flexible record,falseotherwise
-
setRetainUntil
public void setRetainUntil(Calendar retainUntil) throws PropertyException
Description copied from interface:DocumentSets a retention date for the document (a record).If no previous retention date was set, or if the previous retention date was indeterminate, or if the previous retention date was before the given value, then the retention date is set to the given value.
If the previous retention date was after the given value (that is, if trying to reduce the retention time), an exception is thrown.
If the given value is
nulland the previous retention date is in the past (it has already expired), then the retention date is set tonull.The permission "SetRetention" is required.
- Parameters:
retainUntil- the new retention date- Throws:
PropertyException- if trying to reduce the retention time, or if the document is not a record- See Also:
Document.getRetainUntil(),CoreSession.RETAIN_UNTIL_INDETERMINATE
-
getRetainUntil
public Calendar getRetainUntil()
Description copied from interface:DocumentGets the retention date for the document.- Returns:
- the retention date, or "SetRetention" for a
retention in the indeterminate future, or
nullif there is no retention date - See Also:
Document.setRetainUntil(java.util.Calendar),CoreSession.RETAIN_UNTIL_INDETERMINATE
-
setLegalHold
public void setLegalHold(boolean hold)
Description copied from interface:DocumentSets or removes a legal hold on the document (a record).The permission "ManageLegalHold" is required.
- Parameters:
hold-trueto set a legal hold,falseto remove it- See Also:
Document.hasLegalHold()
-
hasLegalHold
public boolean hasLegalHold()
Description copied from interface:DocumentChecks if the document has a legal hold set.- Returns:
trueif a legal hold has been set on the document,falseotherwise- See Also:
Document.setLegalHold(boolean)
-
isRetentionActive
public boolean isRetentionActive()
Description copied from interface:DocumentChecks whether this document is under active retention.
-
setRetentionActive
public void setRetentionActive(boolean retentionActive)
Description copied from interface:DocumentSets or unsets this document as under active retention.
-
checkIn
public Document checkIn(String label, String checkinComment)
Description copied from interface:DocumentCreates a new version.- Parameters:
label- the version labelcheckinComment- the checkin comment- Returns:
- the created version
-
checkOut
public void checkOut()
-
getVersionsIds
public List<String> getVersionsIds()
Description copied from interface:DocumentGets the list of version ids for this document.- Returns:
- the list of version ids
-
getVersions
public List<Document> getVersions()
Description copied from interface:DocumentGets the versions for this document.- Returns:
- the versions of the document, or an empty list if there are no versions
-
getLastVersion
public Document getLastVersion()
Description copied from interface:DocumentGets the last version of this document.Returns
nullif there is no version at all.- Returns:
- the last version, or
nullif there is no version
-
getSourceDocument
public Document getSourceDocument()
Description copied from interface:DocumentGets the source for this document.For a version, it's the working copy.
For a proxy, it's the version the proxy points to.
- Returns:
- the source document
-
restore
public void restore(Document version)
Description copied from interface:DocumentReplaces this document's content with the version specified.- Parameters:
version- the version to replace with
-
getVersion
public Document getVersion(String label)
Description copied from interface:DocumentGets a version of this document, given its label.- Parameters:
label- the version label- Returns:
- the version
-
getBaseVersion
public Document getBaseVersion()
Description copied from interface:DocumentGets the version to which a checked in document is linked.Returns
nullfor a checked out document or a version or a proxy.- Returns:
- the version, or
null
-
isCheckedOut
public boolean isCheckedOut()
Description copied from interface:DocumentChecks whether this document is checked out.- Returns:
trueif the document is checked out, orfalseotherwise
-
getVersionSeriesId
public String getVersionSeriesId()
Description copied from interface:DocumentGets the version series id.- Returns:
- the version series id
-
getVersionCreationDate
public Calendar getVersionCreationDate()
Description copied from interface:DocumentGets the version creation date of this document if it's a version or a proxy.- Returns:
- the version creation date, or
nullif it's not a version or a proxy
-
getVersionLabel
public String getVersionLabel()
Description copied from interface:DocumentGets the version label.- Returns:
- the version label
-
getCheckinComment
public String getCheckinComment()
Description copied from interface:DocumentGets the version check in comment of this document if it's a version or a proxy.- Returns:
- the check in comment, or
nullif it's not a version or a proxy
-
isLatestVersion
public boolean isLatestVersion()
Description copied from interface:DocumentChecks whether this document is the latest version.- Returns:
trueif this is the latest version, orfalseotherwise
-
isMajorVersion
public boolean isMajorVersion()
Description copied from interface:DocumentChecks whether this document is a major version.- Returns:
trueif this is a major version, orfalseotherwise
-
isLatestMajorVersion
public boolean isLatestMajorVersion()
Description copied from interface:DocumentChecks whether this document is the latest major version.- Returns:
trueif this is the latest major version, orfalseotherwise
-
isVersionSeriesCheckedOut
public boolean isVersionSeriesCheckedOut()
Description copied from interface:DocumentChecks if there is a checked out working copy for the version series of this document.- Returns:
trueif there is a checked out working copy
-
getWorkingCopy
public Document getWorkingCopy()
Description copied from interface:DocumentGets the working copy for this document.- Returns:
- the working copy
-
isFolder
public boolean isFolder()
Description copied from interface:DocumentChecks whether this document is a folder.- Returns:
trueif the document is a folder,falseotherwise
-
setReadOnly
public void setReadOnly(boolean readonly)
Description copied from interface:DocumentSets this document as readonly or not.
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:DocumentChecks whether this document is readonly or not.
-
remove
public void remove()
Description copied from interface:DocumentRemoves this document and all its children, if any.
-
remove
public void remove(NuxeoPrincipal principal)
Description copied from interface:DocumentRemoves this document and all its children, if any.- Parameters:
principal- the caller
-
removeSingleton
public void removeSingleton()
Description copied from interface:DocumentRemoves this document only, without its children.
-
getBlobKeys
public String[] getBlobKeys()
-
getLifeCycleState
public String getLifeCycleState()
Description copied from interface:DocumentGets the life cycle state of this document.- Returns:
- the life cycle state
-
setCurrentLifeCycleState
public void setCurrentLifeCycleState(String lifeCycleState) throws LifeCycleException
Description copied from interface:DocumentSets the life cycle state of this document.- Parameters:
lifeCycleState- the life cycle state- Throws:
LifeCycleException
-
getLifeCyclePolicy
public String getLifeCyclePolicy()
Description copied from interface:DocumentGets the life cycle policy of this document.- Returns:
- the life cycle policy
-
setLifeCyclePolicy
public void setLifeCyclePolicy(String policy) throws LifeCycleException
Description copied from interface:DocumentSets the life cycle policy of this document.- Parameters:
policy- the life cycle policy- Throws:
LifeCycleException
-
followTransition
public void followTransition(String transition) throws LifeCycleException
Description copied from interface:DocumentFollows a given life cycle transition.This will update the life cycle state of the document.
- Parameters:
transition- the name of the transition to follow- Throws:
LifeCycleException
-
getAllowedStateTransitions
public Collection<String> getAllowedStateTransitions() throws LifeCycleException
Description copied from interface:DocumentReturns the allowed state transitions for this document.- Returns:
- a collection of state transitions
- Throws:
LifeCycleException
-
setSystemProp
public void setSystemProp(String name, Serializable value)
Description copied from interface:DocumentSets a system property.
-
getSystemProp
public <T extends Serializable> T getSystemProp(String name, Class<T> type)
Description copied from interface:DocumentGets a system property.
-
getChangeToken
public String getChangeToken()
Description copied from interface:DocumentGets the current change token for this document.- Returns:
- the change token
-
getProxyUserVisibleChangeToken
protected static String getProxyUserVisibleChangeToken(String proxyToken, String targetToken)
-
validateUserVisibleChangeToken
public boolean validateUserVisibleChangeToken(String userVisibleChangeToken)
Description copied from interface:DocumentValidates that the passed user-visible change token is compatible with the one for this document.- Returns:
falseif the change token is not valid
-
validateProxyChangeToken
protected static boolean validateProxyChangeToken(String userVisibleChangeToken, DBSDocumentState proxyState, DBSDocumentState targetState)
-
markUserChange
public void markUserChange()
Description copied from interface:DocumentMarks the document as being modified by a user change.This causes an additional change token increment and check during save.
-
getStateOrTarget
protected DBSDocumentState getStateOrTarget(Type type) throws PropertyException
- Throws:
PropertyException
-
getStateOrTarget
protected DBSDocumentState getStateOrTarget(String xpath)
-
getStateOrTargetForSchema
protected DBSDocumentState getStateOrTargetForSchema(String schema)
Checks if the given schema should be resolved on the proxy or the target.
-
getStateOrTarget
protected DBSDocumentState getStateOrTarget()
Gets the target state if this is a proxy, or the regular state otherwise.
-
isSchemaForProxy
protected boolean isSchemaForProxy(String schema)
-
readDocumentPart
public void readDocumentPart(DocumentPart dp) throws PropertyException
Description copied from interface:DocumentLoads aDocumentPartfrom storage.Reading data is done by
DocumentPartbecause of per-proxy schemas.- Throws:
PropertyException
-
internalName
protected String internalName(String name)
Description copied from class:BaseDocumentFinds the internal name to use to refer to this property.- Specified by:
internalNamein classBaseDocument<State>
-
writeDocumentPart
public boolean writeDocumentPart(DocumentPart dp, Document.WriteContext writeContext, boolean create) throws PropertyException
Description copied from interface:DocumentWrites aDocumentPartto storage.Writing data is done by
DocumentPartbecause of per-proxy schemas.- Parameters:
dp- the document partwriteContext- the write contextcreate- whether this is for a document creation- Returns:
trueif something changed- Throws:
PropertyException
-
getAllFacets
public Set<String> getAllFacets()
Description copied from interface:DocumentGets the facets available on this document (from the type and the instance facets).- Returns:
- the facets
-
getFacets
public String[] getFacets()
Description copied from interface:DocumentGets the facets defined on this document instance. The type facets are not returned.- Returns:
- the facets
-
getRetainedProperties
public String[] getRetainedProperties() throws PropertyException
Description copied from interface:DocumentGets the retained property xpaths of this document instance at the time it became a record.- Returns:
- the retained properties
- Throws:
PropertyException- if document is not a record
-
hasFacet
public boolean hasFacet(String facet)
Description copied from interface:DocumentChecks whether this document has a given facet, either from its type or added on the instance.- Parameters:
facet- the facet name- Returns:
trueif the document has the facet
-
addFacet
public boolean addFacet(String facet)
Description copied from interface:DocumentAdds a facet to this document.Does nothing if the facet was already present on the document.
- Parameters:
facet- the facet name- Returns:
trueif the facet was added, orfalseif it is already present
-
removeFacet
public boolean removeFacet(String facet)
Description copied from interface:DocumentRemoves a facet from this document.It's not possible to remove a facet coming from the document type.
- Parameters:
facet- the facet name- Returns:
trueif the facet was removed, orfalseif it isn't present or is present on the type or does not exit
-
getSchemas
protected static Set<String> getSchemas(DocumentType type, List<Object> facets)
-
getTargetDocument
public DBSDocument getTargetDocument()
Description copied from interface:DocumentGets the document (version or live document) to which this proxy points.
-
getTargetDocumentId
protected String getTargetDocumentId()
-
setTargetDocument
public void setTargetDocument(Document target)
Description copied from interface:DocumentSets the document (version or live document) to which this proxy points.
-
getDocumentLock
protected Lock getDocumentLock()
Description copied from class:BaseDocumentGets the lock from this recently created and unsaved document.- Specified by:
getDocumentLockin classBaseDocument<State>- Returns:
- the lock, or
nullif no lock is set
-
setDocumentLock
protected Lock setDocumentLock(Lock lock)
Description copied from class:BaseDocumentSets a lock on this recently created and unsaved document.- Specified by:
setDocumentLockin classBaseDocument<State>- Parameters:
lock- the lock to set- Returns:
nullif locking succeeded, or the existing lock if locking failed
-
removeDocumentLock
protected Lock removeDocumentLock(String owner)
Description copied from class:BaseDocumentRemoves a lock from this recently created and unsaved document.- Specified by:
removeDocumentLockin classBaseDocument<State>- Parameters:
owner- the owner to check, ornullfor no check- Returns:
nullif there was no lock or if removal succeeded, or a lock if it blocks removal due to owner mismatch
-
-